@@ -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,7 @@ 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+ impl const Sub for $t {
210212 type Output = $t;
211213
212214 #[ inline]
@@ -310,11 +312,13 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
310312/// ```
311313#[ lang = "mul" ]
312314#[ stable( feature = "rust1" , since = "1.0.0" ) ]
315+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
313316#[ diagnostic:: on_unimplemented(
314317 message = "cannot multiply `{Self}` by `{Rhs}`" ,
315318 label = "no implementation for `{Self} * {Rhs}`"
316319) ]
317320#[ doc( alias = "*" ) ]
321+ #[ const_trait]
318322pub trait Mul < Rhs = Self > {
319323 /// The resulting type after applying the `*` operator.
320324 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -336,7 +340,7 @@ pub trait Mul<Rhs = Self> {
336340macro_rules! mul_impl {
337341 ( $( $t: ty) * ) => ( $(
338342 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
339- impl Mul for $t {
343+ impl const Mul for $t {
340344 type Output = $t;
341345
342346 #[ inline]
@@ -444,11 +448,13 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
444448/// ```
445449#[ lang = "div" ]
446450#[ stable( feature = "rust1" , since = "1.0.0" ) ]
451+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
447452#[ diagnostic:: on_unimplemented(
448453 message = "cannot divide `{Self}` by `{Rhs}`" ,
449454 label = "no implementation for `{Self} / {Rhs}`"
450455) ]
451456#[ doc( alias = "/" ) ]
457+ #[ const_trait]
452458pub trait Div < Rhs = Self > {
453459 /// The resulting type after applying the `/` operator.
454460 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -476,7 +482,7 @@ macro_rules! div_impl_integer {
476482 ///
477483 #[ doc = $panic]
478484 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
479- impl Div for $t {
485+ impl const Div for $t {
480486 type Output = $t;
481487
482488 #[ inline]
@@ -496,7 +502,7 @@ div_impl_integer! {
496502macro_rules! div_impl_float {
497503 ( $( $t: ty) * ) => ( $(
498504 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
499- impl Div for $t {
505+ impl const Div for $t {
500506 type Output = $t;
501507
502508 #[ inline]
@@ -546,11 +552,13 @@ div_impl_float! { f16 f32 f64 f128 }
546552/// ```
547553#[ lang = "rem" ]
548554#[ stable( feature = "rust1" , since = "1.0.0" ) ]
555+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
549556#[ diagnostic:: on_unimplemented(
550557 message = "cannot calculate the remainder of `{Self}` divided by `{Rhs}`" ,
551558 label = "no implementation for `{Self} % {Rhs}`"
552559) ]
553560#[ doc( alias = "%" ) ]
561+ #[ const_trait]
554562pub trait Rem < Rhs = Self > {
555563 /// The resulting type after applying the `%` operator.
556564 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -578,7 +586,7 @@ macro_rules! rem_impl_integer {
578586 ///
579587 #[ doc = $panic]
580588 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
581- impl Rem for $t {
589+ impl const Rem for $t {
582590 type Output = $t;
583591
584592 #[ inline]
0 commit comments