Function maybe_is_aligned

Source
pub(crate) const fn maybe_is_aligned(ptr: *const (), align: usize) -> bool
🔬This is a nightly-only experimental API. (ub_checks)
Expand description

Checks whether ptr is properly aligned with respect to the given alignment.

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.