File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
compiler/rustc_errors/src Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -992,13 +992,7 @@ impl DiagCtxt {
992992 msg : impl Into < DiagnosticMessage > ,
993993 ) -> ErrorGuaranteed {
994994 let mut inner = self . inner . borrow_mut ( ) ;
995-
996- // This is technically `self.treat_err_as_bug()` but `span_delayed_bug` is called before
997- // incrementing `err_count` by one, so we need to +1 the comparing.
998- // FIXME: Would be nice to increment err_count in a more coherent way.
999- if inner. flags . treat_err_as_bug . is_some_and ( |c| {
1000- inner. err_count + inner. lint_err_count + inner. delayed_bug_count ( ) + 1 >= c. get ( )
1001- } ) {
995+ if inner. treat_next_err_as_bug ( ) {
1002996 // FIXME: don't abort here if report_delayed_bugs is off
1003997 inner. span_bug ( sp, msg) ;
1004998 }
@@ -1519,6 +1513,13 @@ impl DiagCtxtInner {
15191513 } )
15201514 }
15211515
1516+ // Use this one before incrementing `err_count`.
1517+ fn treat_next_err_as_bug ( & self ) -> bool {
1518+ self . flags . treat_err_as_bug . is_some_and ( |c| {
1519+ self . err_count + self . lint_err_count + self . delayed_bug_count ( ) + 1 >= c. get ( )
1520+ } )
1521+ }
1522+
15221523 fn delayed_bug_count ( & self ) -> usize {
15231524 self . span_delayed_bugs . len ( ) + self . good_path_delayed_bugs . len ( )
15241525 }
You can’t perform that action at this time.
0 commit comments