Tighten the assertion in downgrade_to_delayed_bug.

I.e. `Bug` and `Fatal` level diagnostics are never downgraded.
This commit is contained in:
Nicholas Nethercote 2024-01-31 13:56:22 +11:00
parent e8c3cbf44b
commit 5dd0431386

View file

@ -306,7 +306,7 @@ pub(crate) fn is_force_warn(&self) -> bool {
#[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
);