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 {
992
992
msg : impl Into < DiagnosticMessage > ,
993
993
) -> ErrorGuaranteed {
994
994
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 ( ) {
1002
996
// FIXME: don't abort here if report_delayed_bugs is off
1003
997
inner. span_bug ( sp, msg) ;
1004
998
}
@@ -1519,6 +1513,13 @@ impl DiagCtxtInner {
1519
1513
} )
1520
1514
}
1521
1515
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
+
1522
1523
fn delayed_bug_count ( & self ) -> usize {
1523
1524
self . span_delayed_bugs . len ( ) + self . good_path_delayed_bugs . len ( )
1524
1525
}
You can’t perform that action at this time.
0 commit comments