File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -1590,9 +1590,8 @@ pub unsafe fn write_volatile<T>(dst: *mut T, src: T) {
1590
1590
/// than trying to adapt this to accommodate that change.
1591
1591
///
1592
1592
/// Any questions go to @nagisa.
1593
- // #[cfg(not(bootstrap))] -- Calling this function in a const context from the bootstrap
1594
- // compiler will always cause an error.
1595
1593
#[ lang = "align_offset" ]
1594
+ #[ rustc_do_not_const_check] // hooked by const-eval
1596
1595
pub ( crate ) const unsafe fn align_offset < T : Sized > ( p : * const T , a : usize ) -> usize {
1597
1596
// FIXME(#75598): Direct use of these intrinsics improves codegen significantly at opt-level <=
1598
1597
// 1, where the method versions of these operations are not inlined.
@@ -1652,13 +1651,9 @@ pub(crate) const unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usiz
1652
1651
inverse & m_minus_one
1653
1652
}
1654
1653
1654
+ let addr = p. addr ( ) ;
1655
1655
let stride = mem:: size_of :: < T > ( ) ;
1656
1656
1657
- // SAFETY: At runtime transmuting a pointer to `usize` is always safe, because they have the
1658
- // same layout. During const eval we hook this function to ensure that the pointer always has
1659
- // an address (only the standard library can do this).
1660
- let addr = unsafe { mem:: transmute ( p) } ;
1661
-
1662
1657
// SAFETY: `a` is a power-of-two, therefore non-zero.
1663
1658
let a_minus_one = unsafe { unchecked_sub ( a, 1 ) } ;
1664
1659
You can’t perform that action at this time.
0 commit comments