@@ -1303,6 +1303,14 @@ impl DiagCtxtInner {
1303
1303
fn emit_diagnostic ( & mut self , mut diagnostic : Diagnostic ) -> Option < ErrorGuaranteed > {
1304
1304
assert ! ( diagnostic. level. can_be_top_or_sub( ) . 0 ) ;
1305
1305
1306
+ if diagnostic. has_future_breakage ( ) {
1307
+ // Future breakages aren't emitted if they're Level::Allow,
1308
+ // but they still need to be constructed and stashed below,
1309
+ // so they'll trigger the must_produce_diag check.
1310
+ self . suppressed_expected_diag = true ;
1311
+ self . future_breakage_diagnostics . push ( diagnostic. clone ( ) ) ;
1312
+ }
1313
+
1306
1314
if let Expect ( expect_id) | ForceWarning ( Some ( expect_id) ) = diagnostic. level {
1307
1315
// The `LintExpectationId` can be stable or unstable depending on when it was created.
1308
1316
// Diagnostics created before the definition of `HirId`s are unstable and can not yet
@@ -1316,14 +1324,6 @@ impl DiagCtxtInner {
1316
1324
self . fulfilled_expectations . insert ( expect_id. normalize ( ) ) ;
1317
1325
}
1318
1326
1319
- if diagnostic. has_future_breakage ( ) {
1320
- // Future breakages aren't emitted if they're Level::Allow,
1321
- // but they still need to be constructed and stashed below,
1322
- // so they'll trigger the must_produce_diag check.
1323
- self . suppressed_expected_diag = true ;
1324
- self . future_breakage_diagnostics . push ( diagnostic. clone ( ) ) ;
1325
- }
1326
-
1327
1327
match diagnostic. level {
1328
1328
Fatal | Error if self . treat_next_err_as_bug ( ) => {
1329
1329
// `Fatal` and `Error` can be promoted to `Bug`.
0 commit comments