@@ -931,6 +931,7 @@ impl DiagCtxt {
931931 /// This excludes lint errors and delayed bugs.
932932 pub fn has_errors ( & self ) -> Option < ErrorGuaranteed > {
933933 self . inner . borrow ( ) . has_errors ( ) . then ( || {
934+ // FIXME(nnethercote) find a way to store an `ErrorGuaranteed`.
934935 #[ allow( deprecated) ]
935936 ErrorGuaranteed :: unchecked_claim_error_was_emitted ( )
936937 } )
@@ -942,6 +943,7 @@ impl DiagCtxt {
942943 let inner = self . inner . borrow ( ) ;
943944 let result = inner. has_errors ( ) || inner. lint_err_count > 0 ;
944945 result. then ( || {
946+ // FIXME(nnethercote) find a way to store an `ErrorGuaranteed`.
945947 #[ allow( deprecated) ]
946948 ErrorGuaranteed :: unchecked_claim_error_was_emitted ( )
947949 } )
@@ -954,6 +956,7 @@ impl DiagCtxt {
954956 let result =
955957 inner. has_errors ( ) || inner. lint_err_count > 0 || !inner. delayed_bugs . is_empty ( ) ;
956958 result. then ( || {
959+ // FIXME(nnethercote) find a way to store an `ErrorGuaranteed`.
957960 #[ allow( deprecated) ]
958961 ErrorGuaranteed :: unchecked_claim_error_was_emitted ( )
959962 } )
@@ -1238,6 +1241,7 @@ impl DiagCtxtInner {
12381241 }
12391242 }
12401243
1244+ // Return value is only `Some` if the level is `Error` or `DelayedBug`.
12411245 fn emit_diagnostic ( & mut self , mut diagnostic : Diagnostic ) -> Option < ErrorGuaranteed > {
12421246 assert ! ( diagnostic. level. can_be_top_or_sub( ) . 0 ) ;
12431247
@@ -1316,6 +1320,7 @@ impl DiagCtxtInner {
13161320 !self . emitted_diagnostics . insert ( diagnostic_hash)
13171321 } ;
13181322
1323+ let level = diagnostic. level ;
13191324 let is_error = diagnostic. is_error ( ) ;
13201325 let is_lint = diagnostic. is_lint . is_some ( ) ;
13211326
@@ -1352,18 +1357,19 @@ impl DiagCtxtInner {
13521357
13531358 self . emitter . emit_diagnostic ( diagnostic) ;
13541359 }
1360+
13551361 if is_error {
13561362 if is_lint {
13571363 self . lint_err_count += 1 ;
13581364 } else {
13591365 self . err_count += 1 ;
13601366 }
13611367 self . panic_if_treat_err_as_bug ( ) ;
1368+ }
13621369
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 ( ) ) ;
13671373 }
13681374 } ) ;
13691375
0 commit comments