[][src]Module rustc::lint::context

🔬 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?

Implementation of lint checking.

The lint checking is mostly consolidated into one pass which runs after all other analyses. Throughout compilation, lint warnings can be added via the add_lint method on the Session structure. This requires a span and an id of the node that the lint is being added to. The lint isn't actually emitted at that time because it is unknown what the actual lint level at that location is.

To actually emit lint warnings/errors, a separate pass is used. A context keeps track of the current state of all lint levels. Upon entering a node of the ast which can modify the lint settings, the previous lint state is pushed onto a stack and the ast is then recursed upon. As the ast is traversed, this keeps track of the current lint level for all lint attributes.

Structs

BufferedEarlyLint [
Experimental
]

Lints that are buffered up early on in the Session before the LintLevels is calculated

EarlyContext [
Experimental
]

Context for lint checking of the AST, after expansion, before lowering to HIR.

FutureIncompatibleInfo [
Experimental
]

Extra information for a future incompatibility lint. See the call to register_future_incompatible in librustc_lint/lib.rs for guidelines.

LateContext [
Experimental
]

Context for lint checking after type checking.

LintSession [
Experimental
]
LintStore [
Experimental
]

Information about the registered lints.

Enums

CheckLintNameResult [
Experimental
]
FindLintError [
Experimental
]
TargetLint [
Experimental
]

The target of the by_name map, which accounts for renaming/deprecation.

Traits

LintContext [
Experimental
]
LintPassObject [
Experimental
]

Functions

check_ast_crate [
Experimental
]
check_crate [
Experimental
]

Perform lint checking on a crate.