rustc_lint::types

Function repr_nullable_ptr

Source
pub(crate) fn repr_nullable_ptr<'tcx>(
    tcx: TyCtxt<'tcx>,
    typing_env: TypingEnv<'tcx>,
    ty: Ty<'tcx>,
    ckind: CItemKind,
) -> Option<Ty<'tcx>>
Expand description

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.