Skip to content

Commit a32efd0

Browse files
authored
Avoid regression (#2286)
1 parent 3e1fa17 commit a32efd0

File tree

1 file changed

+3
-1
lines changed
  • utils/zerovec/src/zerovec

1 file changed

+3
-1
lines changed

utils/zerovec/src/zerovec/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ where
257257
/// `bytes` need to be an output from [`ZeroSlice::as_bytes()`].
258258
pub const unsafe fn from_bytes_unchecked(bytes: &'a [u8]) -> Self {
259259
// &[u8] and &[T::ULE] are the same slice with different length metadata.
260-
let (data, mut metadata): (usize, usize) = core::mem::transmute(bytes);
260+
// n.b. be careful here, this might hit https://github.com/rust-lang/rust/issues/99923
261+
let data = bytes.as_ptr();
262+
let mut metadata = bytes.len();
261263
metadata /= core::mem::size_of::<T::ULE>();
262264
Self::Borrowed(core::mem::transmute((data, metadata)))
263265
}

0 commit comments

Comments
 (0)