Trait rustc::lint::LintContext
[−]
[src]
pub trait LintContext<'tcx>: Sized { type PassObject: LintPassObject; fn sess(&self) -> &Session; fn lints(&self) -> &LintStore; fn lint_sess(&self) -> &LintSession<'tcx, Self::PassObject>; fn lint_sess_mut(&mut self) -> &mut LintSession<'tcx, Self::PassObject>; fn enter_attrs(&mut self, attrs: &'tcx [Attribute]); fn exit_attrs(&mut self, attrs: &'tcx [Attribute]); fn lookup<S: Into<MultiSpan>>(
&self,
lint: &'static Lint,
span: Option<S>,
msg: &str
) -> DiagnosticBuilder; fn with_lint_attrs<F>(&mut self, id: NodeId, attrs: &'tcx [Attribute], f: F)
where
F: FnOnce(&mut Self); fn lookup_and_emit<S: Into<MultiSpan>>(
&self,
lint: &'static Lint,
span: Option<S>,
msg: &str
) { ... } fn span_lint<S: Into<MultiSpan>>(
&self,
lint: &'static Lint,
span: S,
msg: &str
) { ... } 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) { ... } }
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Associated Types
type PassObject: LintPassObject
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Required Methods
fn sess(&self) -> &Session
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn lints(&self) -> &LintStore
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn lint_sess(&self) -> &LintSession<'tcx, Self::PassObject>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn lint_sess_mut(&mut self) -> &mut LintSession<'tcx, Self::PassObject>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn enter_attrs(&mut self, attrs: &'tcx [Attribute])
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn exit_attrs(&mut self, attrs: &'tcx [Attribute])
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn lookup<S: Into<MultiSpan>>(
&self,
lint: &'static Lint,
span: Option<S>,
msg: &str
) -> DiagnosticBuilder
&self,
lint: &'static Lint,
span: Option<S>,
msg: &str
) -> DiagnosticBuilder
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn with_lint_attrs<F>(&mut self, id: NodeId, attrs: &'tcx [Attribute], f: F) where
F: FnOnce(&mut Self),
F: FnOnce(&mut Self),
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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.
Provided Methods
fn lookup_and_emit<S: Into<MultiSpan>>(
&self,
lint: &'static Lint,
span: Option<S>,
msg: &str
)
&self,
lint: &'static Lint,
span: Option<S>,
msg: &str
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn span_lint<S: Into<MultiSpan>>(&self, lint: &'static Lint, span: S, msg: &str)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Emit a lint at the appropriate level, for a particular span.
fn struct_span_lint<S: Into<MultiSpan>>(
&self,
lint: &'static Lint,
span: S,
msg: &str
) -> DiagnosticBuilder
&self,
lint: &'static Lint,
span: S,
msg: &str
) -> DiagnosticBuilder
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn span_lint_note(
&self,
lint: &'static Lint,
span: Span,
msg: &str,
note_span: Span,
note: &str
)
&self,
lint: &'static Lint,
span: Span,
msg: &str,
note_span: Span,
note: &str
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Emit a lint at the appropriate level, with no associated span.
Implementors
impl<'a, 'tcx> LintContext<'tcx> for LateContext<'a, 'tcx> type PassObject = LateLintPassObject;
impl<'a> LintContext<'a> for EarlyContext<'a> type PassObject = EarlyLintPassObject;