@@ -1300,6 +1300,14 @@ impl DiagCtxtInner {
13001300 fn emit_diagnostic ( & mut self , mut diagnostic : Diagnostic ) -> Option < ErrorGuaranteed > {
13011301 assert ! ( diagnostic. level. can_be_top_or_sub( ) . 0 ) ;
13021302
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+
13031311 if let Expect ( expect_id) | ForceWarning ( Some ( expect_id) ) = diagnostic. level {
13041312 // The `LintExpectationId` can be stable or unstable depending on when it was created.
13051313 // Diagnostics created before the definition of `HirId`s are unstable and can not yet
@@ -1313,14 +1321,6 @@ impl DiagCtxtInner {
13131321 self . fulfilled_expectations . insert ( expect_id. normalize ( ) ) ;
13141322 }
13151323
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-
13241324 match diagnostic. level {
13251325 Fatal | Error if self . treat_next_err_as_bug ( ) => {
13261326 // `Fatal` and `Error` can be promoted to `Bug`.
0 commit comments