File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -1652,9 +1652,10 @@ pub(crate) const unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usiz
1652
1652
1653
1653
let stride = mem:: size_of :: < T > ( ) ;
1654
1654
1655
- // SAFETY: At runtime, transmuting a pointer to `usize` is always safe, because they have the
1656
- // same layout. During const eval, we hook this function to ensure that the pointer always has
1657
- // an address (only the standard library can do this).
1655
+ // SAFETY: This is just an inlined `p.addr()` (which is not
1656
+ // a `const fn` so we cannot call it).
1657
+ // During const eval, we hook this function to ensure that the pointer never
1658
+ // has provenance, making this sound.
1658
1659
let addr: usize = unsafe { mem:: transmute ( p) } ;
1659
1660
1660
1661
// SAFETY: `a` is a power-of-two, therefore non-zero.
You can’t perform that action at this time.
0 commit comments