Skip to content

Commit

Permalink
Rollup merge of #122194 - oli-obk:stash_delay_bug, r=nnethercote
Browse files Browse the repository at this point in the history
Enable creating backtraces via -Ztreat-err-as-bug when stashing errors

r? `@nnethercote`

Otherwise I can't debug stashed errors because I can't find their source
  • Loading branch information
matthiaskrgr committed Mar 12, 2024
2 parents 60f4b7a + cfbc1b9 commit 0b127d8
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -769,13 +769,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,
Expand Down

0 comments on commit 0b127d8

Please sign in to comment.