rustc_lint - Rust (original) (raw)
Expand description
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 LintPass
es 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 external lint plugins, as is done for Clippy.
See https://rustc-dev-guide.rust-lang.org/diagnostics.html for an overview of how lints are implemented.
§Note
This API is completely unstable and subject to change.
pub use builtin::[MissingDoc](builtin/struct.MissingDoc.html "struct rustc_lint::builtin::MissingDoc");
pub use builtin::[SoftLints](builtin/struct.SoftLints.html "struct rustc_lint::builtin::SoftLints");
pub use rustc_session::lint::[Level](enum.Level.html "enum rustc_lint::Level")::*;
autorefs 🔒
Lints in the Rust compiler.
context 🔒
Basic types for managing and implementing lints.
dangling 🔒
early 🔒
Implementation of the early lint pass.
errors 🔒
expect 🔒
internal 🔒
Some lints that are only useful in the compiler or crates that use compiler internals, such as Clippy.
late 🔒
Implementation of the late lint pass.
levels 🔒
lints 🔒
macro_expr_fragment_specifier_2024_migration 🔒
Migration code for the expr_fragment_specifier_2024
rule.
multiple_supertrait_upcastable 🔒
opaque_hidden_inferred_bound 🔒
passes 🔒
traits 🔒
types 🔒
unused 🔒
utils 🔒
declare_combined_early_lint_pass
Combines multiple lints passes into a single lint pass, at compile time, for maximum speed. Each check_foo
method in $methods
within this pass simply calls check_foo
once per $pass
. Compare withEarlyLintPassObjects
, which is similar, but combines lint passes at runtime.
declare_combined_late_lint_pass
Combines multiple lints passes into a single lint pass, at compile time, for maximum speed. Each check_foo
method in $methods
within this pass simply calls check_foo
once per $pass
. Compare withLateLintPassObjects
, which is similar, but combines lint passes at runtime.
expand_combined_early_lint_pass_method
expand_combined_early_lint_pass_methods
expand_combined_late_lint_pass_method
expand_combined_late_lint_pass_methods
Lints that are buffered up early on in the Session
before theLintLevels
is calculated.
BuiltinCombinedModuleLateLintPass 🔒
BuiltinCombinedPreExpansionLintPass
Context for lint checking of the AST, after expansion, before lowering to HIR.
Extra information for a future incompatibility lint.
Context for lint checking outside of type inference.
Specification of a single lint.
Identifies a lint known to the compiler.
Information about the registered lints.
Setting for how to handle a lint.
The array_into_iter
lint detects calling into_iter
on arrays.
The boxed_slice_into_iter
lint detects calling into_iter
on boxed slices.
Raw content of Fluent resource for this crate, generated by fluent_messages
macro, imported by rustc_driver
to include all crates’ resources in one bundle.
Early lints work on different nodes - either on the crate root, or on freshly loaded modules. This trait generalizes over those nodes.
Performs lint checking on a crate.
lint_mod 🔒
Tell the LintStore
about all the built-in lints (the ones defined in this crate and the ones defined inrustc_session::lint::builtin
).