Skip to content

Commit 165cdef

Browse files
author
lif
committed
oversight - elements of slice are aligned too
1 parent 05d064d commit 165cdef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl<const N: usize> Align4<[u8; N]> {
160160
#[must_use]
161161
pub const fn as_slice<T: Sized>(&self) -> &[T] {
162162
const {
163-
assert!(N % size_of::<T>() == 0);
163+
assert!(N % (size_of::<T>() + (size_of::<T>() % align_of::<T>())) == 0);
164164
assert!(
165165
align_of::<T>() == 4 || align_of::<T>() == 2 || align_of::<T>() == 1
166166
);

0 commit comments

Comments
 (0)