@@ -1377,8 +1377,7 @@ macro_rules! int_impl {
13771377 #[ rustc_allow_const_fn_unstable( is_val_statically_known, const_int_unchecked_arith) ]
13781378 #[ inline]
13791379 pub const fn checked_pow( self , mut exp: u32 ) -> Option <Self > {
1380- // SAFETY: This path has the same behavior as the other.
1381- if unsafe { intrinsics:: is_val_statically_known( self ) }
1380+ if intrinsics:: is_val_statically_known( self )
13821381 && self . unsigned_abs( ) . is_power_of_two( )
13831382 {
13841383 if self == 1 { // Avoid divide by zero
@@ -2094,8 +2093,7 @@ macro_rules! int_impl {
20942093 #[ rustc_allow_const_fn_unstable( is_val_statically_known, const_int_unchecked_arith) ]
20952094 #[ inline]
20962095 pub const fn wrapping_pow( self , mut exp: u32 ) -> Self {
2097- // SAFETY: This path has the same behavior as the other.
2098- if unsafe { intrinsics:: is_val_statically_known( self ) }
2096+ if intrinsics:: is_val_statically_known( self )
20992097 && self . unsigned_abs( ) . is_power_of_two( )
21002098 {
21012099 if self == 1 { // Avoid divide by zero
@@ -2628,8 +2626,7 @@ macro_rules! int_impl {
26282626 #[ rustc_allow_const_fn_unstable( is_val_statically_known, const_int_unchecked_arith) ]
26292627 #[ inline]
26302628 pub const fn overflowing_pow( self , mut exp: u32 ) -> ( Self , bool ) {
2631- // SAFETY: This path has the same behavior as the other.
2632- if unsafe { intrinsics:: is_val_statically_known( self ) }
2629+ if intrinsics:: is_val_statically_known( self )
26332630 && self . unsigned_abs( ) . is_power_of_two( )
26342631 {
26352632 if self == 1 { // Avoid divide by zero
@@ -2709,8 +2706,7 @@ macro_rules! int_impl {
27092706 #[ rustc_inherit_overflow_checks]
27102707 #[ track_caller] // Hides the hackish overflow check for powers of two.
27112708 pub const fn pow( self , mut exp: u32 ) -> Self {
2712- // SAFETY: This path has the same behavior as the other.
2713- if unsafe { intrinsics:: is_val_statically_known( self ) }
2709+ if intrinsics:: is_val_statically_known( self )
27142710 && self . unsigned_abs( ) . is_power_of_two( )
27152711 {
27162712 if self == 1 { // Avoid divide by zero
0 commit comments