This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,12 @@ use crate::errors::{
2828 UnknownToolInScopedLint ,
2929} ;
3030
31+ /// Collection of lint levels for the whole crate.
32+ /// This is used by AST-based lints, which do not
33+ /// wait until we have built HIR to be emitted.
3134#[ derive( Debug ) ]
3235struct LintLevelSets {
36+ /// Linked list of specifications.
3337 list : IndexVec < LintStackIndex , LintSet > ,
3438}
3539
@@ -40,12 +44,19 @@ rustc_index::newtype_index! {
4044 }
4145}
4246
47+ /// Specifications found at this position in the stack. This map only represents the lints
48+ /// found for one set of attributes (like `shallow_lint_levels_on` does).
49+ ///
50+ /// We store the level specifications as a linked list.
51+ /// Each `LintSet` represents a set of attributes on the same AST node.
52+ /// The `parent` forms a linked list that matches the AST tree.
53+ /// This way, walking the linked list is equivalent to walking the AST bottom-up
54+ /// to find the specifications for a given lint.
4355#[ derive( Debug ) ]
4456struct LintSet {
4557 // -A,-W,-D flags, a `Symbol` for the flag itself and `Level` for which
4658 // flag.
4759 specs : FxHashMap < LintId , LevelAndSource > ,
48-
4960 parent : LintStackIndex ,
5061}
5162
You can’t perform that action at this time.
0 commit comments