diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2021-04-30 23:57:02 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-12-25 18:48:30 +0000 |
| commit | 66e0316414072908e23d65edb8ae3f8bcdcf5bac (patch) | |
| tree | a53cedf0d6b76d7f39811acb6f53a0eb6ba9ef68 /compiler/rustc_errors/src | |
| parent | 44972b2ce7bff10ca9277212eedf23b15bbe0eb2 (diff) | |
| download | rust-66e0316414072908e23d65edb8ae3f8bcdcf5bac.tar.gz rust-66e0316414072908e23d65edb8ae3f8bcdcf5bac.zip | |
Use absolute spans when trying to steal an AST diagnostic.
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 518b5ec10f8..292ea64ee7b 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -653,17 +653,19 @@ impl Handler { /// Retrieve a stashed diagnostic with `steal_diagnostic`. pub fn stash_diagnostic(&self, span: Span, key: StashKey, diag: Diagnostic) { let mut inner = self.inner.borrow_mut(); - inner.stash((span, key), diag); + inner.stash((span.with_parent(None), key), diag); } /// Steal a previously stashed diagnostic with the given `Span` and [`StashKey`] as the key. pub fn steal_diagnostic(&self, span: Span, key: StashKey) -> Option<DiagnosticBuilder<'_, ()>> { let mut inner = self.inner.borrow_mut(); - inner.steal((span, key)).map(|diag| DiagnosticBuilder::new_diagnostic(self, diag)) + inner + .steal((span.with_parent(None), key)) + .map(|diag| DiagnosticBuilder::new_diagnostic(self, diag)) } pub fn has_stashed_diagnostic(&self, span: Span, key: StashKey) -> bool { - self.inner.borrow().stashed_diagnostics.get(&(span, key)).is_some() + self.inner.borrow().stashed_diagnostics.get(&(span.with_parent(None), key)).is_some() } /// Emit all stashed diagnostics. |
