@@ -2331,14 +2331,17 @@ macro_rules! int_impl {
23312331 /// ```
23322332 #[ stable( feature = "int_log" , since = "1.67.0" ) ]
23332333 #[ rustc_const_stable( feature = "int_log" , since = "1.67.0" ) ]
2334- #[ rustc_allow_const_fn_unstable( const_option) ]
23352334 #[ must_use = "this returns the result of the operation, \
23362335 without modifying the original"]
23372336 #[ inline]
23382337 #[ track_caller]
23392338 pub const fn ilog( self , base: Self ) -> u32 {
23402339 assert!( base >= 2 , "base of integer logarithm must be at least 2" ) ;
2341- self . checked_ilog( base) . expect( "argument of integer logarithm must be positive" )
2340+ if let Some ( log) = self . checked_ilog( base) {
2341+ log
2342+ } else {
2343+ int_log10:: panic_for_nonpositive_argument( )
2344+ }
23422345 }
23432346
23442347 /// Returns the base 2 logarithm of the number, rounded down.
@@ -2354,13 +2357,16 @@ macro_rules! int_impl {
23542357 /// ```
23552358 #[ stable( feature = "int_log" , since = "1.67.0" ) ]
23562359 #[ rustc_const_stable( feature = "int_log" , since = "1.67.0" ) ]
2357- #[ rustc_allow_const_fn_unstable( const_option) ]
23582360 #[ must_use = "this returns the result of the operation, \
23592361 without modifying the original"]
23602362 #[ inline]
23612363 #[ track_caller]
23622364 pub const fn ilog2( self ) -> u32 {
2363- self . checked_ilog2( ) . expect( "argument of integer logarithm must be positive" )
2365+ if let Some ( log) = self . checked_ilog2( ) {
2366+ log
2367+ } else {
2368+ int_log10:: panic_for_nonpositive_argument( )
2369+ }
23642370 }
23652371
23662372 /// Returns the base 10 logarithm of the number, rounded down.
@@ -2376,13 +2382,16 @@ macro_rules! int_impl {
23762382 /// ```
23772383 #[ stable( feature = "int_log" , since = "1.67.0" ) ]
23782384 #[ rustc_const_stable( feature = "int_log" , since = "1.67.0" ) ]
2379- #[ rustc_allow_const_fn_unstable( const_option) ]
23802385 #[ must_use = "this returns the result of the operation, \
23812386 without modifying the original"]
23822387 #[ inline]
23832388 #[ track_caller]
23842389 pub const fn ilog10( self ) -> u32 {
2385- self . checked_ilog10( ) . expect( "argument of integer logarithm must be positive" )
2390+ if let Some ( log) = self . checked_ilog10( ) {
2391+ log
2392+ } else {
2393+ int_log10:: panic_for_nonpositive_argument( )
2394+ }
23862395 }
23872396
23882397 /// Returns the logarithm of the number with respect to an arbitrary base,
0 commit comments