@@ -1356,6 +1356,14 @@ impl DiagCtxtInner {
1356
1356
fn emit_diagnostic ( & mut self , mut diagnostic : DiagInner ) -> Option < ErrorGuaranteed > {
1357
1357
assert ! ( diagnostic. level. can_be_top_or_sub( ) . 0 ) ;
1358
1358
1359
+ if diagnostic. has_future_breakage ( ) {
1360
+ // Future breakages aren't emitted if they're Level::Allow,
1361
+ // but they still need to be constructed and stashed below,
1362
+ // so they'll trigger the must_produce_diag check.
1363
+ self . suppressed_expected_diag = true ;
1364
+ self . future_breakage_diagnostics . push ( diagnostic. clone ( ) ) ;
1365
+ }
1366
+
1359
1367
if let Expect ( expect_id) | ForceWarning ( Some ( expect_id) ) = diagnostic. level {
1360
1368
// The `LintExpectationId` can be stable or unstable depending on when it was created.
1361
1369
// Diagnostics created before the definition of `HirId`s are unstable and can not yet
@@ -1369,14 +1377,6 @@ impl DiagCtxtInner {
1369
1377
self . fulfilled_expectations . insert ( expect_id. normalize ( ) ) ;
1370
1378
}
1371
1379
1372
- if diagnostic. has_future_breakage ( ) {
1373
- // Future breakages aren't emitted if they're Level::Allow,
1374
- // but they still need to be constructed and stashed below,
1375
- // so they'll trigger the must_produce_diag check.
1376
- self . suppressed_expected_diag = true ;
1377
- self . future_breakage_diagnostics . push ( diagnostic. clone ( ) ) ;
1378
- }
1379
-
1380
1380
match diagnostic. level {
1381
1381
Fatal | Error if self . treat_next_err_as_bug ( ) => {
1382
1382
// `Fatal` and `Error` can be promoted to `Bug`.
0 commit comments