Some lints that are built in to the compiler.
These are the built-in lints that are emitted direct in the main
compiler code, rather than using their own custom pass. Those
lints are all available in
Does nothing as a lint pass, but registers some
that are used by other parts of the compiler.
absolute_paths_not_starting_with_crate lint detects fully
qualified paths that start with a module name instead of
self, or an extern crate name
asm_sub_register lint detects using only a subset of a register
for inline asm inputs.
bad_asm_style lint detects the use of the
bare_trait_objects lint suggests using
dyn Trait for trait
bindings_with_variant_name lint detects pattern bindings with
the same name as one of the matched variants.
break_with_label_and_loop lint detects labeled
break expressions with
an unlabeled loop as their value expression.
cenum_impl_drop_cast lint detects an
as cast of a field-less
enum that implements
coherence_leak_check lint detects conflicting implementations of
a trait that are only distinguished by the old leak-check code.
conflicting_repr_hints lint detects
repr attributes with
const_err lint detects an erroneous expression while doing
const_evaluatable_unchecked lint detects a generic constant used
in a type.
const_item_mutation lint detects attempts to mutate a
dead_code lint detects unused, unexported items.
deprecated lint detects use of deprecated items.
deprecated_cfg_attr_crate_type_name lint detects uses of the
#![cfg_attr(..., crate_type = "...")] and
#![cfg_attr(..., crate_name = "...")] attributes to conditionally
specify the crate type and name in the source code.
deprecated_in_future lint is internal to rustc and should not be
used by user code.
deref_into_dyn_supertrait lint is output whenever there is a use of the
Deref implementation with a
dyn SuperTrait type as
duplicate_macro_attributes lint detects when a
#[test]-like built-in macro
attribute is duplicated on an item. This lint may trigger on
elided_lifetimes_in_paths lint detects the use of hidden
explicit_outlives_requirements lint detects unnecessary
lifetime bounds that can be inferred.
exported_private_dependencies lint detects private dependencies
that are exposed in a public interface.
forbidden_lint_groups lint detects violations of
forbid applied to a lint group. Due to a bug in the compiler,
these used to be overlooked entirely. They now generate a warning.
function_item_references lint detects function references that are
fmt::Pointer or transmuted.
illegal_floating_point_literal_pattern lint detects
floating-point literals used in patterns.
ill_formed_attribute_input lint detects ill-formed attribute
inputs that were previously accepted and used in practice.
incomplete_include lint detects the use of the
macro with a file that contains more than one expression.
ineffective_unstable_trait_impl lint detects
#[unstable] attributes which are not used.
invalid_doc_attributes lint detects when the
invalid_type_param_default lint detects type parameter defaults
erroneously allowed in an invalid location.
large_assignments lint detects when objects of large
types are being moved around.
late_bound_lifetime_arguments lint detects generic lifetime
arguments in path segments with late bound lifetime parameters.
legacy_derive_helpers lint detects derive helper attributes
that are used before they are introduced.
macro_export macros from the current crate
that cannot be referred to by absolute paths.
meta_variable_misuse lint detects possible meta-variable misuse
in macro definitions.
missing_abi lint detects cases where the ABI is omitted from
missing_fragment_specifier lint is issued when an unused pattern in a
macro_rules! macro definition has a meta-variable (e.g.
$e) that is not
followed by a fragment specifier (e.g.
must_not_suspend lint guards against values that shouldn’t be held across suspend points
mutable_borrow_reservation_conflict lint detects the reservation
of a two-phased borrow that conflicts with other shared borrows.
nontrivial_structural_match lint detects constants that are used in patterns,
whose type is not structural-match and whose initializer body actually uses values
that are not structural-match. So
Option<NotStruturalMatch> is ok if the constant
non_exhaustive_omitted_patterns lint detects when a wildcard (
..) in a
pattern for a
#[non_exhaustive] struct or enum is reachable.
order_dependent_trait_objects lint detects a trait coherency
violation that would allow creating two trait impls for the same
dynamic trait object involving marker traits.
overlapping_range_endpoints lint detects
match arms that have range patterns that
overlap on their endpoints.
patterns_in_fns_without_body lint detects
patterns as a parameter in functions without a body.
pointer_structural_match lint detects pointers used in patterns whose behaviour
cannot be relied upon across compiler versions and optimization levels.
private_in_public lint detects private items in public
interfaces not caught by the old implementation.
proc_macro_back_compat lint detects uses of old versions of certain
proc-macro crates, which have hardcoded workarounds in the compiler.
proc_macro_derive_resolution_fallback lint detects proc macro
derives using inaccessible names from parent modules.
pub_use_of_private_extern_crate lint detects a specific
situation of re-exporting a private
renamed_and_removed_lints lint detects lints that have been
renamed or removed.
rust_2021_incompatible_closure_captures lint detects variables that aren’t completely
captured in Rust 2021, such that the
Drop order of their fields may differ between
Rust 2018 and 2021.
rust_2021_incompatible_or_patterns lint detects usage of old versions of or-patterns.
rust_2021_prefixes_incompatible_syntax lint detects identifiers that will be parsed as a
prefix instead in Rust 2021.
rust_2021_prelude_collisions lint detects the usage of trait methods which are ambiguous
with traits added to the prelude in future editions.
semicolon_in_expressions_from_macros lint detects trailing semicolons
in macro bodies when the macro is invoked in expression position.
This was previous accepted, but is being phased out.
single_use_lifetimes lint detects lifetimes that are only used
soft_unstable lint detects unstable features that were
unintentionally allowed on stable.
stable_features lint detects a
feature attribute that
has since been made stable.
text_direction_codepoint_in_comment lint detects Unicode codepoints in comments that
change the visual representation of text on screen in a way that does not correspond to
their on memory representation.
trivial_casts lint detects trivial casts which could be replaced
with coercion, which may require type ascription or a temporary
trivial_numeric_casts lint detects trivial numeric casts of types
which could be removed.
tyvar_behind_raw_pointer lint detects raw pointer to an
unaligned_references lint detects unaligned references to fields
of packed structs.
unconditional_panic lint detects an operation that will cause a
panic at runtime.
unconditional_recursion lint detects functions that cannot
return without calling themselves.
undefined_naked_function_abi lint detects naked function definitions that
either do not specify an ABI or specify the Rust ABI.
uninhabited_static lint detects uninhabited statics.
unknown_crate_types lint detects an unknown crate type found in
unknown_lints lint detects unrecognized lint attribute.
unreachable_code lint detects unreachable code paths.
unreachable_patterns lint detects unreachable patterns.
unsafe_op_in_unsafe_fn lint detects unsafe operations in unsafe
functions without an explicit unsafe block.
unstable_name_collisions lint detects that you have used a name
that the standard library plans to add in the future.
unsupported_calling_conventions lint is output whenever there is a use of the
vectorcall calling conventions (or their unwind
variants) on targets that cannot meaningfully be supported for the requested target.
unsupported_naked_functions lint detects naked function
definitions that are unsupported but were previously accepted.
unused_assignments lint detects assignments that will never be read.
unused_attributes lint detects attributes that were not used by
unused_crate_dependencies lint detects crate dependencies that
are never used.
unused_doc_comments lint detects doc comments that aren’t used
unused_extern_crates lint guards against
extern crate items
that are never used.
unused_features lint detects unused or unknown features found in
unused_imports lint detects imports that are never used.
unused_lifetimes lint detects lifetime parameters that are never
unused_macros lint detects macros that were not used.
unused_mut lint detects mut variables which don’t need to be
unused_qualifications lint detects unnecessarily qualified
unused_unsafe lint detects unnecessary use of an
unused_variables lint detects variables which are not used in
useless_deprecated lint detects deprecation attributes with no effect.
warnings lint allows you to change the level of other
lints which produce warnings.