Struct rustc_lint::levels::LintLevelsBuilder
source · [−]pub struct LintLevelsBuilder<'s> {
sess: &'s Session,
sets: LintLevelSets,
id_to_set: FxHashMap<HirId, LintStackIndex>,
cur: LintStackIndex,
warn_about_weird_lints: bool,
store: &'s LintStore,
registered_tools: &'s RegisteredTools,
}Fields
sess: &'s Sessionsets: LintLevelSetsid_to_set: FxHashMap<HirId, LintStackIndex>cur: LintStackIndexwarn_about_weird_lints: boolstore: &'s LintStoreregistered_tools: &'s RegisteredToolsImplementations
sourceimpl<'s> LintLevelsBuilder<'s>
impl<'s> LintLevelsBuilder<'s>
pub fn new(
sess: &'s Session,
warn_about_weird_lints: bool,
store: &'s LintStore,
registered_tools: &'s RegisteredTools
) -> Self
pub(crate) fn sess(&self) -> &Session
pub(crate) fn lint_store(&self) -> &LintStore
fn process_command_line(&mut self, sess: &Session, store: &LintStore)
sourcefn insert_spec(
&mut self,
specs: &mut FxHashMap<LintId, LevelAndSource>,
id: LintId,
(level, src): LevelAndSource
)
fn insert_spec(
&mut self,
specs: &mut FxHashMap<LintId, LevelAndSource>,
id: LintId,
(level, src): LevelAndSource
)
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.
sourcepub(crate) fn push(
&mut self,
attrs: &[Attribute],
is_crate_node: bool
) -> BuilderPush
pub(crate) fn push(
&mut self,
attrs: &[Attribute],
is_crate_node: bool
) -> BuilderPush
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!
sourcefn check_gated_lint(&self, lint_id: LintId, span: Span)
fn check_gated_lint(&self, lint_id: LintId, span: Span)
Checks if the lint is gated on a feature that is not enabled.
sourcepub fn pop(&mut self, push: BuilderPush)
pub fn pop(&mut self, push: BuilderPush)
Called after push when the scope of a set of attributes are exited.
sourcepub fn lint_level(&self, lint: &'static Lint) -> (Level, LintLevelSource)
pub fn lint_level(&self, lint: &'static Lint) -> (Level, LintLevelSource)
Find the lint level for a lint.
sourcepub fn struct_lint(
&self,
lint: &'static Lint,
span: Option<MultiSpan>,
decorate: impl for<'a> FnOnce(LintDiagnosticBuilder<'a>)
)
pub fn struct_lint(
&self,
lint: &'static Lint,
span: Option<MultiSpan>,
decorate: impl for<'a> FnOnce(LintDiagnosticBuilder<'a>)
)
Used to emit a lint-related diagnostic based on the current state of this lint context.
sourcepub fn register_id(&mut self, id: HirId)
pub fn register_id(&mut self, id: HirId)
Registers the ID provided with the current set of lints stored in this context.
pub fn build_map(self) -> LintLevelMap
Auto Trait Implementations
impl<'s> !RefUnwindSafe for LintLevelsBuilder<'s>
impl<'s> !Send for LintLevelsBuilder<'s>
impl<'s> !Sync for LintLevelsBuilder<'s>
impl<'s> Unpin for LintLevelsBuilder<'s>
impl<'s> !UnwindSafe for LintLevelsBuilder<'s>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 96 bytes