Skip to content

Commit 0b127d8

Browse files
authored
Rollup merge of #122194 - oli-obk:stash_delay_bug, r=nnethercote
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
2 parents 60f4b7a + cfbc1b9 commit 0b127d8

File tree

1 file changed

+4
-7
lines changed
  • compiler/rustc_errors/src

1 file changed

+4
-7
lines changed

compiler/rustc_errors/src/lib.rs

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

0 commit comments

Comments
 (0)