diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-03-08 13:19:35 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-03-11 08:46:58 +0000 |
| commit | cfbc1b96d5ea70b8f6dea8fa86450d40c72c7036 (patch) | |
| tree | 26845a242d1f822140b9735f6a8218e90760de19 /compiler/rustc_errors | |
| parent | 1b2c53a15dba7962cfc284c3b6d61a0341ffa27a (diff) | |
| download | rust-cfbc1b96d5ea70b8f6dea8fa86450d40c72c7036.tar.gz rust-cfbc1b96d5ea70b8f6dea8fa86450d40c72c7036.zip | |
Enable creating backtraces via -Ztreat-err-as-bug when stashing errors
Diffstat (limited to 'compiler/rustc_errors')
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 76b44f73f47..be1caa0aa1b 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -768,13 +768,10 @@ impl DiagCtxt { format!("invalid level in `stash_diagnostic`: {:?}", diag.level), ); } - Error => { - // This `unchecked_error_guaranteed` is valid. It is where the - // `ErrorGuaranteed` for stashed errors originates. See - // `DiagCtxtInner::drop`. - #[allow(deprecated)] - Some(ErrorGuaranteed::unchecked_error_guaranteed()) - } + // We delay a bug here so that `-Ztreat-err-as-bug -Zeagerly-emit-delayed-bugs` + // can be used to create a backtrace at the stashing site insted of whenever the + // diagnostic context is dropped and thus delayed bugs are emitted. + Error => Some(self.span_delayed_bug(span, "stashing {key:?}")), DelayedBug => return self.inner.borrow_mut().emit_diagnostic(diag), ForceWarning(_) | Warning | Note | OnceNote | Help | OnceHelp | FailureNote | Allow | Expect(_) => None, |
