@@ -75,10 +75,10 @@ pub struct Session {
75
75
pub working_dir : PathBuf ,
76
76
pub lint_store : RefCell < lint:: LintStore > ,
77
77
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
80
80
/// 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 ) > > ,
82
82
pub plugin_llvm_passes : RefCell < Vec < String > > ,
83
83
pub mir_passes : RefCell < mir_pass:: Passes > ,
84
84
pub plugin_attributes : RefCell < Vec < ( String , AttributeType ) > > ,
@@ -294,25 +294,26 @@ impl Session {
294
294
}
295
295
296
296
/// 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.
299
299
//
300
300
// FIXME: if the need arises for one-time diagnostics other than
301
301
// `span_note`, we almost certainly want to generalize this
302
302
// "check/insert-into the one-time diagnostics map, then set message if
303
303
// it's not already there" code to accomodate all of them
304
304
pub fn diag_span_note_once < ' a , ' b > ( & ' a self ,
305
305
diag_builder : & ' b mut DiagnosticBuilder < ' a > ,
306
- span : Span , message : & str ) {
306
+ lint : & ' static lint :: Lint , span : Span , message : & str ) {
307
307
match self . opts . error_format {
308
308
// when outputting JSON for tool consumption, the tool might want
309
309
// the duplicates
310
310
config:: ErrorOutputType :: Json => {
311
311
diag_builder. span_note ( span, & message) ;
312
312
} ,
313
313
_ => {
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) ;
316
317
if fresh {
317
318
diag_builder. span_note ( span, & message) ;
318
319
}
0 commit comments