Skip to main content Module types Copy item path Source use std::iter ; π use rustc_abi::BackendRepr ; π use rustc_abi::TagEncoding ; π use rustc_abi::Variants ; π use rustc_abi::WrappingRange ; π use rustc_ast as ast; π use rustc_ast::util::parser::ExprPrecedence ; π use rustc_attr_ir::find_attr ; π use rustc_attr_ir::lang_items::LangItem ; π use rustc_hir as hir; π use rustc_hir::Expr ; π use rustc_hir::ExprKind ; π use rustc_hir::HirId ; π use rustc_lint_defs::declare_lint ; π use rustc_lint_defs::declare_lint_pass ; π use rustc_lint_defs::impl_lint_pass ; π use rustc_middle::ty::layout::LayoutOf ; π use rustc_middle::ty::layout::SizeSkeleton ; π use rustc_middle::ty ; π use rustc_middle::ty::Ty ; π use rustc_middle::ty::TyCtxt ; π use rustc_middle::ty::TypeVisitableExt ; π use rustc_middle::ty::Unnormalized ; π use rustc_span::DUMMY_SP ; π use rustc_span::Span ; π use rustc_span::Symbol ; π use rustc_span::bug ; π use rustc_span::sym ; π use tracing::debug ; π pub(crate) use improper_ctypes::ImproperCTypesLint ; π use crate::diagnostics::AmbiguousWidePointerComparisons ; π use crate::diagnostics::AmbiguousWidePointerComparisonsAddrMetadataSuggestion ; π use crate::diagnostics::AmbiguousWidePointerComparisonsAddrSuggestion ; π use crate::diagnostics::AmbiguousWidePointerComparisonsCastSuggestion ; π use crate::diagnostics::AmbiguousWidePointerComparisonsExpectSuggestion ; π use crate::diagnostics::AtomicOrderingFence ; π use crate::diagnostics::AtomicOrderingLoad ; π use crate::diagnostics::AtomicOrderingStore ; π use crate::diagnostics::InvalidAtomicOrderingDiag ; π use crate::diagnostics::InvalidNanComparisons ; π use crate::diagnostics::InvalidNanComparisonsSuggestion ; π use crate::diagnostics::UnpredictableFunctionPointerComparisons ; π use crate::diagnostics::UnpredictableFunctionPointerComparisonsSuggestion ; π use crate::diagnostics::UnusedComparisons ; π use crate::diagnostics::VariantSizeDifferencesDiag ; π use crate::utils::std_or_core ; π use crate::LateContext ; π use crate::LateLintPass ; π use crate::LintContext ; π use literal::int_ty_range ; π use literal::lint_literal ; π use literal::uint_ty_range ; π improper_ctypes π literal π InvalidAtomicOrdering NegationInfo π TypeLimits π VariantSizeDifferences ComparisonOp π AMBIGUOUS_WIDE_POINTER_COMPARISONS π The ambiguous_wide_pointer_comparisons lint checks comparison
of *const/*mut ?Sized as the operands. INVALID_ATOMIC_ORDERING π The invalid_atomic_ordering lint detects passing an Ordering
to an atomic operation that does not support that ordering. INVALID_NAN_COMPARISONS π The invalid_nan_comparisons lint checks comparisons with the NAN constants
of f16, f32, f64, and f128. OVERFLOWING_LITERALS π The overflowing_literals lint detects literals out of range for their type. UNPREDICTABLE_FUNCTION_POINTER_COMPARISONS π The unpredictable_function_pointer_comparisons lint checks comparison
of function pointer as the operands. UNUSED_COMPARISONS π The unused_comparisons lint detects comparisons made useless by
limits of the types involved. VARIANT_SIZE_DIFFERENCES π The variant_size_differences lint detects enums with widely varying
variant sizes. 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 π is_niche_optimization_candidate π A type is niche-optimization candidate iff: lint_fn_pointer π lint_nan π lint_wide_pointer π nonnull_optimization_guaranteed π pat_ty_is_known_nonnull π 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. 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?