@@ -75,10 +75,10 @@ pub struct Session {
7575 pub working_dir : ( String , bool ) ,
7676 pub lint_store : RefCell < lint:: LintStore > ,
7777 pub buffered_lints : RefCell < Option < lint:: LintBuffer > > ,
78- /// Set of (LintId , Option<Span>, message) tuples tracking lint
78+ /// Set of (DiagnosticId , Option<Span>, message) tuples tracking
7979 /// (sub)diagnostics that have been set once, but should not be set again,
80- /// in order to avoid redundantly verbose output (Issue #24690).
81- pub one_time_diagnostics : RefCell < FxHashSet < ( Option < lint :: LintId > , Option < Span > , String ) > > ,
80+ /// in order to avoid redundantly verbose output (Issue #24690, #44953 ).
81+ pub one_time_diagnostics : RefCell < FxHashSet < ( DiagnosticMessageId , Option < Span > , String ) > > ,
8282 pub plugin_llvm_passes : RefCell < Vec < String > > ,
8383 pub plugin_attributes : RefCell < Vec < ( String , AttributeType ) > > ,
8484 pub crate_types : RefCell < Vec < config:: CrateType > > ,
@@ -164,6 +164,13 @@ enum DiagnosticBuilderMethod {
164164 // add more variants as needed to support one-time diagnostics
165165}
166166
167+ /// Diagnostic message id - used in order to avoid emitting the same message more than once
168+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash ) ]
169+ pub enum DiagnosticMessageId {
170+ LintId ( lint:: LintId ) ,
171+ StabilityId ( u32 )
172+ }
173+
167174impl Session {
168175 pub fn local_crate_disambiguator ( & self ) -> CrateDisambiguator {
169176 match * self . crate_disambiguator . borrow ( ) {
@@ -361,7 +368,7 @@ impl Session {
361368 } ,
362369 _ => {
363370 let lint_id = lint:: LintId :: of ( lint) ;
364- let id_span_message = ( Some ( lint_id) , span, message. to_owned ( ) ) ;
371+ let id_span_message = ( DiagnosticMessageId :: LintId ( lint_id) , span, message. to_owned ( ) ) ;
365372 let fresh = self . one_time_diagnostics . borrow_mut ( ) . insert ( id_span_message) ;
366373 if fresh {
367374 do_method ( )
0 commit comments