diff --git a/src/disjoint_mut.rs b/src/disjoint_mut.rs index ea3e65f50..6af7985e5 100644 --- a/src/disjoint_mut.rs +++ b/src/disjoint_mut.rs @@ -1195,13 +1195,15 @@ impl FromIterator for DisjointMutArcSlice { let arc_slice = iter.into_iter().collect::>(); // Do our best to check that `DisjointMut` is in fact `#[repr(transparent)]`. - type A = Vec; // Some concrete sized type. - const _: () = assert!(mem::size_of::>() == mem::size_of::()); - const _: () = assert!(mem::align_of::>() == mem::align_of::()); + const { + type A = Vec; // Some concrete sized type. + assert!(mem::size_of::>() == mem::size_of::()); + assert!(mem::align_of::>() == mem::align_of::()); + } // SAFETY: When `#[cfg(not(debug_assertions))]`, `DisjointMut` is `#[repr(transparent)]`, // containing only an `UnsafeCell`, which is also `#[repr(transparent)]`. - unsafe { mem::transmute::, Arc>>(arc_slice) } + unsafe { Arc::from_raw(Arc::into_raw(arc_slice) as *const DisjointMut<[_]>) } }; Self { inner } }