Skip to content

Commit

Permalink
fn DisjointMutArcSlice::from_iter: Use inline const {} block to r…
Browse files Browse the repository at this point in the history
…emove warning about dummy type.
  • Loading branch information
kkysen committed Sep 24, 2024
1 parent b880410 commit e063c90
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/disjoint_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1195,9 +1195,11 @@ impl<T> FromIterator<T> for DisjointMutArcSlice<T> {
let arc_slice = iter.into_iter().collect::<Arc<[_]>>();

// Do our best to check that `DisjointMut` is in fact `#[repr(transparent)]`.
type A = Vec<u8>; // Some concrete sized type.
const _: () = assert!(mem::size_of::<DisjointMut<A>>() == mem::size_of::<A>());
const _: () = assert!(mem::align_of::<DisjointMut<A>>() == mem::align_of::<A>());
const {
type A = Vec<u8>; // Some concrete sized type.
assert!(mem::size_of::<DisjointMut<A>>() == mem::size_of::<A>());
assert!(mem::align_of::<DisjointMut<A>>() == mem::align_of::<A>());
}

// SAFETY: When `#[cfg(not(debug_assertions))]`, `DisjointMut` is `#[repr(transparent)]`,
// containing only an `UnsafeCell`, which is also `#[repr(transparent)]`.
Expand Down

0 comments on commit e063c90

Please sign in to comment.