Reinstate emit_stashed_diagnostics
in DiagCtxtInner::drop
.
I removed it in #121206 because I thought thought it wasn't necessary. But then I had to add an `emit_stashed_diagnostics` call elsewhere in rustfmt to avoid the assertion failure (which took two attempts to get right, #121487 and #121615), and now there's an assertion failure in clippy as well (https://github.com/rust-lang/rust-clippy/issues/12364). So this commit just reinstates the call in `DiagCtxtInner::drop`. It also reverts the rustfmt changes from #121487 and #121615, though it keeps the tests added for those PRs.
This commit is contained in:
parent
9aff357e53
commit
82961c0abc
3 changed files with 13 additions and 26 deletions
|
@ -555,12 +555,14 @@ pub struct DiagCtxtFlags {
|
|||
|
||||
impl Drop for DiagCtxtInner {
|
||||
fn drop(&mut self) {
|
||||
// Any stashed diagnostics should have been handled by
|
||||
// `emit_stashed_diagnostics` by now.
|
||||
// For tools using `interface::run_compiler` (e.g. rustc, rustdoc)
|
||||
// stashed diagnostics will have already been emitted. But for others
|
||||
// that don't use `interface::run_compiler` (e.g. rustfmt, some clippy
|
||||
// lints) this fallback is necessary.
|
||||
//
|
||||
// Important: it is sound to produce an `ErrorGuaranteed` when stashing
|
||||
// errors because they are guaranteed to have been emitted by here.
|
||||
assert!(self.stashed_diagnostics.is_empty());
|
||||
// errors because they are guaranteed to be emitted here or earlier.
|
||||
self.emit_stashed_diagnostics();
|
||||
|
||||
// Important: it is sound to produce an `ErrorGuaranteed` when emitting
|
||||
// delayed bugs because they are guaranteed to be emitted here if
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue