File tree 1 file changed +8
-0
lines changed
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,10 @@ pub struct Handler {
244
244
continue_after_error : Cell < bool > ,
245
245
delayed_span_bug : RefCell < Option < Diagnostic > > ,
246
246
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.
247
251
tracked_diagnostic_codes : RefCell < FxHashSet < DiagnosticId > > ,
248
252
249
253
// This set contains a hash of every diagnostic that has been emitted by
@@ -577,6 +581,10 @@ impl Handler {
577
581
( ret, diagnostics)
578
582
}
579
583
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`.
580
588
pub fn code_emitted ( & self , code : & DiagnosticId ) -> bool {
581
589
self . tracked_diagnostic_codes . borrow ( ) . contains ( code)
582
590
}
You can’t perform that action at this time.
0 commit comments