diff --git a/src/librustc_data_structures/indexed_set.rs b/src/librustc_data_structures/indexed_set.rs index 2e95a45479c4..46d6c65101a7 100644 --- a/src/librustc_data_structures/indexed_set.rs +++ b/src/librustc_data_structures/indexed_set.rs @@ -59,10 +59,6 @@ impl rustc_serialize::Decodable for IdxSetBuf { // pnkfelix wants to have this be `IdxSet([Word]) and then pass // around `&mut IdxSet` or `&IdxSet`. -// -// WARNING: Mapping a `&IdxSetBuf` to `&IdxSet` (at least today) -// requires a transmute relying on representation guarantees that may -// not hold in the future. /// Represents a set (or packed family of sets), of some element type /// E, where each E is identified by some unique index type `T`. @@ -134,11 +130,11 @@ impl IdxSetBuf { impl IdxSet { unsafe fn from_slice(s: &[Word]) -> &Self { - mem::transmute(s) // (see above WARNING) + &*(s as *const [Word] as *const Self) } unsafe fn from_slice_mut(s: &mut [Word]) -> &mut Self { - mem::transmute(s) // (see above WARNING) + &mut *(s as *mut [Word] as *mut Self) } }