Comment LintLevelSets.
This commit is contained in:
parent
69613bb602
commit
fca0d8a10e
1 changed files with 12 additions and 1 deletions
|
@ -28,8 +28,12 @@ use crate::errors::{
|
||||||
UnknownToolInScopedLint,
|
UnknownToolInScopedLint,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Collection of lint levels for the whole crate.
|
||||||
|
/// This is used by AST-based lints, which do not
|
||||||
|
/// wait until we have built HIR to be emitted.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct LintLevelSets {
|
struct LintLevelSets {
|
||||||
|
/// Linked list of specifications.
|
||||||
list: IndexVec<LintStackIndex, LintSet>,
|
list: IndexVec<LintStackIndex, LintSet>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,12 +44,19 @@ rustc_index::newtype_index! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Specifications found at this position in the stack. This map only represents the lints
|
||||||
|
/// found for one set of attributes (like `shallow_lint_levels_on` does).
|
||||||
|
///
|
||||||
|
/// We store the level specifications as a linked list.
|
||||||
|
/// Each `LintSet` represents a set of attributes on the same AST node.
|
||||||
|
/// The `parent` forms a linked list that matches the AST tree.
|
||||||
|
/// This way, walking the linked list is equivalent to walking the AST bottom-up
|
||||||
|
/// to find the specifications for a given lint.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct LintSet {
|
struct LintSet {
|
||||||
// -A,-W,-D flags, a `Symbol` for the flag itself and `Level` for which
|
// -A,-W,-D flags, a `Symbol` for the flag itself and `Level` for which
|
||||||
// flag.
|
// flag.
|
||||||
specs: FxHashMap<LintId, LevelAndSource>,
|
specs: FxHashMap<LintId, LevelAndSource>,
|
||||||
|
|
||||||
parent: LintStackIndex,
|
parent: LintStackIndex,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue