@@ -931,6 +931,7 @@ impl DiagCtxt {
931
931
/// This excludes lint errors and delayed bugs.
932
932
pub fn has_errors ( & self ) -> Option < ErrorGuaranteed > {
933
933
self . inner . borrow ( ) . has_errors ( ) . then ( || {
934
+ // FIXME(nnethercote) find a way to store an `ErrorGuaranteed`.
934
935
#[ allow( deprecated) ]
935
936
ErrorGuaranteed :: unchecked_claim_error_was_emitted ( )
936
937
} )
@@ -942,6 +943,7 @@ impl DiagCtxt {
942
943
let inner = self . inner . borrow ( ) ;
943
944
let result = inner. has_errors ( ) || inner. lint_err_count > 0 ;
944
945
result. then ( || {
946
+ // FIXME(nnethercote) find a way to store an `ErrorGuaranteed`.
945
947
#[ allow( deprecated) ]
946
948
ErrorGuaranteed :: unchecked_claim_error_was_emitted ( )
947
949
} )
@@ -954,6 +956,7 @@ impl DiagCtxt {
954
956
let result =
955
957
inner. has_errors ( ) || inner. lint_err_count > 0 || !inner. delayed_bugs . is_empty ( ) ;
956
958
result. then ( || {
959
+ // FIXME(nnethercote) find a way to store an `ErrorGuaranteed`.
957
960
#[ allow( deprecated) ]
958
961
ErrorGuaranteed :: unchecked_claim_error_was_emitted ( )
959
962
} )
@@ -1238,6 +1241,7 @@ impl DiagCtxtInner {
1238
1241
}
1239
1242
}
1240
1243
1244
+ // Return value is only `Some` if the level is `Error` or `DelayedBug`.
1241
1245
fn emit_diagnostic ( & mut self , mut diagnostic : Diagnostic ) -> Option < ErrorGuaranteed > {
1242
1246
assert ! ( diagnostic. level. can_be_top_or_sub( ) . 0 ) ;
1243
1247
@@ -1316,6 +1320,7 @@ impl DiagCtxtInner {
1316
1320
!self . emitted_diagnostics . insert ( diagnostic_hash)
1317
1321
} ;
1318
1322
1323
+ let level = diagnostic. level ;
1319
1324
let is_error = diagnostic. is_error ( ) ;
1320
1325
let is_lint = diagnostic. is_lint . is_some ( ) ;
1321
1326
@@ -1352,18 +1357,19 @@ impl DiagCtxtInner {
1352
1357
1353
1358
self . emitter . emit_diagnostic ( diagnostic) ;
1354
1359
}
1360
+
1355
1361
if is_error {
1356
1362
if is_lint {
1357
1363
self . lint_err_count += 1 ;
1358
1364
} else {
1359
1365
self . err_count += 1 ;
1360
1366
}
1361
1367
self . panic_if_treat_err_as_bug ( ) ;
1368
+ }
1362
1369
1363
- #[ allow( deprecated) ]
1364
- {
1365
- guaranteed = Some ( ErrorGuaranteed :: unchecked_claim_error_was_emitted ( ) ) ;
1366
- }
1370
+ #[ allow( deprecated) ]
1371
+ if level == Level :: Error {
1372
+ guaranteed = Some ( ErrorGuaranteed :: unchecked_claim_error_was_emitted ( ) ) ;
1367
1373
}
1368
1374
} ) ;
1369
1375
0 commit comments