Struct rustc_lint::levels::LintLevelsBuilder [−][src]
pub struct LintLevelsBuilder<'s> {
sess: &'s Session,
sets: LintLevelSets,
id_to_set: FxHashMap<HirId, u32>,
cur: u32,
warn_about_weird_lints: bool,
store: &'s LintStore,
crate_attrs: &'s [Attribute],
}Fields
sess: &'s Sessionsets: LintLevelSetsid_to_set: FxHashMap<HirId, u32>cur: u32warn_about_weird_lints: boolstore: &'s LintStorecrate_attrs: &'s [Attribute]Implementations
impl<'s> LintLevelsBuilder<'s>[src]
impl<'s> LintLevelsBuilder<'s>[src]pub fn new(
sess: &'s Session,
warn_about_weird_lints: bool,
store: &'s LintStore,
crate_attrs: &'s [Attribute]
) -> Self[src]
sess: &'s Session,
warn_about_weird_lints: bool,
store: &'s LintStore,
crate_attrs: &'s [Attribute]
) -> Self
fn process_command_line(&mut self, sess: &Session, store: &LintStore)[src]
fn insert_spec(
&mut self,
specs: &mut FxHashMap<LintId, LevelAndSource>,
id: LintId,
(level, src): LevelAndSource
)[src]
fn insert_spec(
&mut self,
specs: &mut FxHashMap<LintId, LevelAndSource>,
id: LintId,
(level, src): LevelAndSource
)[src]Attempts to insert the id to level_src map entry. If unsuccessful
(e.g. if a forbid was already inserted on the same scope), then emits a
diagnostic with no change to specs.
pub(crate) fn push(
&mut self,
attrs: &[Attribute],
store: &LintStore,
is_crate_node: bool
) -> BuilderPush[src]
pub(crate) fn push(
&mut self,
attrs: &[Attribute],
store: &LintStore,
is_crate_node: bool
) -> BuilderPush[src]Pushes a list of AST lint attributes onto this context.
This function will return a BuilderPush object which should be passed
to pop when this scope for the attributes provided is exited.
This function will perform a number of tasks:
- It’ll validate all lint-related attributes in
attrs - It’ll mark all lint-related attributes as used
- Lint levels will be updated based on the attributes provided
- Lint attributes are validated, e.g., a
#[forbid]can’t be switched to#[allow]
Don’t forget to call pop!
fn check_gated_lint(&self, lint_id: LintId, span: Span)[src]
fn check_gated_lint(&self, lint_id: LintId, span: Span)[src]Checks if the lint is gated on a feature that is not enabled.
pub fn pop(&mut self, push: BuilderPush)[src]
pub fn pop(&mut self, push: BuilderPush)[src]Called after push when the scope of a set of attributes are exited.
pub fn lint_level(&self, lint: &'static Lint) -> (Level, LintLevelSource)[src]
pub fn lint_level(&self, lint: &'static Lint) -> (Level, LintLevelSource)[src]Find the lint level for a lint.
pub fn struct_lint(
&self,
lint: &'static Lint,
span: Option<MultiSpan>,
decorate: impl for<'a> FnOnce(LintDiagnosticBuilder<'a>)
)[src]
pub fn struct_lint(
&self,
lint: &'static Lint,
span: Option<MultiSpan>,
decorate: impl for<'a> FnOnce(LintDiagnosticBuilder<'a>)
)[src]Used to emit a lint-related diagnostic based on the current state of this lint context.
pub fn register_id(&mut self, id: HirId)[src]
pub fn register_id(&mut self, id: HirId)[src]Registers the ID provided with the current set of lints stored in this context.