Skip to content

Commit b693146

Browse files
committed
Reorder has_future_breakage handling.
This will enable additional refactorings.
1 parent bb9c204 commit b693146

File tree

1 file changed

+8
-8
lines changed
  • compiler/rustc_errors/src

1 file changed

+8
-8
lines changed

compiler/rustc_errors/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,6 +1303,14 @@ impl DiagCtxtInner {
13031303
fn emit_diagnostic(&mut self, mut diagnostic: Diagnostic) -> Option<ErrorGuaranteed> {
13041304
assert!(diagnostic.level.can_be_top_or_sub().0);
13051305

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+
13061314
if let Expect(expect_id) | ForceWarning(Some(expect_id)) = diagnostic.level {
13071315
// The `LintExpectationId` can be stable or unstable depending on when it was created.
13081316
// Diagnostics created before the definition of `HirId`s are unstable and can not yet
@@ -1316,14 +1324,6 @@ impl DiagCtxtInner {
13161324
self.fulfilled_expectations.insert(expect_id.normalize());
13171325
}
13181326

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-
13271327
match diagnostic.level {
13281328
Fatal | Error if self.treat_next_err_as_bug() => {
13291329
// `Fatal` and `Error` can be promoted to `Bug`.

0 commit comments

Comments
 (0)