@@ -1311,19 +1311,6 @@ impl DiagCtxtInner {
1311
1311
self . future_breakage_diagnostics . push ( diagnostic. clone ( ) ) ;
1312
1312
}
1313
1313
1314
- if let Expect ( expect_id) | ForceWarning ( Some ( expect_id) ) = diagnostic. level {
1315
- // The `LintExpectationId` can be stable or unstable depending on when it was created.
1316
- // Diagnostics created before the definition of `HirId`s are unstable and can not yet
1317
- // be stored. Instead, they are buffered until the `LintExpectationId` is replaced by
1318
- // a stable one by the `LintLevelsBuilder`.
1319
- if let LintExpectationId :: Unstable { .. } = expect_id {
1320
- self . unstable_expect_diagnostics . push ( diagnostic) ;
1321
- return None ;
1322
- }
1323
- self . suppressed_expected_diag = true ;
1324
- self . fulfilled_expectations . insert ( expect_id. normalize ( ) ) ;
1325
- }
1326
-
1327
1314
match diagnostic. level {
1328
1315
Fatal | Error if self . treat_next_err_as_bug ( ) => {
1329
1316
// `Fatal` and `Error` can be promoted to `Bug`.
@@ -1364,10 +1351,25 @@ impl DiagCtxtInner {
1364
1351
}
1365
1352
return None ;
1366
1353
}
1367
- Allow | Expect ( _) => {
1368
- TRACK_DIAGNOSTIC ( diagnostic, & mut |_| None ) ;
1354
+ Allow => {
1369
1355
return None ;
1370
1356
}
1357
+ Expect ( expect_id) | ForceWarning ( Some ( expect_id) ) => {
1358
+ // Diagnostics created before the definition of `HirId`s are
1359
+ // unstable and can not yet be stored. Instead, they are
1360
+ // buffered until the `LintExpectationId` is replaced by a
1361
+ // stable one by the `LintLevelsBuilder`.
1362
+ if let LintExpectationId :: Unstable { .. } = expect_id {
1363
+ self . unstable_expect_diagnostics . push ( diagnostic) ;
1364
+ return None ;
1365
+ }
1366
+ self . fulfilled_expectations . insert ( expect_id. normalize ( ) ) ;
1367
+ if let Expect ( _) = diagnostic. level {
1368
+ TRACK_DIAGNOSTIC ( diagnostic, & mut |_| None ) ;
1369
+ self . suppressed_expected_diag = true ;
1370
+ return None ;
1371
+ }
1372
+ }
1371
1373
_ => { }
1372
1374
}
1373
1375
0 commit comments