65
65
/// ```
66
66
#[ lang = "add" ]
67
67
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
68
- #[ rustc_const_unstable( feature = "const_ops " , issue = "143802" ) ]
68
+ #[ rustc_const_unstable( feature = "const_arith_ops " , issue = "143802" ) ]
69
69
#[ rustc_on_unimplemented(
70
70
on( all( Self = "{integer}" , Rhs = "{float}" ) , message = "cannot add a float to an integer" , ) ,
71
71
on( all( Self = "{float}" , Rhs = "{integer}" ) , message = "cannot add an integer to a float" , ) ,
@@ -96,7 +96,7 @@ pub trait Add<Rhs = Self> {
96
96
macro_rules! add_impl {
97
97
( $( $t: ty) * ) => ( $(
98
98
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
99
- #[ rustc_const_unstable( feature = "const_ops " , issue = "143802" ) ]
99
+ #[ rustc_const_unstable( feature = "const_arith_ops " , issue = "143802" ) ]
100
100
impl const Add for $t {
101
101
type Output = $t;
102
102
@@ -180,7 +180,7 @@ add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
180
180
/// ```
181
181
#[ lang = "sub" ]
182
182
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
183
- #[ rustc_const_unstable( feature = "const_ops " , issue = "143802" ) ]
183
+ #[ rustc_const_unstable( feature = "const_arith_ops " , issue = "143802" ) ]
184
184
#[ rustc_on_unimplemented(
185
185
message = "cannot subtract `{Rhs}` from `{Self}`" ,
186
186
label = "no implementation for `{Self} - {Rhs}`" ,
@@ -209,7 +209,7 @@ pub trait Sub<Rhs = Self> {
209
209
macro_rules! sub_impl {
210
210
( $( $t: ty) * ) => ( $(
211
211
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
212
- #[ rustc_const_unstable( feature = "const_ops " , issue = "143802" ) ]
212
+ #[ rustc_const_unstable( feature = "const_arith_ops " , issue = "143802" ) ]
213
213
impl const Sub for $t {
214
214
type Output = $t;
215
215
@@ -315,7 +315,7 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
315
315
/// ```
316
316
#[ lang = "mul" ]
317
317
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
318
- #[ rustc_const_unstable( feature = "const_ops " , issue = "143802" ) ]
318
+ #[ rustc_const_unstable( feature = "const_arith_ops " , issue = "143802" ) ]
319
319
#[ diagnostic:: on_unimplemented(
320
320
message = "cannot multiply `{Self}` by `{Rhs}`" ,
321
321
label = "no implementation for `{Self} * {Rhs}`"
@@ -343,7 +343,7 @@ pub trait Mul<Rhs = Self> {
343
343
macro_rules! mul_impl {
344
344
( $( $t: ty) * ) => ( $(
345
345
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
346
- #[ rustc_const_unstable( feature = "const_ops " , issue = "143802" ) ]
346
+ #[ rustc_const_unstable( feature = "const_arith_ops " , issue = "143802" ) ]
347
347
impl const Mul for $t {
348
348
type Output = $t;
349
349
@@ -453,7 +453,7 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
453
453
/// ```
454
454
#[ lang = "div" ]
455
455
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
456
- #[ rustc_const_unstable( feature = "const_ops " , issue = "143802" ) ]
456
+ #[ rustc_const_unstable( feature = "const_arith_ops " , issue = "143802" ) ]
457
457
#[ diagnostic:: on_unimplemented(
458
458
message = "cannot divide `{Self}` by `{Rhs}`" ,
459
459
label = "no implementation for `{Self} / {Rhs}`"
@@ -487,7 +487,7 @@ macro_rules! div_impl_integer {
487
487
///
488
488
#[ doc = $panic]
489
489
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
490
- #[ rustc_const_unstable( feature = "const_ops " , issue = "143802" ) ]
490
+ #[ rustc_const_unstable( feature = "const_arith_ops " , issue = "143802" ) ]
491
491
impl const Div for $t {
492
492
type Output = $t;
493
493
@@ -509,7 +509,7 @@ div_impl_integer! {
509
509
macro_rules! div_impl_float {
510
510
( $( $t: ty) * ) => ( $(
511
511
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
512
- #[ rustc_const_unstable( feature = "const_ops " , issue = "143802" ) ]
512
+ #[ rustc_const_unstable( feature = "const_arith_ops " , issue = "143802" ) ]
513
513
impl const Div for $t {
514
514
type Output = $t;
515
515
@@ -561,7 +561,7 @@ div_impl_float! { f16 f32 f64 f128 }
561
561
/// ```
562
562
#[ lang = "rem" ]
563
563
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
564
- #[ rustc_const_unstable( feature = "const_ops " , issue = "143802" ) ]
564
+ #[ rustc_const_unstable( feature = "const_arith_ops " , issue = "143802" ) ]
565
565
#[ diagnostic:: on_unimplemented(
566
566
message = "cannot calculate the remainder of `{Self}` divided by `{Rhs}`" ,
567
567
label = "no implementation for `{Self} % {Rhs}`"
@@ -595,7 +595,7 @@ macro_rules! rem_impl_integer {
595
595
///
596
596
#[ doc = $panic]
597
597
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
598
- #[ rustc_const_unstable( feature = "const_ops " , issue = "143802" ) ]
598
+ #[ rustc_const_unstable( feature = "const_arith_ops " , issue = "143802" ) ]
599
599
impl const Rem for $t {
600
600
type Output = $t;
601
601
@@ -632,7 +632,7 @@ macro_rules! rem_impl_float {
632
632
/// assert_eq!(x % y, remainder);
633
633
/// ```
634
634
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
635
- #[ rustc_const_unstable( feature = "const_ops " , issue = "143802" ) ]
635
+ #[ rustc_const_unstable( feature = "const_arith_ops " , issue = "143802" ) ]
636
636
impl const Rem for $t {
637
637
type Output = $t;
638
638
@@ -685,7 +685,9 @@ rem_impl_float! { f16 f32 f64 f128 }
685
685
/// ```
686
686
#[ lang = "neg" ]
687
687
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
688
+ #[ rustc_const_unstable( feature = "const_arith_ops" , issue = "143802" ) ]
688
689
#[ doc( alias = "-" ) ]
690
+ #[ const_trait]
689
691
pub trait Neg {
690
692
/// The resulting type after applying the `-` operator.
691
693
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -708,7 +710,8 @@ pub trait Neg {
708
710
macro_rules! neg_impl {
709
711
( $( $t: ty) * ) => ( $(
710
712
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
711
- impl Neg for $t {
713
+ #[ rustc_const_unstable( feature = "const_arith_ops" , issue = "143802" ) ]
714
+ impl const Neg for $t {
712
715
type Output = $t;
713
716
714
717
#[ inline]
@@ -754,12 +757,14 @@ neg_impl! { isize i8 i16 i32 i64 i128 f16 f32 f64 f128 }
754
757
/// ```
755
758
#[ lang = "add_assign" ]
756
759
#[ stable( feature = "op_assign_traits" , since = "1.8.0" ) ]
760
+ #[ rustc_const_unstable( feature = "const_arith_ops" , issue = "143802" ) ]
757
761
#[ diagnostic:: on_unimplemented(
758
762
message = "cannot add-assign `{Rhs}` to `{Self}`" ,
759
763
label = "no implementation for `{Self} += {Rhs}`"
760
764
) ]
761
765
#[ doc( alias = "+" ) ]
762
766
#[ doc( alias = "+=" ) ]
767
+ #[ const_trait]
763
768
pub trait AddAssign < Rhs = Self > {
764
769
/// Performs the `+=` operation.
765
770
///
@@ -777,7 +782,8 @@ pub trait AddAssign<Rhs = Self> {
777
782
macro_rules! add_assign_impl {
778
783
( $( $t: ty) +) => ( $(
779
784
#[ stable( feature = "op_assign_traits" , since = "1.8.0" ) ]
780
- impl AddAssign for $t {
785
+ #[ rustc_const_unstable( feature = "const_arith_ops" , issue = "143802" ) ]
786
+ impl const AddAssign for $t {
781
787
#[ inline]
782
788
#[ track_caller]
783
789
#[ rustc_inherit_overflow_checks]
@@ -822,12 +828,14 @@ add_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f
822
828
/// ```
823
829
#[ lang = "sub_assign" ]
824
830
#[ stable( feature = "op_assign_traits" , since = "1.8.0" ) ]
831
+ #[ rustc_const_unstable( feature = "const_arith_ops" , issue = "143802" ) ]
825
832
#[ diagnostic:: on_unimplemented(
826
833
message = "cannot subtract-assign `{Rhs}` from `{Self}`" ,
827
834
label = "no implementation for `{Self} -= {Rhs}`"
828
835
) ]
829
836
#[ doc( alias = "-" ) ]
830
837
#[ doc( alias = "-=" ) ]
838
+ #[ const_trait]
831
839
pub trait SubAssign < Rhs = Self > {
832
840
/// Performs the `-=` operation.
833
841
///
@@ -845,7 +853,8 @@ pub trait SubAssign<Rhs = Self> {
845
853
macro_rules! sub_assign_impl {
846
854
( $( $t: ty) +) => ( $(
847
855
#[ stable( feature = "op_assign_traits" , since = "1.8.0" ) ]
848
- impl SubAssign for $t {
856
+ #[ rustc_const_unstable( feature = "const_arith_ops" , issue = "143802" ) ]
857
+ impl const SubAssign for $t {
849
858
#[ inline]
850
859
#[ track_caller]
851
860
#[ rustc_inherit_overflow_checks]
@@ -881,12 +890,14 @@ sub_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f
881
890
/// ```
882
891
#[ lang = "mul_assign" ]
883
892
#[ stable( feature = "op_assign_traits" , since = "1.8.0" ) ]
893
+ #[ rustc_const_unstable( feature = "const_arith_ops" , issue = "143802" ) ]
884
894
#[ diagnostic:: on_unimplemented(
885
895
message = "cannot multiply-assign `{Self}` by `{Rhs}`" ,
886
896
label = "no implementation for `{Self} *= {Rhs}`"
887
897
) ]
888
898
#[ doc( alias = "*" ) ]
889
899
#[ doc( alias = "*=" ) ]
900
+ #[ const_trait]
890
901
pub trait MulAssign < Rhs = Self > {
891
902
/// Performs the `*=` operation.
892
903
///
@@ -904,7 +915,8 @@ pub trait MulAssign<Rhs = Self> {
904
915
macro_rules! mul_assign_impl {
905
916
( $( $t: ty) +) => ( $(
906
917
#[ stable( feature = "op_assign_traits" , since = "1.8.0" ) ]
907
- impl MulAssign for $t {
918
+ #[ rustc_const_unstable( feature = "const_arith_ops" , issue = "143802" ) ]
919
+ impl const MulAssign for $t {
908
920
#[ inline]
909
921
#[ track_caller]
910
922
#[ rustc_inherit_overflow_checks]
@@ -940,12 +952,14 @@ mul_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f
940
952
/// ```
941
953
#[ lang = "div_assign" ]
942
954
#[ stable( feature = "op_assign_traits" , since = "1.8.0" ) ]
955
+ #[ rustc_const_unstable( feature = "const_arith_ops" , issue = "143802" ) ]
943
956
#[ diagnostic:: on_unimplemented(
944
957
message = "cannot divide-assign `{Self}` by `{Rhs}`" ,
945
958
label = "no implementation for `{Self} /= {Rhs}`"
946
959
) ]
947
960
#[ doc( alias = "/" ) ]
948
961
#[ doc( alias = "/=" ) ]
962
+ #[ const_trait]
949
963
pub trait DivAssign < Rhs = Self > {
950
964
/// Performs the `/=` operation.
951
965
///
@@ -963,7 +977,8 @@ pub trait DivAssign<Rhs = Self> {
963
977
macro_rules! div_assign_impl {
964
978
( $( $t: ty) +) => ( $(
965
979
#[ stable( feature = "op_assign_traits" , since = "1.8.0" ) ]
966
- impl DivAssign for $t {
980
+ #[ rustc_const_unstable( feature = "const_arith_ops" , issue = "143802" ) ]
981
+ impl const DivAssign for $t {
967
982
#[ inline]
968
983
#[ track_caller]
969
984
fn div_assign( & mut self , other: $t) { * self /= other }
@@ -1002,12 +1017,14 @@ div_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f
1002
1017
/// ```
1003
1018
#[ lang = "rem_assign" ]
1004
1019
#[ stable( feature = "op_assign_traits" , since = "1.8.0" ) ]
1020
+ #[ rustc_const_unstable( feature = "const_arith_ops" , issue = "143802" ) ]
1005
1021
#[ diagnostic:: on_unimplemented(
1006
1022
message = "cannot calculate and assign the remainder of `{Self}` divided by `{Rhs}`" ,
1007
1023
label = "no implementation for `{Self} %= {Rhs}`"
1008
1024
) ]
1009
1025
#[ doc( alias = "%" ) ]
1010
1026
#[ doc( alias = "%=" ) ]
1027
+ #[ const_trait]
1011
1028
pub trait RemAssign < Rhs = Self > {
1012
1029
/// Performs the `%=` operation.
1013
1030
///
@@ -1025,7 +1042,8 @@ pub trait RemAssign<Rhs = Self> {
1025
1042
macro_rules! rem_assign_impl {
1026
1043
( $( $t: ty) +) => ( $(
1027
1044
#[ stable( feature = "op_assign_traits" , since = "1.8.0" ) ]
1028
- impl RemAssign for $t {
1045
+ #[ rustc_const_unstable( feature = "const_arith_ops" , issue = "143802" ) ]
1046
+ impl const RemAssign for $t {
1029
1047
#[ inline]
1030
1048
#[ track_caller]
1031
1049
fn rem_assign( & mut self , other: $t) { * self %= other }
0 commit comments