@@ -75,10 +75,10 @@ pub struct Session {
75
75
pub working_dir : ( String , bool ) ,
76
76
pub lint_store : RefCell < lint:: LintStore > ,
77
77
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
79
79
/// (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 ) > > ,
82
82
pub plugin_llvm_passes : RefCell < Vec < String > > ,
83
83
pub plugin_attributes : RefCell < Vec < ( String , AttributeType ) > > ,
84
84
pub crate_types : RefCell < Vec < config:: CrateType > > ,
@@ -164,6 +164,13 @@ enum DiagnosticBuilderMethod {
164
164
// add more variants as needed to support one-time diagnostics
165
165
}
166
166
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
+
167
174
impl Session {
168
175
pub fn local_crate_disambiguator ( & self ) -> CrateDisambiguator {
169
176
match * self . crate_disambiguator . borrow ( ) {
@@ -361,7 +368,7 @@ impl Session {
361
368
} ,
362
369
_ => {
363
370
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 ( ) ) ;
365
372
let fresh = self . one_time_diagnostics . borrow_mut ( ) . insert ( id_span_message) ;
366
373
if fresh {
367
374
do_method ( )
0 commit comments