Module rustc::lint [] [src]

Unstable (rustc_private)

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 just before translation to LLVM bytecode. 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 trans, for example) requires more effort. See emit_lint and GatherNodeLevels in context.rs.

Reexports

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

Modules

builtin [Unstable]

Some lints that are built in to the compiler.

Structs

EarlyContext [Unstable]

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

FutureIncompatibleInfo [Unstable]

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

GatherNodeLevels [Unstable]
LateContext [Unstable]

Context for lint checking after type checking.

Lint [Unstable]

Specification of a single lint.

LintId [Unstable]

Identifies a lint known to the compiler.

LintStore [Unstable]

Information about the registered lints.

Enums

Level [Unstable]

Setting for how to handle a lint.

LintSource [Unstable]

How a lint level was set.

Traits

EarlyLintPass [Unstable]
LateLintPass [Unstable]

Trait for types providing lint checks.

LintContext [Unstable]
LintPass [Unstable]

Functions

check_ast_crate [Unstable]
check_crate [Unstable]

Perform lint checking on a crate.

gather_attrs [Unstable]

Parse the lint attributes into a vector, with Errs for malformed lint attributes. Writing this as an iterator is an enormous mess.

raw_emit_lint [Unstable]

Emit a lint as a warning or an error (or not at all) according to level.

raw_struct_lint [Unstable]

Type Definitions

EarlyLintPassObject [Unstable]

A lint pass boxed up as a trait object.

LateLintPassObject [Unstable]
LevelSource [Unstable]
LintArray [Unstable]