@@ -98,9 +98,23 @@ pub(crate) enum ShouldConflictOnFullDuplicate {
9898 No ,
9999}
100100
101- /// A map of diagnostic filters to their severity and first occurrence's span.
101+ /// A map from diagnostic filters to their severity and span.
102102///
103- /// Intended for front ends' first step into storing parsed [`DiagnosticFilter`]s.
103+ /// Front ends can use this to collect the set of filters applied to a
104+ /// particular language construct, and detect duplicate/conflicting filters.
105+ ///
106+ /// For example, WGSL has global diagnostic filters that apply to the entire
107+ /// module, and diagnostic range filter attributes that apply to a specific
108+ /// function, statement, or other smaller construct. The set of filters applied
109+ /// to any given construct must not conflict, but they can be overridden by
110+ /// filters on other constructs nested within it. A front end can use a
111+ /// `DiagnosticFilterMap` to collect the filters applied to a single construct,
112+ /// using the [`add`] method's error checking to forbid conflicts.
113+ ///
114+ /// For each filter it contains, a `DiagnosticFilterMap` records the requested
115+ /// severity, and the source span of the filter itself.
116+ ///
117+ /// [`add`]: DiagnosticFilterMap::add
104118#[ derive( Clone , Debug , Default ) ]
105119#[ cfg( feature = "wgsl-in" ) ]
106120pub ( crate ) struct DiagnosticFilterMap ( IndexMap < FilterableTriggeringRule , ( Severity , Span ) > ) ;
0 commit comments