@@ -4,7 +4,7 @@ use std::num::NonZeroU64;
44
55use log:: trace;
66
7- use rustc_middle:: ty:: { self , TyCtxt } ;
7+ use rustc_middle:: ty;
88use rustc_span:: { source_map:: DUMMY_SP , Span , SpanData , Symbol } ;
99
1010use crate :: stacked_borrows:: { AccessKind , SbTag } ;
@@ -93,7 +93,7 @@ fn prune_stacktrace<'mir, 'tcx>(
9393 // Only prune frames if there is at least one local frame. This check ensures that if
9494 // we get a backtrace that never makes it to the user code because it has detected a
9595 // bug in the Rust runtime, we don't prune away every frame.
96- let has_local_frame = stacktrace. iter ( ) . any ( |frame| frame . instance . def_id ( ) . is_local ( ) ) ;
96+ let has_local_frame = stacktrace. iter ( ) . any ( |frame| ecx . machine . is_local ( frame ) ) ;
9797 if has_local_frame {
9898 // This is part of the logic that `std` uses to select the relevant part of a
9999 // backtrace. But here, we only look for __rust_begin_short_backtrace, not
@@ -114,7 +114,7 @@ fn prune_stacktrace<'mir, 'tcx>(
114114 // This len check ensures that we don't somehow remove every frame, as doing so breaks
115115 // the primary error message.
116116 while stacktrace. len ( ) > 1
117- && stacktrace. last ( ) . map_or ( false , |e | !e . instance . def_id ( ) . is_local ( ) )
117+ && stacktrace. last ( ) . map_or ( false , |frame | !ecx . machine . is_local ( frame ) )
118118 {
119119 stacktrace. pop ( ) ;
120120 }
@@ -213,7 +213,7 @@ pub fn report_error<'tcx, 'mir>(
213213 e. print_backtrace ( ) ;
214214 let msg = e. to_string ( ) ;
215215 report_msg (
216- * ecx. tcx ,
216+ ecx,
217217 DiagLevel :: Error ,
218218 & if let Some ( title) = title { format ! ( "{}: {}" , title, msg) } else { msg. clone ( ) } ,
219219 msg,
@@ -256,19 +256,20 @@ pub fn report_error<'tcx, 'mir>(
256256
257257/// Report an error or note (depending on the `error` argument) with the given stacktrace.
258258/// Also emits a full stacktrace of the interpreter stack.
259- fn report_msg < ' tcx > (
260- tcx : TyCtxt < ' tcx > ,
259+ fn report_msg < ' mir , ' tcx > (
260+ ecx : & InterpCx < ' mir , ' tcx , Evaluator < ' mir , ' tcx > > ,
261261 diag_level : DiagLevel ,
262262 title : & str ,
263263 span_msg : String ,
264264 mut helps : Vec < ( Option < SpanData > , String ) > ,
265265 stacktrace : & [ FrameInfo < ' tcx > ] ,
266266) {
267267 let span = stacktrace. first ( ) . map_or ( DUMMY_SP , |fi| fi. span ) ;
268+ let sess = ecx. tcx . sess ;
268269 let mut err = match diag_level {
269- DiagLevel :: Error => tcx . sess . struct_span_err ( span, title) . forget_guarantee ( ) ,
270- DiagLevel :: Warning => tcx . sess . struct_span_warn ( span, title) ,
271- DiagLevel :: Note => tcx . sess . diagnostic ( ) . span_note_diag ( span, title) ,
270+ DiagLevel :: Error => sess. struct_span_err ( span, title) . forget_guarantee ( ) ,
271+ DiagLevel :: Warning => sess. struct_span_warn ( span, title) ,
272+ DiagLevel :: Note => sess. diagnostic ( ) . span_note_diag ( span, title) ,
272273 } ;
273274
274275 // Show main message.
@@ -293,7 +294,7 @@ fn report_msg<'tcx>(
293294 }
294295 // Add backtrace
295296 for ( idx, frame_info) in stacktrace. iter ( ) . enumerate ( ) {
296- let is_local = frame_info . instance . def_id ( ) . is_local ( ) ;
297+ let is_local = ecx . machine . is_local ( frame_info ) ;
297298 // No span for non-local frames and the first frame (which is the error site).
298299 if is_local && idx > 0 {
299300 err. span_note ( frame_info. span , & frame_info. to_string ( ) ) ;
@@ -413,7 +414,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
413414 _ => ( "tracking was triggered" , DiagLevel :: Note ) ,
414415 } ;
415416
416- report_msg ( * this. tcx , diag_level, title, msg, vec ! [ ] , & stacktrace) ;
417+ report_msg ( this, diag_level, title, msg, vec ! [ ] , & stacktrace) ;
417418 }
418419 } ) ;
419420 }
0 commit comments