We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 394983d commit c231e8aCopy full SHA for c231e8a
library/alloc/src/raw_vec/mod.rs
@@ -411,7 +411,7 @@ impl<A: Allocator> RawVecInner<A> {
411
#[inline]
412
const fn new_in(alloc: A, align: Alignment) -> Self {
413
// SAFETY: `Alignment` is non-zero.
414
- let ptr = unsafe { core::mem::transmute(align) };
+ let ptr = unsafe { Unique::new_unchecked(ptr::without_provenance_mut(align.as_usize())) };
415
// `cap: 0` means "unallocated". zero-sized types are ignored.
416
Self { ptr, cap: ZERO_CAP, alloc }
417
}
0 commit comments