[−][src]Struct rustc_lint::levels::LintLevelsBuilder

pub struct LintLevelsBuilder<'s> {
    sess: &'s Session,
    sets: LintLevelSets,
    id_to_set: FxHashMap<HirId, u32>,
    cur: u32,
    warn_about_weird_lints: bool,
}

Fields

sess: &'s Sessionsets: LintLevelSetsid_to_set: FxHashMap<HirId, u32>cur: u32warn_about_weird_lints: bool

Implementations

impl<'s> LintLevelsBuilder<'s>[src]

pub fn new(
    sess: &'s Session,
    warn_about_weird_lints: bool,
    store: &LintStore
) -> Self
[src]

pub(in levels) fn process_command_line(
    &mut self,
    sess: &Session,
    store: &LintStore
)
[src]

pub(in levels) fn insert_spec(
    &mut self,
    specs: &mut FxHashMap<LintId, LevelSource>,
    id: LintId,
    (level, src): LevelSource
)
[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]

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!

pub(in levels) 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]

Called after push when the scope of a set of attributes are exited.

pub fn lint_level(&self, lint: &'static Lint) -> (Level, LintSource)[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]

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]

Registers the ID provided with the current set of lints stored in this context.

pub fn build(self) -> LintLevelSets[src]

pub fn build_map(self) -> LintLevelMap[src]

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

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.