Struct rustc_lint::levels::LintLevelsBuilder [−][src]
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,
crate_attrs: &'s [Attribute],
}
Fields
sess: &'s Session
sets: LintLevelSets
id_to_set: FxHashMap<HirId, LintStackIndex>
cur: LintStackIndex
warn_about_weird_lints: bool
store: &'s LintStore
crate_attrs: &'s [Attribute]
Implementations
pub fn new(
sess: &'s Session,
warn_about_weird_lints: bool,
store: &'s LintStore,
crate_attrs: &'s [Attribute]
) -> Self
fn 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
.
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
!
Checks if the lint is gated on a feature that is not enabled.
Called after push
when the scope of a set of attributes are exited.
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>)
)
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.
Registers the ID provided with the current set of lints stored in this context.
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
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: 104 bytes