@@ -410,9 +410,10 @@ struct HandlerInner {
410410 deduplicated_err_count : usize ,
411411 emitter : Box < dyn Emitter + sync:: Send > ,
412412 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 > ,
414415 /// 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.
416417 suppressed_expected_diag : bool ,
417418
418419 /// This set contains the `DiagnosticId` of all emitted diagnostics to avoid
@@ -520,16 +521,14 @@ impl Drop for HandlerInner {
520521 self . flush_delayed ( bugs, "no errors encountered even though `delay_span_bug` issued" ) ;
521522 }
522523
523- // FIXME(eddyb) this explains what `delayed_good_path_bugs` are!
524524 // They're `delayed_span_bugs` but for "require some diagnostic happened"
525525 // instead of "require some error happened". Sadly that isn't ideal, as
526526 // lints can be `#[allow]`'d, potentially leading to this triggering.
527- // Also, "good path" should be replaced with a better naming.
528527 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 ( ) ) ;
530529 self . flush_delayed (
531530 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" ,
533532 ) ;
534533 }
535534
@@ -608,7 +607,7 @@ impl Handler {
608607 deduplicated_warn_count : 0 ,
609608 emitter,
610609 delayed_span_bugs : Vec :: new ( ) ,
611- delayed_good_path_bugs : Vec :: new ( ) ,
610+ delayed_expect_diagnostic_bugs : Vec :: new ( ) ,
612611 suppressed_expected_diag : false ,
613612 taught_diagnostics : Default :: default ( ) ,
614613 emitted_diagnostic_codes : Default :: default ( ) ,
@@ -662,7 +661,7 @@ impl Handler {
662661
663662 // actually free the underlying memory (which `clear` would not do)
664663 inner. delayed_span_bugs = Default :: default ( ) ;
665- inner. delayed_good_path_bugs = Default :: default ( ) ;
664+ inner. delayed_expect_diagnostic_bugs = Default :: default ( ) ;
666665 inner. taught_diagnostics = Default :: default ( ) ;
667666 inner. emitted_diagnostic_codes = Default :: default ( ) ;
668667 inner. emitted_diagnostics = Default :: default ( ) ;
@@ -1005,10 +1004,9 @@ impl Handler {
10051004 self . inner . borrow_mut ( ) . delay_span_bug ( span, msg)
10061005 }
10071006
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)
10121010 }
10131011
10141012 #[ track_caller]
@@ -1436,7 +1434,7 @@ impl HandlerInner {
14361434 }
14371435
14381436 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 ( )
14401438 }
14411439
14421440 fn print_error_count ( & mut self , registry : & Registry ) {
@@ -1609,15 +1607,15 @@ impl HandlerInner {
16091607 self . emit_diagnostic ( & mut diagnostic) . unwrap ( )
16101608 }
16111609
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 > ) {
16151612 let mut diagnostic = Diagnostic :: new ( Level :: DelayedBug , msg) ;
16161613 if self . flags . report_delayed_bugs {
16171614 self . emit_diagnostic ( & mut diagnostic) ;
16181615 }
16191616 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) ) ;
16211619 }
16221620
16231621 fn failure ( & mut self , msg : impl Into < DiagnosticMessage > ) {
0 commit comments