Enable creating backtraces via -Ztreat-err-as-bug when stashing errors

This commit is contained in:
Oli Scherer 2024-03-08 13:19:35 +00:00
parent 1b2c53a15d
commit cfbc1b96d5

View File

@ -768,13 +768,10 @@ impl DiagCtxt {
format!("invalid level in `stash_diagnostic`: {:?}", diag.level), format!("invalid level in `stash_diagnostic`: {:?}", diag.level),
); );
} }
Error => { // We delay a bug here so that `-Ztreat-err-as-bug -Zeagerly-emit-delayed-bugs`
// This `unchecked_error_guaranteed` is valid. It is where the // can be used to create a backtrace at the stashing site insted of whenever the
// `ErrorGuaranteed` for stashed errors originates. See // diagnostic context is dropped and thus delayed bugs are emitted.
// `DiagCtxtInner::drop`. Error => Some(self.span_delayed_bug(span, "stashing {key:?}")),
#[allow(deprecated)]
Some(ErrorGuaranteed::unchecked_error_guaranteed())
}
DelayedBug => return self.inner.borrow_mut().emit_diagnostic(diag), DelayedBug => return self.inner.borrow_mut().emit_diagnostic(diag),
ForceWarning(_) | Warning | Note | OnceNote | Help | OnceHelp | FailureNote | Allow ForceWarning(_) | Warning | Note | OnceNote | Help | OnceHelp | FailureNote | Allow
| Expect(_) => None, | Expect(_) => None,