Skip to content

Commit 3f04fd5

Browse files
Delegate to transpose
1 parent bd960c9 commit 3f04fd5

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

library/core/src/mem/maybe_uninit.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,8 +1456,7 @@ impl<T, const N: usize> MaybeUninit<[T; N]> {
14561456
impl<T, const N: usize> From<[MaybeUninit<T>; N]> for MaybeUninit<[T; N]> {
14571457
#[inline(always)]
14581458
fn from(arr: [MaybeUninit<T>; N]) -> Self {
1459-
// SAFETY: T and MaybeUninit<T> have the same layout
1460-
unsafe { intrinsics::transmute_unchecked(arr) }
1459+
arr.transpose()
14611460
}
14621461
}
14631462

@@ -1499,8 +1498,7 @@ impl<T, const N: usize> AsMut<[MaybeUninit<T>]> for MaybeUninit<[T; N]> {
14991498
impl<T, const N: usize> From<MaybeUninit<[T; N]>> for [MaybeUninit<T>; N] {
15001499
#[inline(always)]
15011500
fn from(arr: MaybeUninit<[T; N]>) -> Self {
1502-
// SAFETY: T and MaybeUninit<T> have the same layout
1503-
unsafe { intrinsics::transmute_unchecked(arr) }
1501+
arr.transpose()
15041502
}
15051503
}
15061504

0 commit comments

Comments
 (0)