Skip to content

Commit 82e197b

Browse files
committed
refactor: deduplicate maybe_is_aligned impl
1 parent aa975c6 commit 82e197b

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

library/core/src/ub_checks.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,7 @@ pub(crate) const fn maybe_is_aligned_and_not_null(
119119
is_zst: bool,
120120
) -> bool {
121121
// This is just for safety checks so we can const_eval_select.
122-
const_eval_select!(
123-
@capture { ptr: *const (), align: usize, is_zst: bool } -> bool:
124-
if const {
125-
is_zst || !ptr.is_null()
126-
} else {
127-
ptr.is_aligned_to(align) && (is_zst || !ptr.is_null())
128-
}
129-
)
122+
maybe_is_aligned(ptr, align) && (is_zst || !ptr.is_null())
130123
}
131124

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

0 commit comments

Comments
 (0)