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