[][src]Module rustc::lint

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Lints, aka compiler warnings.

A 'lint' check is a kind of miscellaneous constraint that a user might want to enforce, but might reasonably want to permit as well, on a module-by-module basis. They contrast with static constraints enforced by other phases of the compiler, which are generally required to hold in order to compile the program at all.

Most lints can be written as LintPass instances. These run after all other analyses. The LintPasses built into rustc are defined within builtin.rs, which has further comments on how to add such a lint. rustc can also load user-defined lint plugins via the plugin mechanism.

Some of rustc's lints are defined elsewhere in the compiler and work by calling add_lint() on the overall Session object. This works when it happens before the main lint pass, which emits the lints stored by add_lint(). To emit lints after the main lint pass (from codegen, for example) requires more effort. See emit_lint and GatherNodeLevels in context.rs.

Re-exports

pub use self::Level::*;
pub use self::LintSource::*;

Modules

builtinInternal

Some lints that are built in to the compiler.

contextInternal

Implementation of lint checking.

internalInternal

Some lints that are only useful in the compiler or crates that use compiler internals, such as Clippy.

levelsInternal

Structs

BufferedEarlyLintInternal

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

EarlyContextInternal

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

FutureIncompatibleInfoInternal

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

LateContextInternal

Context for lint checking after type checking.

LintInternal

Specification of a single lint.

LintBufferInternal
LintIdInternal

Identifies a lint known to the compiler.

LintLevelMapInternal
LintLevelMapBuilderInternal
LintLevelSetsInternal
LintStoreInternal

Information about the registered lints.

Enums

CheckLintNameResultInternal
LevelInternal

Setting for how to handle a lint.

LintSourceInternal

How a lint level was set.

Traits

EarlyLintPassInternal
LateLintPassInternal
LintContextInternal
LintPassInternal

Functions

check_ast_crateInternal
check_crateInternal

Performs lint checking on a crate.

in_derive_expansionInternal

Returns whether span originates in a derive macro's expansion

in_external_macroInternal

Returns whether span originates in a foreign crate's external macro.

late_lint_modInternal
lint_levelsInternal
maybe_lint_level_rootInternal
provideInternal
struct_lint_levelInternal

Type Definitions

EarlyLintPassObjectInternal

A lint pass boxed up as a trait object.

LateLintPassObjectInternal
LevelSourceInternal
LintArrayInternal