Function rustc_lint::types::repr_nullable_ptr
source · pub(crate) fn repr_nullable_ptr<'tcx>(
tcx: TyCtxt<'tcx>,
param_env: ParamEnv<'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.
FIXME: This duplicates code in codegen.