@@ -527,6 +527,9 @@ pub struct DiagCtxtFlags {
527
527
/// If Some, the Nth error-level diagnostic is upgraded to bug-level.
528
528
/// (rustc: see `-Z treat-err-as-bug`)
529
529
pub treat_err_as_bug : Option < NonZeroUsize > ,
530
+ /// Eagerly emit delayed bugs as errors, so that the compiler debugger may
531
+ /// see all of the errors being emitted at once.
532
+ pub eagerly_emit_delayed_bugs : bool ,
530
533
/// Show macro backtraces.
531
534
/// (rustc: see `-Z macro-backtrace`)
532
535
pub macro_backtrace : bool ,
@@ -1269,16 +1272,21 @@ impl DiagCtxtInner {
1269
1272
}
1270
1273
1271
1274
if diagnostic. level == DelayedBug {
1272
- // FIXME(eddyb) this should check for `has_errors` and stop pushing
1273
- // once *any* errors were emitted (and truncate `span_delayed_bugs`
1274
- // when an error is first emitted, also), but maybe there's a case
1275
- // in which that's not sound? otherwise this is really inefficient.
1276
- let backtrace = std:: backtrace:: Backtrace :: capture ( ) ;
1277
- self . span_delayed_bugs
1278
- . push ( DelayedDiagnostic :: with_backtrace ( diagnostic. clone ( ) , backtrace) ) ;
1275
+ if self . flags . eagerly_emit_delayed_bugs {
1276
+ // Emit error as bug, rather than stashing it.
1277
+ diagnostic. level = Error ;
1278
+ } else {
1279
+ // FIXME(eddyb) this should check for `has_errors` and stop pushing
1280
+ // once *any* errors were emitted (and truncate `span_delayed_bugs`
1281
+ // when an error is first emitted, also), but maybe there's a case
1282
+ // in which that's not sound? otherwise this is really inefficient.
1283
+ let backtrace = std:: backtrace:: Backtrace :: capture ( ) ;
1284
+ self . span_delayed_bugs
1285
+ . push ( DelayedDiagnostic :: with_backtrace ( diagnostic. clone ( ) , backtrace) ) ;
1279
1286
1280
- #[ allow( deprecated) ]
1281
- return Some ( ErrorGuaranteed :: unchecked_claim_error_was_emitted ( ) ) ;
1287
+ #[ allow( deprecated) ]
1288
+ return Some ( ErrorGuaranteed :: unchecked_claim_error_was_emitted ( ) ) ;
1289
+ }
1282
1290
}
1283
1291
1284
1292
if diagnostic. has_future_breakage ( ) {
0 commit comments