@@ -802,10 +802,11 @@ assert_eq!(", stringify!($SelfT), "::min_value().checked_div_euclid(-1), None);
802
802
assert_eq!((1" , stringify!( $SelfT) , ").checked_div_euclid(0), None);
803
803
```" ) ,
804
804
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
805
+ #[ rustc_const_unstable( feature = "const_int_euclidean" , issue = "53718" ) ]
805
806
#[ must_use = "this returns the result of the operation, \
806
807
without modifying the original"]
807
808
#[ inline]
808
- pub fn checked_div_euclid( self , rhs: Self ) -> Option <Self > {
809
+ pub const fn checked_div_euclid( self , rhs: Self ) -> Option <Self > {
809
810
if rhs == 0 || ( self == Self :: min_value( ) && rhs == -1 ) {
810
811
None
811
812
} else {
@@ -860,10 +861,11 @@ assert_eq!(5", stringify!($SelfT), ".checked_rem_euclid(0), None);
860
861
assert_eq!(" , stringify!( $SelfT) , "::MIN.checked_rem_euclid(-1), None);
861
862
```" ) ,
862
863
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
864
+ #[ rustc_const_unstable( feature = "const_int_euclidean" , issue = "53718" ) ]
863
865
#[ must_use = "this returns the result of the operation, \
864
866
without modifying the original"]
865
867
#[ inline]
866
- pub fn checked_rem_euclid( self , rhs: Self ) -> Option <Self > {
868
+ pub const fn checked_rem_euclid( self , rhs: Self ) -> Option <Self > {
867
869
if rhs == 0 || ( self == Self :: min_value( ) && rhs == -1 ) {
868
870
None
869
871
} else {
@@ -1298,10 +1300,11 @@ assert_eq!(100", stringify!($SelfT), ".wrapping_div_euclid(10), 10);
1298
1300
assert_eq!((-128i8).wrapping_div_euclid(-1), -128);
1299
1301
```" ) ,
1300
1302
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
1303
+ #[ rustc_const_unstable( feature = "const_int_euclidean" , issue = "53718" ) ]
1301
1304
#[ must_use = "this returns the result of the operation, \
1302
1305
without modifying the original"]
1303
1306
#[ inline]
1304
- pub fn wrapping_div_euclid( self , rhs: Self ) -> Self {
1307
+ pub const fn wrapping_div_euclid( self , rhs: Self ) -> Self {
1305
1308
self . overflowing_div_euclid( rhs) . 0
1306
1309
}
1307
1310
}
@@ -1356,10 +1359,11 @@ assert_eq!(100", stringify!($SelfT), ".wrapping_rem_euclid(10), 0);
1356
1359
assert_eq!((-128i8).wrapping_rem_euclid(-1), 0);
1357
1360
```" ) ,
1358
1361
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
1362
+ #[ rustc_const_unstable( feature = "const_int_euclidean" , issue = "53718" ) ]
1359
1363
#[ must_use = "this returns the result of the operation, \
1360
1364
without modifying the original"]
1361
1365
#[ inline]
1362
- pub fn wrapping_rem_euclid( self , rhs: Self ) -> Self {
1366
+ pub const fn wrapping_rem_euclid( self , rhs: Self ) -> Self {
1363
1367
self . overflowing_rem_euclid( rhs) . 0
1364
1368
}
1365
1369
}
@@ -1669,9 +1673,10 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_div_euclid(-1), (", stringi
1669
1673
```" ) ,
1670
1674
#[ inline]
1671
1675
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
1676
+ #[ rustc_const_unstable( feature = "const_int_euclidean" , issue = "53718" ) ]
1672
1677
#[ must_use = "this returns the result of the operation, \
1673
1678
without modifying the original"]
1674
- pub fn overflowing_div_euclid( self , rhs: Self ) -> ( Self , bool ) {
1679
+ pub const fn overflowing_div_euclid( self , rhs: Self ) -> ( Self , bool ) {
1675
1680
if self == Self :: min_value( ) && rhs == -1 {
1676
1681
( self , true )
1677
1682
} else {
@@ -1736,10 +1741,11 @@ assert_eq!(5", stringify!($SelfT), ".overflowing_rem_euclid(2), (1, false));
1736
1741
assert_eq!(" , stringify!( $SelfT) , "::MIN.overflowing_rem_euclid(-1), (0, true));
1737
1742
```" ) ,
1738
1743
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
1744
+ #[ rustc_const_unstable( feature = "const_int_euclidean" , issue = "53718" ) ]
1739
1745
#[ must_use = "this returns the result of the operation, \
1740
1746
without modifying the original"]
1741
1747
#[ inline]
1742
- pub fn overflowing_rem_euclid( self , rhs: Self ) -> ( Self , bool ) {
1748
+ pub const fn overflowing_rem_euclid( self , rhs: Self ) -> ( Self , bool ) {
1743
1749
if self == Self :: min_value( ) && rhs == -1 {
1744
1750
( 0 , true )
1745
1751
} else {
@@ -1981,11 +1987,12 @@ assert_eq!((-a).div_euclid(b), -2); // -7 >= 4 * -2
1981
1987
assert_eq!((-a).div_euclid(-b), 2); // -7 >= -4 * 2
1982
1988
```" ) ,
1983
1989
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
1990
+ #[ rustc_const_unstable( feature = "const_int_euclidean" , issue = "53718" ) ]
1984
1991
#[ must_use = "this returns the result of the operation, \
1985
1992
without modifying the original"]
1986
1993
#[ inline]
1987
1994
#[ rustc_inherit_overflow_checks]
1988
- pub fn div_euclid( self , rhs: Self ) -> Self {
1995
+ pub const fn div_euclid( self , rhs: Self ) -> Self {
1989
1996
let q = self / rhs;
1990
1997
if self % rhs < 0 {
1991
1998
return if rhs > 0 { q - 1 } else { q + 1 }
@@ -2020,11 +2027,12 @@ assert_eq!(a.rem_euclid(-b), 3);
2020
2027
assert_eq!((-a).rem_euclid(-b), 1);
2021
2028
```" ) ,
2022
2029
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
2030
+ #[ rustc_const_unstable( feature = "const_int_euclidean" , issue = "53718" ) ]
2023
2031
#[ must_use = "this returns the result of the operation, \
2024
2032
without modifying the original"]
2025
2033
#[ inline]
2026
2034
#[ rustc_inherit_overflow_checks]
2027
- pub fn rem_euclid( self , rhs: Self ) -> Self {
2035
+ pub const fn rem_euclid( self , rhs: Self ) -> Self {
2028
2036
let r = self % rhs;
2029
2037
if r < 0 {
2030
2038
if rhs < 0 {
@@ -2939,10 +2947,11 @@ assert_eq!(128", stringify!($SelfT), ".checked_div_euclid(2), Some(64));
2939
2947
assert_eq!(1" , stringify!( $SelfT) , ".checked_div_euclid(0), None);
2940
2948
```" ) ,
2941
2949
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
2950
+ #[ rustc_const_unstable( feature = "const_int_euclidean" , issue = "53718" ) ]
2942
2951
#[ must_use = "this returns the result of the operation, \
2943
2952
without modifying the original"]
2944
2953
#[ inline]
2945
- pub fn checked_div_euclid( self , rhs: Self ) -> Option <Self > {
2954
+ pub const fn checked_div_euclid( self , rhs: Self ) -> Option <Self > {
2946
2955
if rhs == 0 {
2947
2956
None
2948
2957
} else {
@@ -2992,10 +3001,11 @@ assert_eq!(5", stringify!($SelfT), ".checked_rem_euclid(2), Some(1));
2992
3001
assert_eq!(5" , stringify!( $SelfT) , ".checked_rem_euclid(0), None);
2993
3002
```" ) ,
2994
3003
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
3004
+ #[ rustc_const_unstable( feature = "const_int_euclidean" , issue = "53718" ) ]
2995
3005
#[ must_use = "this returns the result of the operation, \
2996
3006
without modifying the original"]
2997
3007
#[ inline]
2998
- pub fn checked_rem_euclid( self , rhs: Self ) -> Option <Self > {
3008
+ pub const fn checked_rem_euclid( self , rhs: Self ) -> Option <Self > {
2999
3009
if rhs == 0 {
3000
3010
None
3001
3011
} else {
@@ -3315,10 +3325,11 @@ Basic usage:
3315
3325
assert_eq!(100" , stringify!( $SelfT) , ".wrapping_div_euclid(10), 10);
3316
3326
```" ) ,
3317
3327
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
3328
+ #[ rustc_const_unstable( feature = "const_int_euclidean" , issue = "53718" ) ]
3318
3329
#[ must_use = "this returns the result of the operation, \
3319
3330
without modifying the original"]
3320
3331
#[ inline]
3321
- pub fn wrapping_div_euclid( self , rhs: Self ) -> Self {
3332
+ pub const fn wrapping_div_euclid( self , rhs: Self ) -> Self {
3322
3333
self / rhs
3323
3334
}
3324
3335
}
@@ -3366,10 +3377,11 @@ Basic usage:
3366
3377
assert_eq!(100" , stringify!( $SelfT) , ".wrapping_rem_euclid(10), 0);
3367
3378
```" ) ,
3368
3379
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
3380
+ #[ rustc_const_unstable( feature = "const_int_euclidean" , issue = "53718" ) ]
3369
3381
#[ must_use = "this returns the result of the operation, \
3370
3382
without modifying the original"]
3371
3383
#[ inline]
3372
- pub fn wrapping_rem_euclid( self , rhs: Self ) -> Self {
3384
+ pub const fn wrapping_rem_euclid( self , rhs: Self ) -> Self {
3373
3385
self % rhs
3374
3386
}
3375
3387
}
@@ -3645,9 +3657,10 @@ assert_eq!(5", stringify!($SelfT), ".overflowing_div_euclid(2), (2, false));
3645
3657
```" ) ,
3646
3658
#[ inline]
3647
3659
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
3660
+ #[ rustc_const_unstable( feature = "const_int_euclidean" , issue = "53718" ) ]
3648
3661
#[ must_use = "this returns the result of the operation, \
3649
3662
without modifying the original"]
3650
- pub fn overflowing_div_euclid( self , rhs: Self ) -> ( Self , bool ) {
3663
+ pub const fn overflowing_div_euclid( self , rhs: Self ) -> ( Self , bool ) {
3651
3664
( self / rhs, false )
3652
3665
}
3653
3666
}
@@ -3704,9 +3717,10 @@ assert_eq!(5", stringify!($SelfT), ".overflowing_rem_euclid(2), (1, false));
3704
3717
```" ) ,
3705
3718
#[ inline]
3706
3719
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
3720
+ #[ rustc_const_unstable( feature = "const_int_euclidean" , issue = "53718" ) ]
3707
3721
#[ must_use = "this returns the result of the operation, \
3708
3722
without modifying the original"]
3709
- pub fn overflowing_rem_euclid( self , rhs: Self ) -> ( Self , bool ) {
3723
+ pub const fn overflowing_rem_euclid( self , rhs: Self ) -> ( Self , bool ) {
3710
3724
( self % rhs, false )
3711
3725
}
3712
3726
}
@@ -3897,11 +3911,12 @@ Basic usage:
3897
3911
assert_eq!(7" , stringify!( $SelfT) , ".div_euclid(4), 1); // or any other integer type
3898
3912
```" ) ,
3899
3913
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
3914
+ #[ rustc_const_unstable( feature = "const_int_euclidean" , issue = "53718" ) ]
3900
3915
#[ must_use = "this returns the result of the operation, \
3901
3916
without modifying the original"]
3902
3917
#[ inline]
3903
3918
#[ rustc_inherit_overflow_checks]
3904
- pub fn div_euclid( self , rhs: Self ) -> Self {
3919
+ pub const fn div_euclid( self , rhs: Self ) -> Self {
3905
3920
self / rhs
3906
3921
}
3907
3922
}
@@ -3926,11 +3941,12 @@ Basic usage:
3926
3941
assert_eq!(7" , stringify!( $SelfT) , ".rem_euclid(4), 3); // or any other integer type
3927
3942
```" ) ,
3928
3943
#[ stable( feature = "euclidean_division" , since = "1.38.0" ) ]
3944
+ #[ rustc_const_unstable( feature = "const_int_euclidean" , issue = "53718" ) ]
3929
3945
#[ must_use = "this returns the result of the operation, \
3930
3946
without modifying the original"]
3931
3947
#[ inline]
3932
3948
#[ rustc_inherit_overflow_checks]
3933
- pub fn rem_euclid( self , rhs: Self ) -> Self {
3949
+ pub const fn rem_euclid( self , rhs: Self ) -> Self {
3934
3950
self % rhs
3935
3951
}
3936
3952
}
0 commit comments