[][src]Crate rustc_lint

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 rustc_session::lint::builtin, 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.

Some code also exists in rustc_session::lint, rustc_middle::lint.

Note

This API is completely unstable and subject to change.

Re-exports

pub use builtin::SoftLints;
pub use rustc_session::lint::Level::*;

Modules

array_into_iter
builtin

Lints in the Rust compiler.

context

Implementation of lint checking.

early

Implementation of lint checking.

internal

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

late

Implementation of lint checking.

levels
methods
non_ascii_idents
nonstandard_style
panic_fmt
passes
redundant_semicolon
traits
types
unused

Macros

declare_combined_early_lint_pass
declare_combined_late_lint_pass
early_lint_methods
expand_combined_early_lint_pass_method
expand_combined_early_lint_pass_methods
expand_combined_late_lint_pass_method
expand_combined_late_lint_pass_methods
late_lint_methods

Structs

BufferedEarlyLint

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

BuiltinCombinedEarlyLintPass
BuiltinCombinedLateLintPass
BuiltinCombinedModuleLateLintPass
BuiltinCombinedPreExpansionLintPass
EarlyContext

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

FutureIncompatibleInfo

Extra information for a future incompatibility lint.

LateContext

Context for lint checking after type checking.

Lint

Specification of a single lint.

LintId

Identifies a lint known to the compiler.

LintStore

Information about the registered lints.

Enums

CheckLintNameResult
Level

Setting for how to handle a lint.

Traits

EarlyLintPass
LateLintPass
LintContext
LintPass

Functions

check_ast_crate
check_crate

Performs lint checking on a crate.

lint_mod
new_lint_store
provide
register_builtins

Tell the LintStore about all the built-in lints (the ones defined in this crate and the ones defined in rustc_session::lint::builtin).

register_internals

Type Definitions

LintArray