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