about summary refs log tree commit diff
path: root/src/librustc_errors
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2018-01-25 11:40:33 -0800
committerEsteban Küber <esteban@kuber.com.ar>2018-01-25 11:40:33 -0800
commit2b737334961916daee73ea018eea877f389ad0dc (patch)
treead0f13e3dd4f376dda54420d79b6f40e61c15f25 /src/librustc_errors
parent482f7f19785455242dc3dfe36858847dd6f280cf (diff)
downloadrust-2b737334961916daee73ea018eea877f389ad0dc.tar.gz
rust-2b737334961916daee73ea018eea877f389ad0dc.zip
Add description to field and method
Diffstat (limited to 'src/librustc_errors')
-rw-r--r--src/librustc_errors/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs
index cabafa052a3..84ac2c02253 100644
--- a/src/librustc_errors/lib.rs
+++ b/src/librustc_errors/lib.rs
@@ -244,6 +244,10 @@ pub struct Handler {
     continue_after_error: Cell<bool>,
     delayed_span_bug: RefCell<Option<Diagnostic>>,
     tracked_diagnostics: RefCell<Option<Vec<Diagnostic>>>,
+
+    // 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<FxHashSet<DiagnosticId>>,
 
     // 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)
     }