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 @@ -979,13 +979,7 @@ impl DiagCtxt {
979
979
msg : impl Into < DiagnosticMessage > ,
980
980
) -> ErrorGuaranteed {
981
981
let mut inner = self . inner . borrow_mut ( ) ;
982
-
983
- // This is technically `self.treat_err_as_bug()` but `span_delayed_bug` is called before
984
- // incrementing `err_count` by one, so we need to +1 the comparing.
985
- // FIXME: Would be nice to increment err_count in a more coherent way.
986
- if inner. flags . treat_err_as_bug . is_some_and ( |c| {
987
- inner. err_count + inner. lint_err_count + inner. delayed_bug_count ( ) + 1 >= c. get ( )
988
- } ) {
982
+ if inner. treat_next_err_as_bug ( ) {
989
983
// FIXME: don't abort here if report_delayed_bugs is off
990
984
inner. span_bug ( sp, msg) ;
991
985
}
@@ -1506,6 +1500,13 @@ impl DiagCtxtInner {
1506
1500
} )
1507
1501
}
1508
1502
1503
+ // Use this one before incrementing `err_count`.
1504
+ fn treat_next_err_as_bug ( & self ) -> bool {
1505
+ self . flags . treat_err_as_bug . is_some_and ( |c| {
1506
+ self . err_count + self . lint_err_count + self . delayed_bug_count ( ) + 1 >= c. get ( )
1507
+ } )
1508
+ }
1509
+
1509
1510
fn delayed_bug_count ( & self ) -> usize {
1510
1511
self . span_delayed_bugs . len ( ) + self . good_path_delayed_bugs . len ( )
1511
1512
}
You can’t perform that action at this time.
0 commit comments