File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 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
16521652
16531653 let stride = mem:: size_of :: < T > ( ) ;
16541654
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.
16581659 let addr: usize = unsafe { mem:: transmute ( p) } ;
16591660
16601661 // SAFETY: `a` is a power-of-two, therefore non-zero.
You can’t perform that action at this time.
0 commit comments