From 19b63bc791dee7329922f809f5468483b0d72bc6 Mon Sep 17 00:00:00 2001 From: pierwill Date: Wed, 16 Nov 2022 12:21:15 -0600 Subject: [PATCH] Edit docs for `rustc_errors::Handler::stash_diagnostic` Clarify that the diagnostic can be retrieved with `steal_diagnostic`. --- compiler/rustc_errors/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 170d4341ae7..ae88fcade63 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -644,13 +644,14 @@ impl Handler { inner.stashed_diagnostics = Default::default(); } - /// Stash a given diagnostic with the given `Span` and `StashKey` as the key for later stealing. + /// Stash a given diagnostic with the given `Span` and [`StashKey`] as the key. + /// 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); } - /// Steal a previously stashed diagnostic with the given `Span` and `StashKey` as the key. + /// Steal a previously stashed diagnostic with the given `Span` and [`StashKey`] as the key. pub fn steal_diagnostic(&self, span: Span, key: StashKey) -> Option> { let mut inner = self.inner.borrow_mut(); inner.steal((span, key)).map(|diag| DiagnosticBuilder::new_diagnostic(self, diag))