@@ -410,9 +410,10 @@ struct HandlerInner {
410
410
deduplicated_err_count : usize ,
411
411
emitter : Box < dyn Emitter + sync:: Send > ,
412
412
delayed_span_bugs : Vec < DelayedDiagnostic > ,
413
- delayed_good_path_bugs : Vec < DelayedDiagnostic > ,
413
+ /// Bugs that are delayed unless a diagnostic (warn/lint/error) is emitted.
414
+ delayed_expect_diagnostic_bugs : Vec < DelayedDiagnostic > ,
414
415
/// This flag indicates that an expected diagnostic was emitted and suppressed.
415
- /// This is used for the `delayed_good_path_bugs ` check.
416
+ /// This is used for the `delayed_bugs_unless_diagnostic_emitted ` check.
416
417
suppressed_expected_diag : bool ,
417
418
418
419
/// This set contains the `DiagnosticId` of all emitted diagnostics to avoid
@@ -520,16 +521,14 @@ impl Drop for HandlerInner {
520
521
self . flush_delayed ( bugs, "no errors encountered even though `delay_span_bug` issued" ) ;
521
522
}
522
523
523
- // FIXME(eddyb) this explains what `delayed_good_path_bugs` are!
524
524
// They're `delayed_span_bugs` but for "require some diagnostic happened"
525
525
// instead of "require some error happened". Sadly that isn't ideal, as
526
526
// lints can be `#[allow]`'d, potentially leading to this triggering.
527
- // Also, "good path" should be replaced with a better naming.
528
527
if !self . has_any_message ( ) && !self . suppressed_expected_diag {
529
- let bugs = std:: mem:: replace ( & mut self . delayed_good_path_bugs , Vec :: new ( ) ) ;
528
+ let bugs = std:: mem:: replace ( & mut self . delayed_expect_diagnostic_bugs , Vec :: new ( ) ) ;
530
529
self . flush_delayed (
531
530
bugs,
532
- "no warnings or errors encountered even though `delayed_good_path_bugs ` issued" ,
531
+ "no warnings or errors encountered even though `delayed_bugs_unless_diagnostic_emitted ` issued" ,
533
532
) ;
534
533
}
535
534
@@ -608,7 +607,7 @@ impl Handler {
608
607
deduplicated_warn_count : 0 ,
609
608
emitter,
610
609
delayed_span_bugs : Vec :: new ( ) ,
611
- delayed_good_path_bugs : Vec :: new ( ) ,
610
+ delayed_expect_diagnostic_bugs : Vec :: new ( ) ,
612
611
suppressed_expected_diag : false ,
613
612
taught_diagnostics : Default :: default ( ) ,
614
613
emitted_diagnostic_codes : Default :: default ( ) ,
@@ -662,7 +661,7 @@ impl Handler {
662
661
663
662
// actually free the underlying memory (which `clear` would not do)
664
663
inner. delayed_span_bugs = Default :: default ( ) ;
665
- inner. delayed_good_path_bugs = Default :: default ( ) ;
664
+ inner. delayed_expect_diagnostic_bugs = Default :: default ( ) ;
666
665
inner. taught_diagnostics = Default :: default ( ) ;
667
666
inner. emitted_diagnostic_codes = Default :: default ( ) ;
668
667
inner. emitted_diagnostics = Default :: default ( ) ;
@@ -1005,10 +1004,9 @@ impl Handler {
1005
1004
self . inner . borrow_mut ( ) . delay_span_bug ( span, msg)
1006
1005
}
1007
1006
1008
- // FIXME(eddyb) note the comment inside `impl Drop for HandlerInner`, that's
1009
- // where the explanation of what "good path" is (also, it should be renamed).
1010
- pub fn delay_good_path_bug ( & self , msg : impl Into < DiagnosticMessage > ) {
1011
- self . inner . borrow_mut ( ) . delay_good_path_bug ( msg)
1007
+ // FIXME(eddyb) note the comment inside `impl Drop for HandlerInner`.
1008
+ pub fn delay_bug_unless_diagnostic_emitted ( & self , msg : impl Into < DiagnosticMessage > ) {
1009
+ self . inner . borrow_mut ( ) . delay_bug_unless_diagnostic_emitted ( msg)
1012
1010
}
1013
1011
1014
1012
#[ track_caller]
@@ -1436,7 +1434,7 @@ impl HandlerInner {
1436
1434
}
1437
1435
1438
1436
fn delayed_bug_count ( & self ) -> usize {
1439
- self . delayed_span_bugs . len ( ) + self . delayed_good_path_bugs . len ( )
1437
+ self . delayed_span_bugs . len ( ) + self . delayed_expect_diagnostic_bugs . len ( )
1440
1438
}
1441
1439
1442
1440
fn print_error_count ( & mut self , registry : & Registry ) {
@@ -1609,15 +1607,15 @@ impl HandlerInner {
1609
1607
self . emit_diagnostic ( & mut diagnostic) . unwrap ( )
1610
1608
}
1611
1609
1612
- // FIXME(eddyb) note the comment inside `impl Drop for HandlerInner`, that's
1613
- // where the explanation of what "good path" is (also, it should be renamed).
1614
- fn delay_good_path_bug ( & mut self , msg : impl Into < DiagnosticMessage > ) {
1610
+ // FIXME(eddyb) note the comment inside `impl Drop for HandlerInner`.
1611
+ fn delay_bug_unless_diagnostic_emitted ( & mut self , msg : impl Into < DiagnosticMessage > ) {
1615
1612
let mut diagnostic = Diagnostic :: new ( Level :: DelayedBug , msg) ;
1616
1613
if self . flags . report_delayed_bugs {
1617
1614
self . emit_diagnostic ( & mut diagnostic) ;
1618
1615
}
1619
1616
let backtrace = std:: backtrace:: Backtrace :: force_capture ( ) ;
1620
- self . delayed_good_path_bugs . push ( DelayedDiagnostic :: with_backtrace ( diagnostic, backtrace) ) ;
1617
+ self . delayed_expect_diagnostic_bugs
1618
+ . push ( DelayedDiagnostic :: with_backtrace ( diagnostic, backtrace) ) ;
1621
1619
}
1622
1620
1623
1621
fn failure ( & mut self , msg : impl Into < DiagnosticMessage > ) {
0 commit comments