@@ -1364,19 +1364,6 @@ impl DiagCtxtInner {
1364
1364
self . future_breakage_diagnostics . push ( diagnostic. clone ( ) ) ;
1365
1365
}
1366
1366
1367
- if let Expect ( expect_id) | ForceWarning ( Some ( expect_id) ) = diagnostic. level {
1368
- // The `LintExpectationId` can be stable or unstable depending on when it was created.
1369
- // Diagnostics created before the definition of `HirId`s are unstable and can not yet
1370
- // be stored. Instead, they are buffered until the `LintExpectationId` is replaced by
1371
- // a stable one by the `LintLevelsBuilder`.
1372
- if let LintExpectationId :: Unstable { .. } = expect_id {
1373
- self . unstable_expect_diagnostics . push ( diagnostic) ;
1374
- return None ;
1375
- }
1376
- self . suppressed_expected_diag = true ;
1377
- self . fulfilled_expectations . insert ( expect_id. normalize ( ) ) ;
1378
- }
1379
-
1380
1367
match diagnostic. level {
1381
1368
Fatal | Error if self . treat_next_err_as_bug ( ) => {
1382
1369
// `Fatal` and `Error` can be promoted to `Bug`.
@@ -1418,10 +1405,25 @@ impl DiagCtxtInner {
1418
1405
}
1419
1406
return None ;
1420
1407
}
1421
- Allow | Expect ( _) => {
1422
- TRACK_DIAGNOSTIC ( diagnostic, & mut |_| None ) ;
1408
+ Allow => {
1423
1409
return None ;
1424
1410
}
1411
+ Expect ( expect_id) | ForceWarning ( Some ( expect_id) ) => {
1412
+ // Diagnostics created before the definition of `HirId`s are
1413
+ // unstable and can not yet be stored. Instead, they are
1414
+ // buffered until the `LintExpectationId` is replaced by a
1415
+ // stable one by the `LintLevelsBuilder`.
1416
+ if let LintExpectationId :: Unstable { .. } = expect_id {
1417
+ self . unstable_expect_diagnostics . push ( diagnostic) ;
1418
+ return None ;
1419
+ }
1420
+ self . fulfilled_expectations . insert ( expect_id. normalize ( ) ) ;
1421
+ if let Expect ( _) = diagnostic. level {
1422
+ TRACK_DIAGNOSTIC ( diagnostic, & mut |_| None ) ;
1423
+ self . suppressed_expected_diag = true ;
1424
+ return None ;
1425
+ }
1426
+ }
1425
1427
_ => { }
1426
1428
}
1427
1429
0 commit comments