@@ -15,15 +15,49 @@ use std::{any::Any, backtrace::Backtrace, fmt};
1515pub  enum  ErrorHandled  { 
1616    /// Already reported an error for this evaluation, and the compilation is 
1717/// *guaranteed* to fail. Warnings/lints *must not* produce `Reported`. 
18- Reported ( ErrorGuaranteed ) , 
18+ Reported ( ReportedErrorInfo ) , 
1919    /// Don't emit an error, the evaluation failed because the MIR was generic 
2020/// and the substs didn't fully monomorphize it. 
2121TooGeneric , 
2222} 
2323
2424impl  From < ErrorGuaranteed >  for  ErrorHandled  { 
25-     fn  from ( err :  ErrorGuaranteed )  -> ErrorHandled  { 
26-         ErrorHandled :: Reported ( err) 
25+     #[ inline]  
26+     fn  from ( error :  ErrorGuaranteed )  -> ErrorHandled  { 
27+         ErrorHandled :: Reported ( error. into ( ) ) 
28+     } 
29+ } 
30+ 
31+ #[ derive( Debug ,  Copy ,  Clone ,  PartialEq ,  Eq ,  HashStable ,  TyEncodable ,  TyDecodable ) ]  
32+ pub  struct  ReportedErrorInfo  { 
33+     error :  ErrorGuaranteed , 
34+     is_tainted_by_errors :  bool , 
35+ } 
36+ 
37+ impl  ReportedErrorInfo  { 
38+     #[ inline]  
39+     pub  fn  tainted_by_errors ( error :  ErrorGuaranteed )  -> ReportedErrorInfo  { 
40+         ReportedErrorInfo  {  is_tainted_by_errors :  true ,  error } 
41+     } 
42+ 
43+     /// Returns true if evaluation failed because MIR was tainted by errors. 
44+ #[ inline]  
45+     pub  fn  is_tainted_by_errors ( self )  -> bool  { 
46+         self . is_tainted_by_errors 
47+     } 
48+ } 
49+ 
50+ impl  From < ErrorGuaranteed >  for  ReportedErrorInfo  { 
51+     #[ inline]  
52+     fn  from ( error :  ErrorGuaranteed )  -> ReportedErrorInfo  { 
53+         ReportedErrorInfo  {  is_tainted_by_errors :  false ,  error } 
54+     } 
55+ } 
56+ 
57+ impl  Into < ErrorGuaranteed >  for  ReportedErrorInfo  { 
58+     #[ inline]  
59+     fn  into ( self )  -> ErrorGuaranteed  { 
60+         self . error 
2761    } 
2862} 
2963
@@ -89,7 +123,7 @@ fn print_backtrace(backtrace: &Backtrace) {
89123
90124impl  From < ErrorGuaranteed >  for  InterpErrorInfo < ' _ >  { 
91125    fn  from ( err :  ErrorGuaranteed )  -> Self  { 
92-         InterpError :: InvalidProgram ( InvalidProgramInfo :: AlreadyReported ( err) ) . into ( ) 
126+         InterpError :: InvalidProgram ( InvalidProgramInfo :: AlreadyReported ( err. into ( ) ) ) . into ( ) 
93127    } 
94128} 
95129
@@ -125,7 +159,7 @@ pub enum InvalidProgramInfo<'tcx> {
125159    /// Resolution can fail if we are in a too generic context. 
126160TooGeneric , 
127161    /// Abort in case errors are already reported. 
128- AlreadyReported ( ErrorGuaranteed ) , 
162+ AlreadyReported ( ReportedErrorInfo ) , 
129163    /// An error occurred during layout computation. 
130164Layout ( layout:: LayoutError < ' tcx > ) , 
131165    /// An error occurred during FnAbi computation: the passed --target lacks FFI support 
@@ -144,7 +178,7 @@ impl fmt::Display for InvalidProgramInfo<'_> {
144178        use  InvalidProgramInfo :: * ; 
145179        match  self  { 
146180            TooGeneric  => write ! ( f,  "encountered overly generic constant" ) , 
147-             AlreadyReported ( ErrorGuaranteed   {  ..  } )  => { 
181+             AlreadyReported ( _ )  => { 
148182                write ! ( 
149183                    f, 
150184                    "an error has already been reported elsewhere (this should not usually be printed)" 
0 commit comments