pub(crate) const fn maybe_is_aligned_and_not_null(
ptr: *const (),
align: usize,
is_zst: bool,
) -> bool
🔬This is a nightly-only experimental API. (
ub_checks
)Expand description
Checks whether ptr
is properly aligned with respect to the given alignment, and
if is_zst == false
, that ptr
is not null.
In const
this is approximate and can fail spuriously. It is primarily intended
for assert_unsafe_precondition!
with check_language_ub
, in which case the
check is anyway not executed in const
.