@@ -70,7 +70,9 @@ pub enum NonHaltingDiagnostic {
70
70
CreatedAlloc ( AllocId , Size , Align , MemoryKind < MiriMemoryKind > ) ,
71
71
FreedAlloc ( AllocId ) ,
72
72
RejectedIsolatedOp ( String ) ,
73
- ProgressReport ,
73
+ ProgressReport {
74
+ block_count : u64 , // how many basic blocks have been run so far
75
+ } ,
74
76
Int2Ptr {
75
77
details : bool ,
76
78
} ,
@@ -261,6 +263,7 @@ pub fn report_error<'tcx, 'mir>(
261
263
DiagLevel :: Error ,
262
264
& if let Some ( title) = title { format ! ( "{}: {}" , title, msg[ 0 ] ) } else { msg[ 0 ] . clone ( ) } ,
263
265
msg,
266
+ vec ! [ ] ,
264
267
helps,
265
268
& stacktrace,
266
269
) ;
@@ -307,6 +310,7 @@ fn report_msg<'mir, 'tcx>(
307
310
diag_level : DiagLevel ,
308
311
title : & str ,
309
312
span_msg : Vec < String > ,
313
+ notes : Vec < ( Option < SpanData > , String ) > ,
310
314
helps : Vec < ( Option < SpanData > , String ) > ,
311
315
stacktrace : & [ FrameInfo < ' tcx > ] ,
312
316
) {
@@ -331,15 +335,22 @@ fn report_msg<'mir, 'tcx>(
331
335
err. note ( "(no span available)" ) ;
332
336
}
333
337
334
- // Show help messages.
335
- if !helps. is_empty ( ) {
336
- for ( span_data, help) in helps {
337
- if let Some ( span_data) = span_data {
338
- err. span_help ( span_data. span ( ) , & help) ;
339
- } else {
340
- err. help ( & help) ;
341
- }
338
+ // Show note and help messages.
339
+ for ( span_data, note) in & notes {
340
+ if let Some ( span_data) = span_data {
341
+ err. span_note ( span_data. span ( ) , note) ;
342
+ } else {
343
+ err. note ( note) ;
342
344
}
345
+ }
346
+ for ( span_data, help) in & helps {
347
+ if let Some ( span_data) = span_data {
348
+ err. span_help ( span_data. span ( ) , help) ;
349
+ } else {
350
+ err. help ( help) ;
351
+ }
352
+ }
353
+ if notes. len ( ) + helps. len ( ) > 0 {
343
354
// Add visual separator before backtrace.
344
355
err. note ( "backtrace:" ) ;
345
356
}
@@ -436,6 +447,21 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
436
447
// Show diagnostics.
437
448
for e in diagnostics. drain ( ..) {
438
449
use NonHaltingDiagnostic :: * ;
450
+
451
+ let ( title, diag_level) = match e {
452
+ RejectedIsolatedOp ( _) =>
453
+ ( "operation rejected by isolation" , DiagLevel :: Warning ) ,
454
+ Int2Ptr { .. } => ( "integer-to-pointer cast" , DiagLevel :: Warning ) ,
455
+ CreatedPointerTag ( ..)
456
+ | PoppedPointerTag ( ..)
457
+ | CreatedCallId ( ..)
458
+ | CreatedAlloc ( ..)
459
+ | FreedAlloc ( ..)
460
+ | ProgressReport { .. }
461
+ | WeakMemoryOutdatedLoad =>
462
+ ( "tracking was triggered" , DiagLevel :: Note ) ,
463
+ } ;
464
+
439
465
let msg = match e {
440
466
CreatedPointerTag ( tag, None ) =>
441
467
format ! ( "created tag {tag:?}" ) ,
@@ -465,26 +491,23 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
465
491
format ! ( "freed allocation with id {id}" ) ,
466
492
RejectedIsolatedOp ( ref op) =>
467
493
format ! ( "{op} was made to return an error due to isolation" ) ,
468
- ProgressReport =>
494
+ ProgressReport { .. } =>
469
495
format ! ( "progress report: current operation being executed is here" ) ,
470
496
Int2Ptr { .. } =>
471
497
format ! ( "integer-to-pointer cast" ) ,
472
498
WeakMemoryOutdatedLoad =>
473
499
format ! ( "weak memory emulation: outdated value returned from load" ) ,
474
500
} ;
475
501
476
- let ( title, diag_level) = match e {
477
- RejectedIsolatedOp ( _) =>
478
- ( "operation rejected by isolation" , DiagLevel :: Warning ) ,
479
- Int2Ptr { .. } => ( "integer-to-pointer cast" , DiagLevel :: Warning ) ,
480
- CreatedPointerTag ( ..)
481
- | PoppedPointerTag ( ..)
482
- | CreatedCallId ( ..)
483
- | CreatedAlloc ( ..)
484
- | FreedAlloc ( ..)
485
- | ProgressReport
486
- | WeakMemoryOutdatedLoad =>
487
- ( "tracking was triggered" , DiagLevel :: Note ) ,
502
+ let notes = match e {
503
+ ProgressReport { block_count } => {
504
+ // It is important that each progress report is slightly different, since
505
+ // identical diagnostics are being deduplicated.
506
+ vec ! [
507
+ ( None , format!( "so far, {block_count} basic blocks have been executed" ) ) ,
508
+ ]
509
+ }
510
+ _ => vec ! [ ] ,
488
511
} ;
489
512
490
513
let helps = match e {
@@ -500,7 +523,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
500
523
_ => vec ! [ ] ,
501
524
} ;
502
525
503
- report_msg ( this, diag_level, title, vec ! [ msg] , helps, & stacktrace) ;
526
+ report_msg ( this, diag_level, title, vec ! [ msg] , notes , helps, & stacktrace) ;
504
527
}
505
528
} ) ;
506
529
}
@@ -519,6 +542,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
519
542
"the place in the program where the ICE was triggered" ,
520
543
vec ! [ ] ,
521
544
vec ! [ ] ,
545
+ vec ! [ ] ,
522
546
& stacktrace,
523
547
) ;
524
548
}
0 commit comments