Skip to content

Commit c231e8a

Browse files
committed
Swap usize -> ptr transmute for strict_pov API
This is the only such conversion left in `alloc`. Didn't trip the `fuzzy_provenance_casts` lint because it's a transmute.
1 parent 394983d commit c231e8a

File tree

1 file changed

+1
-1
lines changed
  • library/alloc/src/raw_vec

1 file changed

+1
-1
lines changed

library/alloc/src/raw_vec/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ impl<A: Allocator> RawVecInner<A> {
411411
#[inline]
412412
const fn new_in(alloc: A, align: Alignment) -> Self {
413413
// SAFETY: `Alignment` is non-zero.
414-
let ptr = unsafe { core::mem::transmute(align) };
414+
let ptr = unsafe { Unique::new_unchecked(ptr::without_provenance_mut(align.as_usize())) };
415415
// `cap: 0` means "unallocated". zero-sized types are ignored.
416416
Self { ptr, cap: ZERO_CAP, alloc }
417417
}

0 commit comments

Comments
 (0)