about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-01-31 13:56:22 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-02-05 08:16:30 +1100
commit5dd0431386867a051f726cbba6e0f46f7bba5e5d (patch)
tree62781f51d5ce67c189463790f45f1db339b3681f
parente8c3cbf44b9f003482871e8638859c8f65b234bb (diff)
downloadrust-5dd0431386867a051f726cbba6e0f46f7bba5e5d.tar.gz
rust-5dd0431386867a051f726cbba6e0f46f7bba5e5d.zip
Tighten the assertion in `downgrade_to_delayed_bug`.
I.e. `Bug` and `Fatal` level diagnostics are never downgraded.
-rw-r--r--compiler/rustc_errors/src/diagnostic.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index 09570fe74b6..299e4a840f7 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -306,7 +306,7 @@ impl Diagnostic {
     #[track_caller]
     pub fn downgrade_to_delayed_bug(&mut self) {
         assert!(
-            self.is_error(),
+            matches!(self.level, Level::Error | Level::DelayedBug(_)),
             "downgrade_to_delayed_bug: cannot downgrade {:?} to DelayedBug: not an error",
             self.level
         );