@@ -128,7 +128,7 @@ pub enum NonHaltingDiagnostic {
128128 PoppedPointerTag ( Item , String ) ,
129129 TrackingAlloc ( AllocId , Size , Align ) ,
130130 FreedAlloc ( AllocId ) ,
131- AccessedAlloc ( AllocId , AccessKind ) ,
131+ AccessedAlloc ( AllocId , AllocRange , AccessKind ) ,
132132 RejectedIsolatedOp ( String ) ,
133133 ProgressReport {
134134 block_count : u64 , // how many basic blocks have been run so far
@@ -604,28 +604,30 @@ pub fn report_msg<'tcx>(
604604 }
605605
606606 // Add backtrace
607- let mut backtrace_title = String :: from ( "BACKTRACE" ) ;
608- if extra_span {
609- write ! ( backtrace_title, " (of the first span)" ) . unwrap ( ) ;
610- }
611- if let Some ( thread) = thread {
612- let thread_name = machine. threads . get_thread_display_name ( thread) ;
613- if thread_name != "main" {
614- // Only print thread name if it is not `main`.
615- write ! ( backtrace_title, " on thread `{thread_name}`" ) . unwrap ( ) ;
616- } ;
617- }
618- write ! ( backtrace_title, ":" ) . unwrap ( ) ;
619- err. note ( backtrace_title) ;
620- for ( idx, frame_info) in stacktrace. iter ( ) . enumerate ( ) {
621- let is_local = machine. is_local ( frame_info) ;
622- // No span for non-local frames and the first frame (which is the error site).
623- if is_local && idx > 0 {
624- err. subdiagnostic ( frame_info. as_note ( machine. tcx ) ) ;
625- } else {
626- let sm = sess. source_map ( ) ;
627- let span = sm. span_to_embeddable_string ( frame_info. span ) ;
628- err. note ( format ! ( "{frame_info} at {span}" ) ) ;
607+ if stacktrace. len ( ) > 1 {
608+ let mut backtrace_title = String :: from ( "BACKTRACE" ) ;
609+ if extra_span {
610+ write ! ( backtrace_title, " (of the first span)" ) . unwrap ( ) ;
611+ }
612+ if let Some ( thread) = thread {
613+ let thread_name = machine. threads . get_thread_display_name ( thread) ;
614+ if thread_name != "main" {
615+ // Only print thread name if it is not `main`.
616+ write ! ( backtrace_title, " on thread `{thread_name}`" ) . unwrap ( ) ;
617+ } ;
618+ }
619+ write ! ( backtrace_title, ":" ) . unwrap ( ) ;
620+ err. note ( backtrace_title) ;
621+ for ( idx, frame_info) in stacktrace. iter ( ) . enumerate ( ) {
622+ let is_local = machine. is_local ( frame_info) ;
623+ // No span for non-local frames and the first frame (which is the error site).
624+ if is_local && idx > 0 {
625+ err. subdiagnostic ( frame_info. as_note ( machine. tcx ) ) ;
626+ } else {
627+ let sm = sess. source_map ( ) ;
628+ let span = sm. span_to_embeddable_string ( frame_info. span ) ;
629+ err. note ( format ! ( "{frame_info} at {span}" ) ) ;
630+ }
629631 }
630632 }
631633
@@ -673,15 +675,15 @@ impl<'tcx> MiriMachine<'tcx> {
673675 "created tag {tag:?} with {perm} at {alloc_id:?}{range:?} derived from {orig_tag:?}"
674676 ) ,
675677 PoppedPointerTag ( item, cause) => format ! ( "popped tracked tag for item {item:?}{cause}" ) ,
676- TrackingAlloc ( AllocId ( id ) , size, align) =>
678+ TrackingAlloc ( id , size, align) =>
677679 format ! (
678- "now tracking allocation of {size} bytes (alignment {align} bytes) with id {id} " ,
680+ "now tracking allocation {id:?} of {size} bytes (alignment {align} bytes)" ,
679681 size = size. bytes( ) ,
680682 align = align. bytes( ) ,
681683 ) ,
682- AccessedAlloc ( AllocId ( id ) , access_kind) =>
683- format ! ( "{access_kind} to allocation with id {id}" ) ,
684- FreedAlloc ( AllocId ( id) ) => format ! ( "freed allocation with id {id}" ) ,
684+ AccessedAlloc ( id , range , access_kind) =>
685+ format ! ( "{access_kind} at {id:?}[{}..{}]" , range . start . bytes ( ) , range . end ( ) . bytes ( ) ) ,
686+ FreedAlloc ( id) => format ! ( "freed allocation {id:? }" ) ,
685687 RejectedIsolatedOp ( op) => format ! ( "{op} was made to return an error due to isolation" ) ,
686688 ProgressReport { .. } =>
687689 format ! ( "progress report: current operation being executed is here" ) ,
0 commit comments