[−][src]Module rustc_lint::builtin
Lints in the Rust compiler.
This contains lints which can feasibly be implemented as their own
AST visitor. Also see rustc_session::lint::builtin, which contains the
definitions of lints that are emitted directly inside the main compiler.
To add a new lint to rustc, declare it here using declare_lint!().
Then add code to emit the new lint in the appropriate circumstances.
You can do that in an existing LintPass if it makes sense, or in a
new LintPass, or using Session::add_lint elsewhere in the
compiler. Only do the latter if the check can't be written cleanly as a
LintPass (also, note that such lints will need to be defined in
rustc_session::lint::builtin, not here).
If you define a new EarlyLintPass, you will also need to add it to the
add_early_builtin! or add_early_builtin_with_new! invocation in
lib.rs. Use the former for unit-like structs and the latter for structs
with a pub fn new().
If you define a new LateLintPass, you will also need to add it to the
late_lint_methods! invocation in lib.rs.
Structs
| AnonymousParameters | Checks for use of anonymous parameters (RFC 1685). |
| BoxPointers | |
| ClashingExternDeclarations | |
| DeprecatedAttr | Check for use of attributes which have been deprecated. |
| EllipsisInclusiveRangePatterns | |
| ExplicitOutlivesRequirements | |
| HardwiredLints | Does nothing as a lint pass, but registers some |
| IncompleteFeatures | Check for used feature gates in |
| InvalidNoMangleItems | |
| InvalidValue | |
| KeywordIdents | Check for uses of edition keywords used as an identifier. |
| MissingCopyImplementations | |
| MissingDebugImplementations | |
| MissingDoc | |
| MutableTransmutes | |
| NonShorthandFieldPatterns | |
| SoftLints | Does nothing as a lint pass, but registers some |
| TrivialConstraints | Lint for trait and lifetime bounds that don't depend on type parameters which either do nothing, or stop the item from being used. |
| TypeAliasBounds | Lint for trait and lifetime bounds in type aliases being mostly ignored. They are relevant when using associated types, but otherwise neither checked at definition site nor enforced at use site. |
| UnderMacro | |
| UnnameableTestItems | |
| UnreachablePub | Lint for items marked |
| UnsafeCode | |
| UnstableFeatures | Forbids using the |
| UnusedBrokenConst | Lint constants that are erroneous. Without this lint, we might not get any diagnostic if the constant is unused within this crate, even though downstream crates can't use it without producing an error. |
| UnusedDocComment | |
| WhileTrue |
Enums
| SymbolName | Differentiate between whether the name for an extern decl came from the link_name attribute or just from declaration itself. This is important because we don't want to report clashes on symbol name if they don't actually clash because one or the other links against a symbol with a different name. |
Statics
Functions
| check_const | |
| has_doc | |
| lint_deprecated_attr | |
| pierce_parens | Traverse through any amount of parenthesis and return the first non-parens expression. |
| warn_if_doc |