about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-02-13 13:14:41 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-03-01 13:34:31 +1100
commitc81767e7cb06dacc7bb9a5ec0b746b0c774e0aa1 (patch)
tree8a8e9eb082b8898a5e4925fe1358a4633b72812d /compiler/rustc_errors/src
parent272e60bd3ef5ea2424b70b0f4ec821f38fa3dc79 (diff)
downloadrust-c81767e7cb06dacc7bb9a5ec0b746b0c774e0aa1.tar.gz
rust-c81767e7cb06dacc7bb9a5ec0b746b0c774e0aa1.zip
Reorder `has_future_breakage` handling.
This will enable additional refactorings.
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/lib.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs
index 2280d3a2417..e0735208709 100644
--- a/compiler/rustc_errors/src/lib.rs
+++ b/compiler/rustc_errors/src/lib.rs
@@ -1356,6 +1356,14 @@ impl DiagCtxtInner {
     fn emit_diagnostic(&mut self, mut diagnostic: DiagInner) -> Option<ErrorGuaranteed> {
         assert!(diagnostic.level.can_be_top_or_sub().0);
 
+        if diagnostic.has_future_breakage() {
+            // Future breakages aren't emitted if they're Level::Allow,
+            // but they still need to be constructed and stashed below,
+            // so they'll trigger the must_produce_diag check.
+            self.suppressed_expected_diag = true;
+            self.future_breakage_diagnostics.push(diagnostic.clone());
+        }
+
         if let Expect(expect_id) | ForceWarning(Some(expect_id)) = diagnostic.level {
             // The `LintExpectationId` can be stable or unstable depending on when it was created.
             // Diagnostics created before the definition of `HirId`s are unstable and can not yet
@@ -1369,14 +1377,6 @@ impl DiagCtxtInner {
             self.fulfilled_expectations.insert(expect_id.normalize());
         }
 
-        if diagnostic.has_future_breakage() {
-            // Future breakages aren't emitted if they're Level::Allow,
-            // but they still need to be constructed and stashed below,
-            // so they'll trigger the must_produce_diag check.
-            self.suppressed_expected_diag = true;
-            self.future_breakage_diagnostics.push(diagnostic.clone());
-        }
-
         match diagnostic.level {
             Fatal | Error if self.treat_next_err_as_bug() => {
                 // `Fatal` and `Error` can be promoted to `Bug`.