We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3e1fa17 commit a32efd0Copy full SHA for a32efd0
utils/zerovec/src/zerovec/mod.rs
@@ -257,7 +257,9 @@ where
257
/// `bytes` need to be an output from [`ZeroSlice::as_bytes()`].
258
pub const unsafe fn from_bytes_unchecked(bytes: &'a [u8]) -> Self {
259
// &[u8] and &[T::ULE] are the same slice with different length metadata.
260
- let (data, mut metadata): (usize, usize) = core::mem::transmute(bytes);
+ // 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();
263
metadata /= core::mem::size_of::<T::ULE>();
264
Self::Borrowed(core::mem::transmute((data, metadata)))
265
}
0 commit comments