Skip to content

Commit c110bf2

Browse files
docs(diagnostic_filter): add more words to DiagnosticFilterMap
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
1 parent 1abf3fe commit c110bf2

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

naga/src/diagnostic_filter.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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")]
106120
pub(crate) struct DiagnosticFilterMap(IndexMap<FilterableTriggeringRule, (Severity, Span)>);

0 commit comments

Comments
 (0)