@@ -336,7 +336,7 @@ $EndFeature, "
336
336
Basic usage:
337
337
338
338
```
339
- " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::max_value() .count_zeros(), 1);" , $EndFeature, "
339
+ " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::MAX .count_zeros(), 1);" , $EndFeature, "
340
340
```" ) ,
341
341
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
342
342
#[ rustc_const_stable( feature = "const_int_methods" , since = "1.32.0" ) ]
@@ -673,8 +673,8 @@ Basic usage:
673
673
674
674
```
675
675
" , $Feature, "assert_eq!((" , stringify!( $SelfT) ,
676
- "::max_value() - 2).checked_add(1), Some(" , stringify!( $SelfT) , "::max_value() - 1));
677
- assert_eq!((" , stringify!( $SelfT) , "::max_value() - 2).checked_add(3), None);" ,
676
+ "::MAX - 2).checked_add(1), Some(" , stringify!( $SelfT) , "::MAX - 1));
677
+ assert_eq!((" , stringify!( $SelfT) , "::MAX - 2).checked_add(3), None);" ,
678
678
$EndFeature, "
679
679
```" ) ,
680
680
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -698,8 +698,8 @@ Basic usage:
698
698
699
699
```
700
700
" , $Feature, "assert_eq!((" , stringify!( $SelfT) ,
701
- "::min_value() + 2).checked_sub(1), Some(" , stringify!( $SelfT) , "::min_value() + 1));
702
- assert_eq!((" , stringify!( $SelfT) , "::min_value() + 2).checked_sub(3), None);" ,
701
+ "::MIN + 2).checked_sub(1), Some(" , stringify!( $SelfT) , "::MIN + 1));
702
+ assert_eq!((" , stringify!( $SelfT) , "::MIN + 2).checked_sub(3), None);" ,
703
703
$EndFeature, "
704
704
```" ) ,
705
705
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -723,8 +723,8 @@ Basic usage:
723
723
724
724
```
725
725
" , $Feature, "assert_eq!(" , stringify!( $SelfT) ,
726
- "::max_value() .checked_mul(1), Some(" , stringify!( $SelfT) , "::max_value() ));
727
- assert_eq!(" , stringify!( $SelfT) , "::max_value() .checked_mul(2), None);" ,
726
+ "::MAX .checked_mul(1), Some(" , stringify!( $SelfT) , "::MAX ));
727
+ assert_eq!(" , stringify!( $SelfT) , "::MAX .checked_mul(2), None);" ,
728
728
$EndFeature, "
729
729
```" ) ,
730
730
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -748,8 +748,8 @@ Basic usage:
748
748
749
749
```
750
750
" , $Feature, "assert_eq!((" , stringify!( $SelfT) ,
751
- "::min_value() + 1).checked_div(-1), Some(" , stringify!( $Max) , "));
752
- assert_eq!(" , stringify!( $SelfT) , "::min_value() .checked_div(-1), None);
751
+ "::MIN + 1).checked_div(-1), Some(" , stringify!( $Max) , "));
752
+ assert_eq!(" , stringify!( $SelfT) , "::MIN .checked_div(-1), None);
753
753
assert_eq!((1" , stringify!( $SelfT) , ").checked_div(0), None);" ,
754
754
$EndFeature, "
755
755
```" ) ,
@@ -778,8 +778,8 @@ Basic usage:
778
778
779
779
```
780
780
assert_eq!((" , stringify!( $SelfT) ,
781
- "::min_value() + 1).checked_div_euclid(-1), Some(" , stringify!( $Max) , "));
782
- assert_eq!(" , stringify!( $SelfT) , "::min_value() .checked_div_euclid(-1), None);
781
+ "::MIN + 1).checked_div_euclid(-1), Some(" , stringify!( $Max) , "));
782
+ assert_eq!(" , stringify!( $SelfT) , "::MIN .checked_div_euclid(-1), None);
783
783
assert_eq!((1" , stringify!( $SelfT) , ").checked_div_euclid(0), None);
784
784
```" ) ,
785
785
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
@@ -959,7 +959,7 @@ Basic usage:
959
959
960
960
```
961
961
" , $Feature, "assert_eq!(8" , stringify!( $SelfT) , ".checked_pow(2), Some(64));
962
- assert_eq!(" , stringify!( $SelfT) , "::max_value() .checked_pow(2), None);" ,
962
+ assert_eq!(" , stringify!( $SelfT) , "::MAX .checked_pow(2), None);" ,
963
963
$EndFeature, "
964
964
```" ) ,
965
965
@@ -1000,10 +1000,10 @@ Basic usage:
1000
1000
1001
1001
```
1002
1002
" , $Feature, "assert_eq!(100" , stringify!( $SelfT) , ".saturating_add(1), 101);
1003
- assert_eq!(" , stringify!( $SelfT) , "::max_value() .saturating_add(100), " , stringify!( $SelfT) ,
1004
- "::max_value() );
1005
- assert_eq!(" , stringify!( $SelfT) , "::min_value() .saturating_add(-1), " , stringify!( $SelfT) ,
1006
- "::min_value() );" ,
1003
+ assert_eq!(" , stringify!( $SelfT) , "::MAX .saturating_add(100), " , stringify!( $SelfT) ,
1004
+ "::MAX );
1005
+ assert_eq!(" , stringify!( $SelfT) , "::MIN .saturating_add(-1), " , stringify!( $SelfT) ,
1006
+ "::MIN );" ,
1007
1007
$EndFeature, "
1008
1008
```" ) ,
1009
1009
@@ -1027,10 +1027,10 @@ Basic usage:
1027
1027
1028
1028
```
1029
1029
" , $Feature, "assert_eq!(100" , stringify!( $SelfT) , ".saturating_sub(127), -27);
1030
- assert_eq!(" , stringify!( $SelfT) , "::min_value() .saturating_sub(100), " , stringify!( $SelfT) ,
1031
- "::min_value() );
1032
- assert_eq!(" , stringify!( $SelfT) , "::max_value() .saturating_sub(-1), " , stringify!( $SelfT) ,
1033
- "::max_value() );" ,
1030
+ assert_eq!(" , stringify!( $SelfT) , "::MIN .saturating_sub(100), " , stringify!( $SelfT) ,
1031
+ "::MIN );
1032
+ assert_eq!(" , stringify!( $SelfT) , "::MAX .saturating_sub(-1), " , stringify!( $SelfT) ,
1033
+ "::MAX );" ,
1034
1034
$EndFeature, "
1035
1035
```" ) ,
1036
1036
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -1055,10 +1055,10 @@ Basic usage:
1055
1055
" , $Feature, "#![feature(saturating_neg)]
1056
1056
assert_eq!(100" , stringify!( $SelfT) , ".saturating_neg(), -100);
1057
1057
assert_eq!((-100" , stringify!( $SelfT) , ").saturating_neg(), 100);
1058
- assert_eq!(" , stringify!( $SelfT) , "::min_value() .saturating_neg(), " , stringify!( $SelfT) ,
1059
- "::max_value() );
1060
- assert_eq!(" , stringify!( $SelfT) , "::max_value() .saturating_neg(), " , stringify!( $SelfT) ,
1061
- "::min_value() + 1);" ,
1058
+ assert_eq!(" , stringify!( $SelfT) , "::MIN .saturating_neg(), " , stringify!( $SelfT) ,
1059
+ "::MAX );
1060
+ assert_eq!(" , stringify!( $SelfT) , "::MAX .saturating_neg(), " , stringify!( $SelfT) ,
1061
+ "::MIN + 1);" ,
1062
1062
$EndFeature, "
1063
1063
```" ) ,
1064
1064
@@ -1082,10 +1082,10 @@ Basic usage:
1082
1082
" , $Feature, "#![feature(saturating_neg)]
1083
1083
assert_eq!(100" , stringify!( $SelfT) , ".saturating_abs(), 100);
1084
1084
assert_eq!((-100" , stringify!( $SelfT) , ").saturating_abs(), 100);
1085
- assert_eq!(" , stringify!( $SelfT) , "::min_value() .saturating_abs(), " , stringify!( $SelfT) ,
1086
- "::max_value() );
1087
- assert_eq!((" , stringify!( $SelfT) , "::min_value() + 1).saturating_abs(), " , stringify!( $SelfT) ,
1088
- "::max_value() );" ,
1085
+ assert_eq!(" , stringify!( $SelfT) , "::MIN .saturating_abs(), " , stringify!( $SelfT) ,
1086
+ "::MAX );
1087
+ assert_eq!((" , stringify!( $SelfT) , "::MIN + 1).saturating_abs(), " , stringify!( $SelfT) ,
1088
+ "::MAX );" ,
1089
1089
$EndFeature, "
1090
1090
```" ) ,
1091
1091
@@ -1171,8 +1171,8 @@ Basic usage:
1171
1171
1172
1172
```
1173
1173
" , $Feature, "assert_eq!(100" , stringify!( $SelfT) , ".wrapping_add(27), 127);
1174
- assert_eq!(" , stringify!( $SelfT) , "::max_value() .wrapping_add(2), " , stringify!( $SelfT) ,
1175
- "::min_value() + 1);" ,
1174
+ assert_eq!(" , stringify!( $SelfT) , "::MAX .wrapping_add(2), " , stringify!( $SelfT) ,
1175
+ "::MIN + 1);" ,
1176
1176
$EndFeature, "
1177
1177
```" ) ,
1178
1178
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -1195,8 +1195,8 @@ Basic usage:
1195
1195
1196
1196
```
1197
1197
" , $Feature, "assert_eq!(0" , stringify!( $SelfT) , ".wrapping_sub(127), -127);
1198
- assert_eq!((-2" , stringify!( $SelfT) , ").wrapping_sub(" , stringify!( $SelfT) , "::max_value() ), " ,
1199
- stringify!( $SelfT) , "::max_value() );" ,
1198
+ assert_eq!((-2" , stringify!( $SelfT) , ").wrapping_sub(" , stringify!( $SelfT) , "::MAX ), " ,
1199
+ stringify!( $SelfT) , "::MAX );" ,
1200
1200
$EndFeature, "
1201
1201
```" ) ,
1202
1202
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -1367,8 +1367,8 @@ Basic usage:
1367
1367
1368
1368
```
1369
1369
" , $Feature, "assert_eq!(100" , stringify!( $SelfT) , ".wrapping_neg(), -100);
1370
- assert_eq!(" , stringify!( $SelfT) , "::min_value() .wrapping_neg(), " , stringify!( $SelfT) ,
1371
- "::min_value() );" ,
1370
+ assert_eq!(" , stringify!( $SelfT) , "::MIN .wrapping_neg(), " , stringify!( $SelfT) ,
1371
+ "::MIN );" ,
1372
1372
$EndFeature, "
1373
1373
```" ) ,
1374
1374
#[ stable( feature = "num_wrapping" , since = "1.2.0" ) ]
@@ -1458,8 +1458,8 @@ Basic usage:
1458
1458
```
1459
1459
" , $Feature, "assert_eq!(100" , stringify!( $SelfT) , ".wrapping_abs(), 100);
1460
1460
assert_eq!((-100" , stringify!( $SelfT) , ").wrapping_abs(), 100);
1461
- assert_eq!(" , stringify!( $SelfT) , "::min_value() .wrapping_abs(), " , stringify!( $SelfT) ,
1462
- "::min_value() );
1461
+ assert_eq!(" , stringify!( $SelfT) , "::MIN .wrapping_abs(), " , stringify!( $SelfT) ,
1462
+ "::MIN );
1463
1463
assert_eq!((-128i8).wrapping_abs() as u8, 128);" ,
1464
1464
$EndFeature, "
1465
1465
```" ) ,
@@ -1831,8 +1831,8 @@ Basic usage:
1831
1831
```
1832
1832
" , $Feature, "assert_eq!(10" , stringify!( $SelfT) , ".overflowing_abs(), (10, false));
1833
1833
assert_eq!((-10" , stringify!( $SelfT) , ").overflowing_abs(), (10, false));
1834
- assert_eq!((" , stringify!( $SelfT) , "::min_value() ).overflowing_abs(), (" , stringify!( $SelfT) ,
1835
- "::min_value() , true));" ,
1834
+ assert_eq!((" , stringify!( $SelfT) , "::MIN ).overflowing_abs(), (" , stringify!( $SelfT) ,
1835
+ "::MIN , true));" ,
1836
1836
$EndFeature, "
1837
1837
```" ) ,
1838
1838
#[ stable( feature = "no_panic_abs" , since = "1.13.0" ) ]
@@ -2028,10 +2028,10 @@ assert_eq!((-a).rem_euclid(-b), 1);
2028
2028
2029
2029
# Overflow behavior
2030
2030
2031
- The absolute value of `" , stringify!( $SelfT) , "::min_value() ` cannot be represented as an
2031
+ The absolute value of `" , stringify!( $SelfT) , "::MIN ` cannot be represented as an
2032
2032
`" , stringify!( $SelfT) , "`, and attempting to calculate it will cause an overflow. This means that
2033
2033
code in debug mode will trigger a panic on this case and optimized code will return `" ,
2034
- stringify!( $SelfT) , "::min_value() ` without a panic.
2034
+ stringify!( $SelfT) , "::MIN ` without a panic.
2035
2035
2036
2036
# Examples
2037
2037
@@ -2505,7 +2505,7 @@ assert_eq!(n.count_ones(), 3);", $EndFeature, "
2505
2505
Basic usage:
2506
2506
2507
2507
```
2508
- " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::max_value() .count_zeros(), 0);" , $EndFeature, "
2508
+ " , $Feature, "assert_eq!(" , stringify!( $SelfT) , "::MAX .count_zeros(), 0);" , $EndFeature, "
2509
2509
```" ) ,
2510
2510
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2511
2511
#[ rustc_const_stable( feature = "const_math" , since = "1.32.0" ) ]
@@ -2523,7 +2523,7 @@ Basic usage:
2523
2523
Basic usage:
2524
2524
2525
2525
```
2526
- " , $Feature, "let n = " , stringify!( $SelfT) , "::max_value() >> 2;
2526
+ " , $Feature, "let n = " , stringify!( $SelfT) , "::MAX >> 2;
2527
2527
2528
2528
assert_eq!(n.leading_zeros(), 2);" , $EndFeature, "
2529
2529
```" ) ,
@@ -2565,7 +2565,7 @@ Basic usage:
2565
2565
2566
2566
```
2567
2567
" , $Feature, "#![feature(leading_trailing_ones)]
2568
- let n = !(" , stringify!( $SelfT) , "::max_value() >> 2);
2568
+ let n = !(" , stringify!( $SelfT) , "::MAX >> 2);
2569
2569
2570
2570
assert_eq!(n.leading_ones(), 2);" , $EndFeature, "
2571
2571
```" ) ,
@@ -2839,9 +2839,9 @@ if overflow occurred.
2839
2839
Basic usage:
2840
2840
2841
2841
```
2842
- " , $Feature, "assert_eq!((" , stringify!( $SelfT) , "::max_value() - 2).checked_add(1), " ,
2843
- "Some(" , stringify!( $SelfT) , "::max_value() - 1));
2844
- assert_eq!((" , stringify!( $SelfT) , "::max_value() - 2).checked_add(3), None);" , $EndFeature, "
2842
+ " , $Feature, "assert_eq!((" , stringify!( $SelfT) , "::MAX - 2).checked_add(1), " ,
2843
+ "Some(" , stringify!( $SelfT) , "::MAX - 1));
2844
+ assert_eq!((" , stringify!( $SelfT) , "::MAX - 2).checked_add(3), None);" , $EndFeature, "
2845
2845
```" ) ,
2846
2846
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2847
2847
#[ rustc_const_unstable( feature = "const_checked_int_methods" , issue = "53718" ) ]
@@ -2887,7 +2887,7 @@ Basic usage:
2887
2887
2888
2888
```
2889
2889
" , $Feature, "assert_eq!(5" , stringify!( $SelfT) , ".checked_mul(1), Some(5));
2890
- assert_eq!(" , stringify!( $SelfT) , "::max_value() .checked_mul(2), None);" , $EndFeature, "
2890
+ assert_eq!(" , stringify!( $SelfT) , "::MAX .checked_mul(2), None);" , $EndFeature, "
2891
2891
```" ) ,
2892
2892
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2893
2893
#[ rustc_const_unstable( feature = "const_checked_int_methods" , issue = "53718" ) ]
@@ -3087,7 +3087,7 @@ Basic usage:
3087
3087
3088
3088
```
3089
3089
" , $Feature, "assert_eq!(2" , stringify!( $SelfT) , ".checked_pow(5), Some(32));
3090
- assert_eq!(" , stringify!( $SelfT) , "::max_value() .checked_pow(2), None);" , $EndFeature, "
3090
+ assert_eq!(" , stringify!( $SelfT) , "::MAX .checked_pow(2), None);" , $EndFeature, "
3091
3091
```" ) ,
3092
3092
#[ stable( feature = "no_panic_pow" , since = "1.34.0" ) ]
3093
3093
#[ must_use = "this returns the result of the operation, \
@@ -3224,7 +3224,7 @@ Basic usage:
3224
3224
3225
3225
```
3226
3226
" , $Feature, "assert_eq!(200" , stringify!( $SelfT) , ".wrapping_add(55), 255);
3227
- assert_eq!(200" , stringify!( $SelfT) , ".wrapping_add(" , stringify!( $SelfT) , "::max_value() ), 199);" ,
3227
+ assert_eq!(200" , stringify!( $SelfT) , ".wrapping_add(" , stringify!( $SelfT) , "::MAX ), 199);" ,
3228
3228
$EndFeature, "
3229
3229
```" ) ,
3230
3230
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -3247,7 +3247,7 @@ Basic usage:
3247
3247
3248
3248
```
3249
3249
" , $Feature, "assert_eq!(100" , stringify!( $SelfT) , ".wrapping_sub(100), 0);
3250
- assert_eq!(100" , stringify!( $SelfT) , ".wrapping_sub(" , stringify!( $SelfT) , "::max_value() ), 101);" ,
3250
+ assert_eq!(100" , stringify!( $SelfT) , ".wrapping_sub(" , stringify!( $SelfT) , "::MAX ), 101);" ,
3251
3251
$EndFeature, "
3252
3252
```" ) ,
3253
3253
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -4029,7 +4029,7 @@ Basic usage:
4029
4029
" , $Feature, "assert_eq!(2" , stringify!( $SelfT) ,
4030
4030
".checked_next_power_of_two(), Some(2));
4031
4031
assert_eq!(3" , stringify!( $SelfT) , ".checked_next_power_of_two(), Some(4));
4032
- assert_eq!(" , stringify!( $SelfT) , "::max_value() .checked_next_power_of_two(), None);" ,
4032
+ assert_eq!(" , stringify!( $SelfT) , "::MAX .checked_next_power_of_two(), None);" ,
4033
4033
$EndFeature, "
4034
4034
```" ) ,
4035
4035
#[ inline]
@@ -4053,7 +4053,7 @@ Basic usage:
4053
4053
" , $Feature, "
4054
4054
assert_eq!(2" , stringify!( $SelfT) , ".wrapping_next_power_of_two(), 2);
4055
4055
assert_eq!(3" , stringify!( $SelfT) , ".wrapping_next_power_of_two(), 4);
4056
- assert_eq!(" , stringify!( $SelfT) , "::max_value() .wrapping_next_power_of_two(), 0);" ,
4056
+ assert_eq!(" , stringify!( $SelfT) , "::MAX .wrapping_next_power_of_two(), 0);" ,
4057
4057
$EndFeature, "
4058
4058
```" ) ,
4059
4059
#[ unstable( feature = "wrapping_next_power_of_two" , issue = "32463" ,
0 commit comments