Skip to content

Commit 2b73733

Browse files
committed
Add description to field and method
1 parent 482f7f1 commit 2b73733

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/librustc_errors/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ pub struct Handler {
244244
continue_after_error: Cell<bool>,
245245
delayed_span_bug: RefCell<Option<Diagnostic>>,
246246
tracked_diagnostics: RefCell<Option<Vec<Diagnostic>>>,
247+
248+
// This set contains the `DiagnosticId` of all emitted diagnostics to avoid
249+
// emitting the same diagnostic with extended help (`--teach`) twice, which
250+
// would be uneccessary repetition.
247251
tracked_diagnostic_codes: RefCell<FxHashSet<DiagnosticId>>,
248252

249253
// This set contains a hash of every diagnostic that has been emitted by
@@ -577,6 +581,10 @@ impl Handler {
577581
(ret, diagnostics)
578582
}
579583

584+
/// `true` if a diagnostic with this code has already been emitted in this handler.
585+
///
586+
/// Used to suppress emitting the same error multiple times with extended explanation when
587+
/// calling `-Zteach`.
580588
pub fn code_emitted(&self, code: &DiagnosticId) -> bool {
581589
self.tracked_diagnostic_codes.borrow().contains(code)
582590
}

0 commit comments

Comments
 (0)