File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -109,15 +109,15 @@ pub(crate) const fn check_language_ub() -> bool {
109109 intrinsics:: ub_checks ( ) && const_eval_select ( ( ) , comptime, runtime)
110110}
111111
112- /// Checks whether `ptr` is properly aligned with respect to
113- /// `align_of::<T>()` .
112+ /// Checks whether `ptr` is properly aligned with respect to the given alignment, and
113+ /// if `is_zst == false`, that `ptr` is not null .
114114///
115115/// In `const` this is approximate and can fail spuriously. It is primarily intended
116116/// for `assert_unsafe_precondition!` with `check_language_ub`, in which case the
117117/// check is anyway not executed in `const`.
118118#[ inline]
119119pub ( crate ) const fn is_aligned_and_not_null ( ptr : * const ( ) , align : usize , is_zst : bool ) -> bool {
120- if is_zst { ptr. is_aligned_to ( align) } else { !ptr. is_null ( ) && ptr . is_aligned_to ( align ) }
120+ ptr. is_aligned_to ( align) && ( is_zst || !ptr. is_null ( ) )
121121}
122122
123123#[ inline]
You can’t perform that action at this time.
0 commit comments