Module rustc_lint::builtin[][src]

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Lints in the Rust compiler.

This contains lints which can feasibly be implemented as their own AST visitor. Also see rustc::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::lint::builtin, not here).

If you define a new LintPass, you will also need to add it to the add_builtin! or add_builtin_with_new! invocation in lib.rs. Use the former for unit-like structs and the latter for structs with a pub fn new().

Modules

parser [
Experimental
]

Some lints that are buffered from libsyntax. See syntax::early_buffered_lints.

Structs

AnonymousParameters [
Experimental
]

Checks for use of anonymous parameters (RFC 1685)

Async2018 [
Experimental
]

Checks for uses of async as an identifier

BadRepr [
Experimental
]

Checks for incorrect use use of repr attributes.

BoxPointers [
Experimental
]
DeprecatedAttr [
Experimental
]

Checks for use of attributes which have been deprecated.

EllipsisInclusiveRangePatterns [
Experimental
]
HardwiredLints [
Experimental
]

Does nothing as a lint pass, but registers some Lints which are used by other parts of the compiler.

InvalidNoMangleItems [
Experimental
]
MissingCopyImplementations [
Experimental
]
MissingDebugImplementations [
Experimental
]
MissingDoc [
Experimental
]
MutableTransmutes [
Experimental
]
NonShorthandFieldPatterns [
Experimental
]
PluginAsLibrary [
Experimental
]
SoftLints [
Experimental
]

Does nothing as a lint pass, but registers some Lints which are used by other parts of the compiler.

TrivialConstraints [
Experimental
]

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 [
Experimental
]

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.

UnconditionalRecursion [
Experimental
]
UnionsWithDropFields [
Experimental
]

Lint for unions that contain fields with possibly non-trivial destructors.

UnnameableTestFunctions [
Experimental
]
UnreachablePub [
Experimental
]

Lint for items marked pub that aren't reachable from other crates

UnsafeCode [
Experimental
]
UnstableFeatures [
Experimental
]

Forbids using the #[feature(...)] attribute

UnusedBrokenConst [
Experimental
]

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.

UnusedBrokenConstVisitor [
Experimental
]
UnusedDocComment [
Experimental
]
WhileTrue [
Experimental
]

Enums

BuiltinLintDiagnostics [
Experimental
]

Statics

ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE [
Experimental
]
ANONYMOUS_PARAMETERS [
Experimental
]
ASYNC_IDENTS [
Experimental
]
BAD_REPR [
Experimental
]
BARE_TRAIT_OBJECTS [
Experimental
]
BOX_POINTERS [
Experimental
]
CONST_ERR [
Experimental
]
DEAD_CODE [
Experimental
]
DEPRECATED [
Experimental
]
DUPLICATE_ASSOCIATED_TYPE_BINDINGS [
Experimental
]
DUPLICATE_MACRO_EXPORTS [
Experimental
]
ELIDED_LIFETIMES_IN_PATHS [
Experimental
]
ELLIPSIS_INCLUSIVE_RANGE_PATTERNS [
Experimental
]
EXCEEDING_BITSHIFTS [
Experimental
]
ILLEGAL_FLOATING_POINT_LITERAL_PATTERN [
Experimental
]
INCOHERENT_FUNDAMENTAL_IMPLS [
Experimental
]
INTRA_DOC_LINK_RESOLUTION_FAILURE [
Experimental
]
INVALID_TYPE_PARAM_DEFAULT [
Experimental
]
IRREFUTABLE_LET_PATTERNS [
Experimental
]
LATE_BOUND_LIFETIME_ARGUMENTS [
Experimental
]
LEGACY_CONSTRUCTOR_VISIBILITY [
Experimental
]
LEGACY_DIRECTORY_OWNERSHIP [
Experimental
]
MACRO_USE_EXTERN_CRATE [
Experimental
]
MISSING_COPY_IMPLEMENTATIONS [
Experimental
]
MISSING_DEBUG_IMPLEMENTATIONS [
Experimental
]
MISSING_DOCS [
Experimental
]
MISSING_FRAGMENT_SPECIFIER [
Experimental
]
MUTABLE_TRANSMUTES [
Experimental
]
NON_SHORTHAND_FIELD_PATTERNS [
Experimental
]
NO_MANGLE_CONST_ITEMS [
Experimental
]
NO_MANGLE_GENERIC_ITEMS [
Experimental
]
PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES [
Experimental
]
PATTERNS_IN_FNS_WITHOUT_BODY [
Experimental
]
PLUGIN_AS_LIBRARY [
Experimental
]
PRIVATE_IN_PUBLIC [
Experimental
]
PRIVATE_NO_MANGLE_FNS [
Experimental
]
PRIVATE_NO_MANGLE_STATICS [
Experimental
]
PROC_MACRO_DERIVE_RESOLUTION_FALLBACK [
Experimental
]
PUB_USE_OF_PRIVATE_EXTERN_CRATE [
Experimental
]
RENAMED_AND_REMOVED_LINTS [
Experimental
]
SAFE_EXTERN_STATICS [
Experimental
]
SAFE_PACKED_BORROWS [
Experimental
]
SINGLE_USE_LIFETIMES [
Experimental
]
STABLE_FEATURES [
Experimental
]
TRIVIAL_BOUNDS [
Experimental
]
TRIVIAL_CASTS [
Experimental
]
TRIVIAL_NUMERIC_CASTS [
Experimental
]
TYPE_ALIAS_BOUNDS [
Experimental
]
TYVAR_BEHIND_RAW_POINTER [
Experimental
]
UNCONDITIONAL_RECURSION [
Experimental
]
UNIONS_WITH_DROP_FIELDS [
Experimental
]
UNKNOWN_CRATE_TYPES [
Experimental
]
UNKNOWN_LINTS [
Experimental
]
UNNAMEABLE_TEST_FUNCTIONS [
Experimental
]
UNREACHABLE_CODE [
Experimental
]
UNREACHABLE_PATTERNS [
Experimental
]
UNREACHABLE_PUB [
Experimental
]
UNSAFE_CODE [
Experimental
]
UNSTABLE_FEATURES [
Experimental
]
UNSTABLE_NAME_COLLISIONS [
Experimental
]
UNUSED_ASSIGNMENTS [
Experimental
]
UNUSED_DOC_COMMENTS [
Experimental
]
UNUSED_EXTERN_CRATES [
Experimental
]
UNUSED_FEATURES [
Experimental
]
UNUSED_IMPORTS [
Experimental
]
UNUSED_LABELS [
Experimental
]
UNUSED_LIFETIMES [
Experimental
]
UNUSED_MACROS [
Experimental
]
UNUSED_MUT [
Experimental
]
UNUSED_QUALIFICATIONS [
Experimental
]
UNUSED_UNSAFE [
Experimental
]
UNUSED_VARIABLES [
Experimental
]
WARNINGS [
Experimental
]
WHERE_CLAUSES_OBJECT_SAFETY [
Experimental
]
WHILE_TRUE [
Experimental
]

Functions

check_const [
Experimental
]
validate_const [
Experimental
]