Skip to main content

Crate rustc_lint

Crate rustc_lint 

Source
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 LintPasses built into rustc are defined within rustc_lint_defs::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.

Re-exportsΒ§

pub(crate) use async_closures::AsyncClosureUsage; πŸ”’
pub(crate) use async_fn_in_trait::AsyncFnInTrait; πŸ”’
pub(crate) use default_could_be_derived::DefaultCouldBeDerived; πŸ”’
pub(crate) use enum_intrinsics_non_enums::EnumIntrinsicsNonEnums; πŸ”’
pub(crate) use if_let_rescope::IfLetRescope; πŸ”’
pub(crate) use impl_trait_overcaptures::ImplTraitOvercaptures; πŸ”’
pub(crate) use implicit_provenance_casts::ImplicitProvenanceCasts; πŸ”’
pub(crate) use non_fmt_panic::NonPanicFmt; πŸ”’
pub(crate) use shadowed_into_iter::ShadowedIntoIter; πŸ”’
pub use shadowed_into_iter::ARRAY_INTO_ITER;
pub use shadowed_into_iter::BOXED_SLICE_INTO_ITER;
pub(crate) use transmute::CheckTransmutes; πŸ”’
pub(crate) use unmarked_unchecked_type_aliases::UnmarkedUncheckedTypeAliases; πŸ”’
pub use builtin::MissingDoc;
pub use context::CheckLintNameResult;
pub use context::EarlyContext;
pub use context::LateContext;
pub use context::LintContext;
pub use context::LintStore;
pub use early::diagnostics::DiagAndSess;
pub use early::EarlyCheckNode;
pub use early::check_ast_node;
pub use late::check_crate;
pub use late::late_lint_mod;
pub use late::unerased_lint_store;
pub use levels::LintLevelsBuilder;
pub use passes::EarlyLintPass;
pub use passes::LateLintPass;
pub use utils::std_or_core;
pub(crate) use improper_ctypes::ImproperCTypesLint; πŸ”’
pub(crate) use rustc_data_structures::unord::UnordSet; πŸ”’
pub(crate) use rustc_hir::def_id::LocalModId; πŸ”’
pub(crate) use rustc_middle::query::Providers; πŸ”’
pub(crate) use rustc_middle::ty::TyCtxt; πŸ”’
pub(crate) use builtin::*; πŸ”’
pub(crate) use lifetime_syntax::*; πŸ”’
pub(crate) use unused::must_use::*; πŸ”’
pub(crate) use unused::*; πŸ”’
pub use rustc_lint_defs::Level::*;

ModulesΒ§

async_closures πŸ”’
async_fn_in_trait πŸ”’
autorefs πŸ”’
builtin
Lints in the Rust compiler.
c_void_returns πŸ”’
context πŸ”’
Basic types for managing and implementing lints.
dangling πŸ”’
default_could_be_derived πŸ”’
deref_into_dyn_supertrait πŸ”’
diagnostics πŸ”’
disallowed_pass_by_ref πŸ”’
drop_forget_useless πŸ”’
early πŸ”’
Implementation of the early lint pass.
enum_intrinsics_non_enums πŸ”’
expect πŸ”’
for_loops_over_fallibles πŸ”’
foreign_modules πŸ”’
function_cast_as_integer πŸ”’
gpukernel_abi πŸ”’
if_let_rescope πŸ”’
impl_trait_overcaptures πŸ”’
implicit_provenance_casts πŸ”’
improper_ctypes πŸ”’
interior_mutable_consts πŸ”’
internal πŸ”’
Some lints that are only useful in the compiler or crates that use compiler internals, such as Clippy.
invalid_from_utf8 πŸ”’
late πŸ”’
Implementation of the late lint pass.
let_underscore πŸ”’
levels πŸ”’
lifetime_syntax
literal πŸ”’
macro_expr_fragment_specifier_2024_migration πŸ”’
Migration code for the expr_fragment_specifier_2024 rule.
map_unit_fn πŸ”’
multiple_supertrait_upcastable πŸ”’
non_ascii_idents πŸ”’
non_fmt_panic πŸ”’
non_local_def πŸ”’
nonstandard_style πŸ”’
noop_method_call πŸ”’
opaque_hidden_inferred_bound πŸ”’
passes πŸ”’
precedence πŸ”’
ptr_nulls πŸ”’
raw_borrows_via_references πŸ”’
redundant_semicolon πŸ”’
reference_casting πŸ”’
runtime_symbols πŸ”’
shadowed_into_iter πŸ”’
static_mut_refs πŸ”’
traits πŸ”’
transmute πŸ”’
types πŸ”’
unit_bindings πŸ”’
unmarked_unchecked_type_aliases πŸ”’
unqualified_local_imports πŸ”’
unused
utils πŸ”’

MacrosΒ§

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 with RuntimeCombinedEarlyLintPass, 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 with RuntimeCombinedLateLintPass, which is similar, but combines lint passes at runtime.
declare_lint
Declares a static item of type &'static Lint.
declare_lint_pass
Declares a type named $name which implements LintPass. To the right of => a comma separated list of Lint statics is given.
declare_tool_lint
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
impl_lint_pass
Implements LintPass for $ty with the given list of Lint statics.
late_lint_methods

StructsΒ§

AddBound πŸ”’
BadOptAccess πŸ”’
BadUseOfFindAttr πŸ”’
BufferedEarlyLint
Lints that are buffered up early on in the Session before the LintLevels is calculated.
BuiltinCombinedEarlyLintPass
BuiltinCombinedLateLintModPass πŸ”’
BuiltinCombinedPreExpansionLintPass
CVoidReturns πŸ”’
CheckGpuKernelTypes πŸ”’
Check for valid and invalid types.
DanglingPointerLocalContext πŸ”’
DanglingPointerReturnSearcher πŸ”’
DanglingPointerSearcher πŸ”’
This produces a dangling pointer:
DanglingPointers πŸ”’
FIXME: false negatives (i.e. the lint is not emitted when it should be)
DefaultHashTypes πŸ”’
DerefIntoDynSupertrait πŸ”’
DisallowedPassByRef πŸ”’
DropForgetUseless πŸ”’
DropTraitConstraints πŸ”’
Lint for bounds of the form T: Drop, which usually indicate an attempt to emulate std::mem::needs_drop.
Expr2024 πŸ”’
ForLoopsOverFallibles πŸ”’
FunctionCastsAsInteger πŸ”’
Lint for casts of functions into integers.
FutureIncompatibleInfo
Extra information for a future incompatibility lint.
ImplicitAutorefs πŸ”’
ImplicitSysrootCrateImport πŸ”’
ImproperGpuKernelLint πŸ”’
InteriorMutableConsts πŸ”’
InternalCombinedEarlyLintPass πŸ”’
InternalCombinedLateLintModPass πŸ”’
InvalidAtomicOrdering πŸ”’
InvalidFromUtf8 πŸ”’
InvalidReferenceCasting πŸ”’
LetUnderscore πŸ”’
Lint
Specification of a single lint.
LintId
Identifies a lint known to the compiler.
LintPassImpl πŸ”’
MapUnitFn πŸ”’
MissingGenericTypeVisitableDerive πŸ”’
MultipleSupertraitUpcastable πŸ”’
NegationInfo πŸ”’
NonAsciiIdents πŸ”’
NonCamelCaseTypes πŸ”’
NonLocalDefinitions πŸ”’
NonSnakeCase πŸ”’
NonUpperCaseGlobalGenerator πŸ”’
NonUpperCaseGlobals πŸ”’
NoopMethodCall πŸ”’
OpaqueHiddenInferredBound πŸ”’
OpaqueHiddenInferredBoundLint πŸ”’
PathCollector πŸ”’
Simple hir::Path collector
Precedence πŸ”’
PtrNullChecks πŸ”’
QueryStability πŸ”’
RawBorrowsViaReferences πŸ”’
RedundantSemicolons πŸ”’
RuntimeSymbols πŸ”’
RustcMustMatchExhaustively πŸ”’
StaticMutInfo πŸ”’
StaticMutRefs πŸ”’
SymbolInternStringLiteral πŸ”’
TyTyKind πŸ”’
TypeIr πŸ”’
TypeLimits πŸ”’
UnitBindings πŸ”’
UnqualifiedLocalImports πŸ”’
VariantSizeDifferences πŸ”’

EnumsΒ§

Applicability
Indicates the confidence in the correctness of a suggestion.
ComparisonOp πŸ”’
Level
Setting for how to handle a lint.
PatternKind πŸ”’

ConstantsΒ§

SYNC_GUARD_SYMBOLS πŸ”’

StaticsΒ§

AMBIGUOUS_NEGATIVE_LITERALS πŸ”’
The ambiguous_negative_literals lint checks for cases that are confusing between a negative literal and a negation that’s not part of the literal.
AMBIGUOUS_WIDE_POINTER_COMPARISONS πŸ”’
The ambiguous_wide_pointer_comparisons lint checks comparison of *const/*mut ?Sized as the operands.
BAD_OPT_ACCESS πŸ”’
The bad_opt_access lint detects accessing options by field instead of the wrapper function.
BAD_USE_OF_FIND_ATTR πŸ”’
CONFUSABLE_IDENTS πŸ”’
The confusable_idents lint detects visually confusable pairs between identifiers.
CONST_ITEM_INTERIOR_MUTATIONS πŸ”’
The const_item_interior_mutations lint checks for calls which mutates an interior mutable const-item.
C_VOID_RETURNS πŸ”’
The c_void_returns lint detects the use of core::ffi::c_void as a return type.
DANGEROUS_IMPLICIT_AUTOREFS πŸ”’
The dangerous_implicit_autorefs lint checks for implicitly taken references to dereferences of raw pointers.
DANGLING_POINTERS_FROM_LOCALS πŸ”’
The dangling_pointers_from_locals lint detects getting a pointer to data of a local that will be dropped at the end of the function.
DANGLING_POINTERS_FROM_TEMPORARIES πŸ”’
The dangling_pointers_from_temporaries lint detects getting a pointer to data of a temporary that will immediately get dropped.
DEFAULT_HASH_TYPES πŸ”’
The default_hash_type lint detects use of std::collections::HashMap and std::collections::HashSet, suggesting the use of FxHashMap/FxHashSet.
DEREF_INTO_DYN_SUPERTRAIT πŸ”’
The deref_into_dyn_supertrait lint is emitted whenever there is a Deref implementation for dyn SubTrait with a dyn SuperTrait type as the Output type.
DIRECT_USE_OF_RUSTC_TYPE_IR πŸ”’
The direct_use_of_rustc_type_ir lint detects usage of rustc_type_ir.
DISALLOWED_PASS_BY_REF πŸ”’
The disallowed_pass_by_ref lint detects if types marked with #[rustc_pass_by_value] are passed by reference. Types with this marker are usually thin wrappers around references, so there is no benefit to an extra layer of indirection. (Example: Ty which is a reference to an Interned<TyKind>)
DROPPING_COPY_TYPES πŸ”’
The dropping_copy_types lint checks for calls to std::mem::drop and std::ptr::drop_in_place where the dropped value implements the Copy trait.
DROPPING_REFERENCES πŸ”’
The dropping_references lint checks for calls to std::mem::drop and std::ptr::drop_in_place where the dropped type is a reference instead of an owned value.
DROP_BOUNDS πŸ”’
The drop_bounds lint checks for generics with std::ops::Drop as bounds.
DYN_DROP πŸ”’
The dyn_drop lint checks for trait objects with std::ops::Drop.
EDITION_2024_EXPR_FRAGMENT_SPECIFIER πŸ”’
The edition_2024_expr_fragment_specifier lint detects the use of expr fragments in macros during migration to the 2024 edition.
FORGETTING_COPY_TYPES πŸ”’
The forgetting_copy_types lint checks for calls to std::mem::forget with a value that derives the Copy trait.
FORGETTING_REFERENCES πŸ”’
The forgetting_references lint checks for calls to std::mem::forget with a reference instead of an owned value.
FOR_LOOPS_OVER_FALLIBLES πŸ”’
The for_loops_over_fallibles lint checks for for loops over Option or Result values.
FUNCTION_CASTS_AS_INTEGER πŸ”’
The function_casts_as_integer lint detects cases where a function item is cast to an integer.
IMPLICIT_SYSROOT_CRATE_IMPORT πŸ”’
The implicit_sysroot_crate_import detects use of extern crate to import non-sysroot crates (e.g. crates.io deps) from the sysroot, which is dangerous because these crates are not guaranteed to exist exactly once, and so may be missing entirely or appear multiple times resulting in ambiguity.
IMPROPER_GPU_KERNEL_ARG πŸ”’
The improper_gpu_kernel_arg lint detects incorrect use of types in gpu-kernel arguments.
INVALID_ATOMIC_ORDERING πŸ”’
The invalid_atomic_ordering lint detects passing an Ordering to an atomic operation that does not support that ordering.
INVALID_FROM_UTF8 πŸ”’
The invalid_from_utf8 lint checks for calls to std::str::from_utf8 and std::str::from_utf8_mut with a known invalid UTF-8 value.
INVALID_FROM_UTF8_UNCHECKED πŸ”’
The invalid_from_utf8_unchecked lint checks for calls to std::str::from_utf8_unchecked and std::str::from_utf8_unchecked_mut with a known invalid UTF-8 value.
INVALID_NAN_COMPARISONS πŸ”’
The invalid_nan_comparisons lint checks comparisons with the NAN constants of f16, f32, f64, and f128.
INVALID_NULL_ARGUMENTS πŸ”’
The invalid_null_arguments lint checks for invalid usage of null pointers in arguments.
INVALID_REFERENCE_CASTING πŸ”’
The invalid_reference_casting lint checks for casts of &T to &mut T without using interior mutability.
INVALID_RUNTIME_SYMBOL_DEFINITIONS πŸ”’
The invalid_runtime_symbol_definitions lint checks the signature of items whose symbol name is a runtime symbol expected by core or std differs significantly from the expected signature (like mismatch ABI, mismatch C variadics, mismatch argument count, missing return type, …).
LET_UNDERSCORE_DROP πŸ”’
The let_underscore_drop lint checks for statements which don’t bind an expression which has a non-trivial Drop implementation to anything, causing the expression to be dropped immediately instead of at end of scope.
LET_UNDERSCORE_DROP_GUARD πŸ”’
The let_underscore_drop_guard lint checks for statements which don’t bind a DropGuard to anything, causing its closure to run immediately instead of at end of scope, which is typically incorrect.
LET_UNDERSCORE_LOCK πŸ”’
The let_underscore_lock lint checks for statements which don’t bind a mutex to anything, causing the lock to be released immediately instead of at end of scope, which is typically incorrect.
LINT_PASS_IMPL_WITHOUT_MACRO πŸ”’
The lint_pass_impl_without_macro detects manual implementations of a lint pass, without using declare_lint_pass or [impl_lint_pass].
MAP_UNIT_FN πŸ”’
The map_unit_fn lint checks for Iterator::map receive a callable that returns ().
MISSING_GENERIC_TYPE_VISITABLE_DERIVE πŸ”’
The missing_generic_type_visitable_derive lint detects types implementing TypeVisitable but not deriving GenericTypeVisitable.
MISSING_GPU_KERNEL_EXPORT_NAME πŸ”’
The missing_gpu_kernel_export_name lint detects gpu-kernel functions that have a mangled name.
MIXED_SCRIPT_CONFUSABLES πŸ”’
The mixed_script_confusables lint detects visually confusable characters in identifiers between different scripts.
MULTIPLE_SUPERTRAIT_UPCASTABLE πŸ”’
The multiple_supertrait_upcastable lint detects when a dyn-compatible trait has multiple supertraits.
NON_ASCII_IDENTS πŸ”’
The non_ascii_idents lint detects non-ASCII identifiers.
NON_CAMEL_CASE_TYPES πŸ”’
The non_camel_case_types lint detects types, variants, traits and type parameters that don’t have camel case names.
NON_GLOB_IMPORT_OF_TYPE_IR_INHERENT πŸ”’
The non_glob_import_of_type_ir_inherent_item lint detects non-glob imports of module rustc_type_ir::inherent.
NON_LOCAL_DEFINITIONS πŸ”’
The non_local_definitions lint checks for impl blocks and #[macro_export] macro inside bodies (functions, enum discriminant, …).
NON_SNAKE_CASE πŸ”’
The non_snake_case lint detects variables, methods, functions, lifetime parameters, named fields and modules that don’t have snake case names.
NON_UPPER_CASE_GLOBALS πŸ”’
The non_upper_case_globals lint detects static items that don’t have uppercase identifiers.
NOOP_METHOD_CALL πŸ”’
The noop_method_call lint detects specific calls to noop methods such as a calling <&T as Clone>::clone where T: !Clone.
OPAQUE_HIDDEN_INFERRED_BOUND πŸ”’
The opaque_hidden_inferred_bound lint detects cases in which nested impl Trait in associated type bounds are not written generally enough to satisfy the bounds of the associated type.
OVERFLOWING_LITERALS πŸ”’
The overflowing_literals lint detects literals out of range for their type.
POTENTIAL_QUERY_INSTABILITY πŸ”’
The potential_query_instability lint detects use of methods which can lead to potential query instability, such as iterating over a HashMap.
RAW_BORROWS_VIA_REFERENCES πŸ”’
The raw_borrows_via_references lint checks for references that decay immediately into raw borrows.
REDUNDANT_SEMICOLONS πŸ”’
The redundant_semicolons lint detects unnecessary trailing semicolons.
RUSTC_MUST_MATCH_EXHAUSTIVELY πŸ”’
STATIC_MUT_REFS πŸ”’
The static_mut_refs lint checks for shared or mutable references of mutable static inside unsafe blocks and unsafe functions.
SUSPICIOUS_DOUBLE_REF_OP πŸ”’
The suspicious_double_ref_op lint checks for usage of .clone()/.borrow()/.deref() on an &&T when T: !Deref/Borrow/Clone, which means the call will return the inner &T, instead of performing the operation on the underlying T and can be confusing.
SUSPICIOUS_RUNTIME_SYMBOL_DEFINITIONS πŸ”’
The suspicious_runtime_symbol_definitions lint checks the signature of items whose symbol name is a runtime symbol expected by core or std.
SYMBOL_INTERN_STRING_LITERAL πŸ”’
The symbol_intern_string_literal lint detects Symbol::intern or Ident::from_str_and_span being called on a string literal
UNCOMMON_CODEPOINTS πŸ”’
The uncommon_codepoints lint detects uncommon Unicode codepoints in identifiers.
UNDROPPED_MANUALLY_DROPS πŸ”’
The undropped_manually_drops lint check for calls to std::mem::drop and std::ptr::drop_in_place where the dropped value is std::mem::ManuallyDrop which doesn’t drop.
UNIT_BINDINGS πŸ”’
The unit_bindings lint detects cases where bindings are useless because they have the unit type () as their inferred type. The lint is suppressed if the user explicitly annotates the let binding with the unit type (), or if the let binding uses an underscore wildcard pattern, i.e. let _ = expr, or if the binding is produced from macro expansions.
UNPREDICTABLE_FUNCTION_POINTER_COMPARISONS πŸ”’
The unpredictable_function_pointer_comparisons lint checks comparison of function pointer as the operands.
UNQUALIFIED_LOCAL_IMPORTS πŸ”’
The unqualified_local_imports lint checks for use items that import a local item using a path that does not start with self::, super::, or crate::.
UNTRACKED_QUERY_INFORMATION πŸ”’
The untracked_query_information lint detects use of methods which leak information not tracked by the query system, such as whether a Steal<T> value has already been stolen. In order not to break incremental compilation, such methods must be used very carefully or not at all.
UNUSED_COMPARISONS πŸ”’
The unused_comparisons lint detects comparisons made useless by limits of the types involved.
USAGE_OF_QUALIFIED_TY πŸ”’
The usage_of_qualified_ty lint detects usages of ty::TyKind, where Ty should be used instead.
USAGE_OF_TYPE_IR_INHERENT πŸ”’
The usage_of_type_ir_inherent lint detects usage of rustc_type_ir::inherent.
USAGE_OF_TYPE_IR_TRAITS πŸ”’
The usage_of_type_ir_traits lint detects usage of rustc_type_ir::Interner, or rustc_infer::InferCtxtLike.
USAGE_OF_TY_TYKIND πŸ”’
The usage_of_ty_tykind lint detects usages of ty::TyKind::<kind>, where ty::<kind> would suffice.
USELESS_PTR_NULL_CHECKS πŸ”’
The useless_ptr_null_checks lint checks for useless null checks against pointers obtained from non-null types.
VARIANT_SIZE_DIFFERENCES πŸ”’
The variant_size_differences lint detects enums with widely varying variant sizes.

TraitsΒ§

LintPass

FunctionsΒ§

borrow_or_assign πŸ”’
changes_when_titlecased πŸ”’
FIXME: we should add a more efficient version in the stdlib for this
char_has_case πŸ”’
Some unicode characters have case, are considered upper, title, or lower case, but they can’t be title cased or lower cased. For the purposes of the lint suggestion, we care about being able to change the char’s case.
check πŸ”’
check_decl πŸ”’
check_fn πŸ”’
check_static πŸ”’
did_has_local_parent πŸ”’
Given a def id this checks if the parent def id (modulo modules) correspond to the def id of the parent impl definition (the direct one and the outermost one).
emit_static_mut_refs πŸ”’
extend_trailing_space πŸ”’
extract_for_loop πŸ”’
extract_iterator_next_call πŸ”’
find_word πŸ”’
gen_args πŸ”’
gen_args πŸ”’
get_callee_span_generic_args_and_args πŸ”’
Checks whether an expression is a function or method call and, if so, returns its DefId, Span, GenericArgs, and arguments. This is a slight augmentation of a similarly named Clippy function, get_callee_generic_args_and_args.
get_nullable_type πŸ”’
Given a non-null scalar (or transparent) type ty, return the nullable version of that type. If the type passed in was not scalar, returns None.
get_nullable_type_from_pat πŸ”’
has_implicit_borrow πŸ”’
Test if some adjustment has some implicit borrow.
has_unstable_into_iter_predicate πŸ”’
interior_mutability_suggestion πŸ”’
is_cast_to_bigger_memory_layout πŸ”’
is_ident_char πŸ”’
is_impl_slice πŸ”’
is_invalid_cast_from_ref_to_mut_ptr πŸ”’
is_lint_pass_required
Is a pass (which contains lints) required to run? Maybe not, e.g. for dependencies built with --cap-lints=allow.
is_niche_optimization_candidate πŸ”’
A type is niche-optimization candidate iff:
is_null_ptr πŸ”’
Checks if the given expression is a null pointer (modulo casting)
is_rustc_must_match_exhaustively πŸ”’
is_single_call_in_arm πŸ”’
is_temporary_rvalue πŸ”’
is_ty_fully_unsafe_celled πŸ”’
Checks that a Ty fully covered by one or more UnsafeCell.
is_ty_or_ty_ctxt πŸ”’
is_upper_camel_case πŸ”’
lint_addr_of_local πŸ”’
Look for &<path_to_local_in_same_body> pattern and emit lint for it
lint_expr πŸ”’
lint_fn_pointer πŸ”’
lint_mod πŸ”’
lint_nan πŸ”’
lint_ty_kind_usage πŸ”’
lint_wide_pointer πŸ”’
maybe_lint_redundant_semis πŸ”’
new_lint_store
nonnull_optimization_guaranteed πŸ”’
not_camel_case πŸ”’
owns_allocation πŸ”’
pat_is_not_exhaustive_heuristic πŸ”’
pat_ty_is_known_nonnull πŸ”’
path_for_rustc_pass_by_value πŸ”’
path_has_local_parent πŸ”’
Given a path, this checks if the if the parent resolution def id corresponds to the def id of the parent impl definition (the direct one and the outermost one).
path_is_static_mut πŸ”’
path_name_to_string πŸ”’
Return a β€œerror message-able” ident for the last segment of the Path
path_span_without_args πŸ”’
Return for a given Path the span until the last args
peel_derefs_adjustments πŸ”’
Peel derefs adjustments until the last last element.
peel_parent_while πŸ”’
Given a DefId checks if it satisfies f if it does check with it’s parent and continue until it doesn’t satisfies f and return the last DefId checked.
peel_place_mappers πŸ”’
Peels expressions from expr that can map a place.
provide
register_builtins πŸ”’
Tell the LintStore about all the built-in lints (the ones defined in this crate and the ones defined in rustc_lint_defs::builtin).
register_internals πŸ”’
repr_nullable_ptr πŸ”’
Check if this enum can be safely exported based on the β€œnullable pointer optimization”. If it can, return the type that ty can be safely converted to, otherwise return None. Currently restricted to function pointers, boxes, references, core::num::NonZero, core::ptr::NonNull, and #[repr(transparent)] newtypes.
static_mutability_span πŸ”’
suggest_question_mark πŸ”’
to_upper_camel_case πŸ”’
transparent_newtype_field πŸ”’
repr(transparent) structs can have a single non-1-ZST field, this function returns that field.
ty_is_known_nonnull πŸ”’
Is type known to be non-null?
useless_check πŸ”’
This function checks if the expression is from a series of consecutive casts, i.e. (my_fn as *const _ as *mut _).cast_mut() and whether the original expression is either a fn ptr, a reference, or a function call whose definition is annotated with #[lint::never_returns_null_ptr]. If this situation is present, the function returns the appropriate diagnostic.

Type AliasesΒ§

LintVec