From 2b737334961916daee73ea018eea877f389ad0dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 25 Jan 2018 11:40:33 -0800 Subject: [PATCH] Add description to field and method --- src/librustc_errors/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index cabafa052a32..84ac2c022535 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -244,6 +244,10 @@ pub struct Handler { continue_after_error: Cell, delayed_span_bug: RefCell>, tracked_diagnostics: RefCell>>, + + // This set contains the `DiagnosticId` of all emitted diagnostics to avoid + // emitting the same diagnostic with extended help (`--teach`) twice, which + // would be uneccessary repetition. tracked_diagnostic_codes: RefCell>, // This set contains a hash of every diagnostic that has been emitted by @@ -577,6 +581,10 @@ impl Handler { (ret, diagnostics) } + /// `true` if a diagnostic with this code has already been emitted in this handler. + /// + /// Used to suppress emitting the same error multiple times with extended explanation when + /// calling `-Zteach`. pub fn code_emitted(&self, code: &DiagnosticId) -> bool { self.tracked_diagnostic_codes.borrow().contains(code) }