@@ -75,10 +75,10 @@ pub struct Session {
7575 pub working_dir : PathBuf ,
7676 pub lint_store : RefCell < lint:: LintStore > ,
7777 pub lints : RefCell < NodeMap < Vec < ( lint:: LintId , Span , String ) > > > ,
78- /// Set of (span, message) tuples tracking lint (sub)diagnostics that have
79- /// been set once, but should not be set again, in order to avoid
78+ /// Set of (LintId, span, message) tuples tracking lint (sub)diagnostics
79+ /// that have been set once, but should not be set again, in order to avoid
8080 /// redundantly verbose output (Issue #24690).
81- pub one_time_diagnostics : RefCell < FnvHashSet < ( Span , String ) > > ,
81+ pub one_time_diagnostics : RefCell < FnvHashSet < ( lint :: LintId , Span , String ) > > ,
8282 pub plugin_llvm_passes : RefCell < Vec < String > > ,
8383 pub mir_passes : RefCell < mir_pass:: Passes > ,
8484 pub plugin_attributes : RefCell < Vec < ( String , AttributeType ) > > ,
@@ -294,25 +294,26 @@ impl Session {
294294 }
295295
296296 /// Analogous to calling `.span_note` on the given DiagnosticBuilder, but
297- /// deduplicates on span and message for this `Session` if we're not
298- /// outputting in JSON mode.
297+ /// deduplicates on lint ID, span, and message for this `Session` if we're
298+ /// not outputting in JSON mode.
299299 //
300300 // FIXME: if the need arises for one-time diagnostics other than
301301 // `span_note`, we almost certainly want to generalize this
302302 // "check/insert-into the one-time diagnostics map, then set message if
303303 // it's not already there" code to accomodate all of them
304304 pub fn diag_span_note_once < ' a , ' b > ( & ' a self ,
305305 diag_builder : & ' b mut DiagnosticBuilder < ' a > ,
306- span : Span , message : & str ) {
306+ lint : & ' static lint :: Lint , span : Span , message : & str ) {
307307 match self . opts . error_format {
308308 // when outputting JSON for tool consumption, the tool might want
309309 // the duplicates
310310 config:: ErrorOutputType :: Json => {
311311 diag_builder. span_note ( span, & message) ;
312312 } ,
313313 _ => {
314- let span_message = ( span, message. to_owned ( ) ) ;
315- let fresh = self . one_time_diagnostics . borrow_mut ( ) . insert ( span_message) ;
314+ let lint_id = lint:: LintId :: of ( lint) ;
315+ let id_span_message = ( lint_id, span, message. to_owned ( ) ) ;
316+ let fresh = self . one_time_diagnostics . borrow_mut ( ) . insert ( id_span_message) ;
316317 if fresh {
317318 diag_builder. span_note ( span, & message) ;
318319 }
0 commit comments