Trait rustc::lint::LintContext
[−]
[src]
pub trait LintContext<'tcx>: Sized { fn sess(&self) -> &Session; fn lints(&self) -> &LintStore; fn mut_lints(&mut self) -> &mut LintStore; fn level_stack(&mut self) -> &mut Vec<(LintId, LevelSource)>; fn enter_attrs(&mut self, attrs: &'tcx [Attribute]); fn exit_attrs(&mut self, attrs: &'tcx [Attribute]); fn current_level(&self, lint: &'static Lint) -> Level { ... } fn level_src(&self, lint: &'static Lint) -> Option<LevelSource> { ... } fn lookup_and_emit<S: Into<MultiSpan>>(&self,
lint: &'static Lint,
span: Option<S>,
msg: &str) { ... } fn lookup<S: Into<MultiSpan>>(&self,
lint: &'static Lint,
span: Option<S>,
msg: &str)
-> DiagnosticBuilder { ... } fn span_lint<S: Into<MultiSpan>>(&self,
lint: &'static Lint,
span: S,
msg: &str) { ... } fn early_lint(&self, early_lint: &EarlyLint) { ... } fn struct_span_lint<S: Into<MultiSpan>>(&self,
lint: &'static Lint,
span: S,
msg: &str)
-> DiagnosticBuilder { ... } fn span_lint_note(&self,
lint: &'static Lint,
span: Span,
msg: &str,
note_span: Span,
note: &str) { ... } fn span_lint_help(&self,
lint: &'static Lint,
span: Span,
msg: &str,
help: &str) { ... } fn lint(&self, lint: &'static Lint, msg: &str) { ... } fn with_lint_attrs<F>(&mut self, attrs: &'tcx [Attribute], f: F) where F: FnOnce(&mut Self) { ... } }
🔬 This is a nightly-only experimental API. (
rustc_private
)Required Methods
fn sess(&self) -> &Session
🔬 This is a nightly-only experimental API. (
rustc_private
)fn lints(&self) -> &LintStore
🔬 This is a nightly-only experimental API. (
rustc_private
)fn mut_lints(&mut self) -> &mut LintStore
🔬 This is a nightly-only experimental API. (
rustc_private
)fn level_stack(&mut self) -> &mut Vec<(LintId, LevelSource)>
🔬 This is a nightly-only experimental API. (
rustc_private
)fn enter_attrs(&mut self, attrs: &'tcx [Attribute])
🔬 This is a nightly-only experimental API. (
rustc_private
)fn exit_attrs(&mut self, attrs: &'tcx [Attribute])
🔬 This is a nightly-only experimental API. (
rustc_private
)Provided Methods
fn current_level(&self, lint: &'static Lint) -> Level
🔬 This is a nightly-only experimental API. (
rustc_private
)Get the level of lint
at the current position of the lint
traversal.
fn level_src(&self, lint: &'static Lint) -> Option<LevelSource>
🔬 This is a nightly-only experimental API. (
rustc_private
)fn lookup_and_emit<S: Into<MultiSpan>>(&self,
lint: &'static Lint,
span: Option<S>,
msg: &str)
lint: &'static Lint,
span: Option<S>,
msg: &str)
🔬 This is a nightly-only experimental API. (
rustc_private
)fn lookup<S: Into<MultiSpan>>(&self,
lint: &'static Lint,
span: Option<S>,
msg: &str)
-> DiagnosticBuilder
lint: &'static Lint,
span: Option<S>,
msg: &str)
-> DiagnosticBuilder
🔬 This is a nightly-only experimental API. (
rustc_private
)fn span_lint<S: Into<MultiSpan>>(&self, lint: &'static Lint, span: S, msg: &str)
🔬 This is a nightly-only experimental API. (
rustc_private
)Emit a lint at the appropriate level, for a particular span.
fn early_lint(&self, early_lint: &EarlyLint)
🔬 This is a nightly-only experimental API. (
rustc_private
)fn struct_span_lint<S: Into<MultiSpan>>(&self,
lint: &'static Lint,
span: S,
msg: &str)
-> DiagnosticBuilder
lint: &'static Lint,
span: S,
msg: &str)
-> DiagnosticBuilder
🔬 This is a nightly-only experimental API. (
rustc_private
)fn span_lint_note(&self,
lint: &'static Lint,
span: Span,
msg: &str,
note_span: Span,
note: &str)
lint: &'static Lint,
span: Span,
msg: &str,
note_span: Span,
note: &str)
🔬 This is a nightly-only experimental API. (
rustc_private
)Emit a lint and note at the appropriate level, for a particular span.
fn span_lint_help(&self, lint: &'static Lint, span: Span, msg: &str, help: &str)
🔬 This is a nightly-only experimental API. (
rustc_private
)Emit a lint and help at the appropriate level, for a particular span.
fn lint(&self, lint: &'static Lint, msg: &str)
🔬 This is a nightly-only experimental API. (
rustc_private
)Emit a lint at the appropriate level, with no associated span.
fn with_lint_attrs<F>(&mut self, attrs: &'tcx [Attribute], f: F) where F: FnOnce(&mut Self)
🔬 This is a nightly-only experimental API. (
rustc_private
)Merge the lints specified by any lint attributes into the current lint context, call the provided function, then reset the lints in effect to their previous state.
Implementors
impl<'a, 'tcx> LintContext<'tcx> for LateContext<'a, 'tcx>
impl<'a> LintContext<'a> for EarlyContext<'a>