]> git.lizzy.rs Git - rust.git/commitdiff
Add description to field and method
authorEsteban Küber <esteban@kuber.com.ar>
Thu, 25 Jan 2018 19:40:33 +0000 (11:40 -0800)
committerEsteban Küber <esteban@kuber.com.ar>
Thu, 25 Jan 2018 19:40:33 +0000 (11:40 -0800)
src/librustc_errors/lib.rs

index cabafa052a32c4866f4dc9af794c6e9cea6cbd5d..84ac2c0225350f411f2092f97f7a7371dcd3041b 100644 (file)
@@ -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 @@ pub fn track_diagnostics<F, R>(&self, f: F) -> (R, Vec<Diagnostic>)
         (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)
     }