@@ -179,12 +179,14 @@ add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
179179/// ```
180180#[ lang = "sub" ]
181181#[ stable( feature = "rust1" , since = "1.0.0" ) ]
182+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
182183#[ rustc_on_unimplemented(
183184 message = "cannot subtract `{Rhs}` from `{Self}`" ,
184185 label = "no implementation for `{Self} - {Rhs}`" ,
185186 append_const_msg
186187) ]
187188#[ doc( alias = "-" ) ]
189+ #[ const_trait]
188190pub trait Sub < Rhs = Self > {
189191 /// The resulting type after applying the `-` operator.
190192 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -206,7 +208,8 @@ pub trait Sub<Rhs = Self> {
206208macro_rules! sub_impl {
207209 ( $( $t: ty) * ) => ( $(
208210 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
209- impl Sub for $t {
211+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
212+ impl const Sub for $t {
210213 type Output = $t;
211214
212215 #[ inline]
@@ -310,11 +313,13 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
310313/// ```
311314#[ lang = "mul" ]
312315#[ stable( feature = "rust1" , since = "1.0.0" ) ]
316+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
313317#[ diagnostic:: on_unimplemented(
314318 message = "cannot multiply `{Self}` by `{Rhs}`" ,
315319 label = "no implementation for `{Self} * {Rhs}`"
316320) ]
317321#[ doc( alias = "*" ) ]
322+ #[ const_trait]
318323pub trait Mul < Rhs = Self > {
319324 /// The resulting type after applying the `*` operator.
320325 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -336,7 +341,8 @@ pub trait Mul<Rhs = Self> {
336341macro_rules! mul_impl {
337342 ( $( $t: ty) * ) => ( $(
338343 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
339- impl Mul for $t {
344+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
345+ impl const Mul for $t {
340346 type Output = $t;
341347
342348 #[ inline]
@@ -444,11 +450,13 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
444450/// ```
445451#[ lang = "div" ]
446452#[ stable( feature = "rust1" , since = "1.0.0" ) ]
453+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
447454#[ diagnostic:: on_unimplemented(
448455 message = "cannot divide `{Self}` by `{Rhs}`" ,
449456 label = "no implementation for `{Self} / {Rhs}`"
450457) ]
451458#[ doc( alias = "/" ) ]
459+ #[ const_trait]
452460pub trait Div < Rhs = Self > {
453461 /// The resulting type after applying the `/` operator.
454462 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -476,7 +484,8 @@ macro_rules! div_impl_integer {
476484 ///
477485 #[ doc = $panic]
478486 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
479- impl Div for $t {
487+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
488+ impl const Div for $t {
480489 type Output = $t;
481490
482491 #[ inline]
@@ -496,7 +505,8 @@ div_impl_integer! {
496505macro_rules! div_impl_float {
497506 ( $( $t: ty) * ) => ( $(
498507 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
499- impl Div for $t {
508+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
509+ impl const Div for $t {
500510 type Output = $t;
501511
502512 #[ inline]
@@ -546,11 +556,13 @@ div_impl_float! { f16 f32 f64 f128 }
546556/// ```
547557#[ lang = "rem" ]
548558#[ stable( feature = "rust1" , since = "1.0.0" ) ]
559+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
549560#[ diagnostic:: on_unimplemented(
550561 message = "cannot calculate the remainder of `{Self}` divided by `{Rhs}`" ,
551562 label = "no implementation for `{Self} % {Rhs}`"
552563) ]
553564#[ doc( alias = "%" ) ]
565+ #[ const_trait]
554566pub trait Rem < Rhs = Self > {
555567 /// The resulting type after applying the `%` operator.
556568 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -578,7 +590,8 @@ macro_rules! rem_impl_integer {
578590 ///
579591 #[ doc = $panic]
580592 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
581- impl Rem for $t {
593+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
594+ impl const Rem for $t {
582595 type Output = $t;
583596
584597 #[ inline]
@@ -613,6 +626,7 @@ macro_rules! rem_impl_float {
613626 /// assert_eq!(x % y, remainder);
614627 /// ```
615628 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
629+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
616630 impl Rem for $t {
617631 type Output = $t;
618632
0 commit comments