@@ -179,12 +179,14 @@ add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
179
179
/// ```
180
180
#[ lang = "sub" ]
181
181
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
182
+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
182
183
#[ rustc_on_unimplemented(
183
184
message = "cannot subtract `{Rhs}` from `{Self}`" ,
184
185
label = "no implementation for `{Self} - {Rhs}`" ,
185
186
append_const_msg
186
187
) ]
187
188
#[ doc( alias = "-" ) ]
189
+ #[ const_trait]
188
190
pub trait Sub < Rhs = Self > {
189
191
/// The resulting type after applying the `-` operator.
190
192
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -206,7 +208,7 @@ pub trait Sub<Rhs = Self> {
206
208
macro_rules! sub_impl {
207
209
( $( $t: ty) * ) => ( $(
208
210
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
209
- impl Sub for $t {
211
+ impl const Sub for $t {
210
212
type Output = $t;
211
213
212
214
#[ inline]
@@ -310,11 +312,13 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
310
312
/// ```
311
313
#[ lang = "mul" ]
312
314
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
315
+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
313
316
#[ diagnostic:: on_unimplemented(
314
317
message = "cannot multiply `{Self}` by `{Rhs}`" ,
315
318
label = "no implementation for `{Self} * {Rhs}`"
316
319
) ]
317
320
#[ doc( alias = "*" ) ]
321
+ #[ const_trait]
318
322
pub trait Mul < Rhs = Self > {
319
323
/// The resulting type after applying the `*` operator.
320
324
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -336,7 +340,7 @@ pub trait Mul<Rhs = Self> {
336
340
macro_rules! mul_impl {
337
341
( $( $t: ty) * ) => ( $(
338
342
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
339
- impl Mul for $t {
343
+ impl const Mul for $t {
340
344
type Output = $t;
341
345
342
346
#[ inline]
@@ -444,11 +448,13 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
444
448
/// ```
445
449
#[ lang = "div" ]
446
450
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
451
+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
447
452
#[ diagnostic:: on_unimplemented(
448
453
message = "cannot divide `{Self}` by `{Rhs}`" ,
449
454
label = "no implementation for `{Self} / {Rhs}`"
450
455
) ]
451
456
#[ doc( alias = "/" ) ]
457
+ #[ const_trait]
452
458
pub trait Div < Rhs = Self > {
453
459
/// The resulting type after applying the `/` operator.
454
460
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -476,7 +482,7 @@ macro_rules! div_impl_integer {
476
482
///
477
483
#[ doc = $panic]
478
484
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
479
- impl Div for $t {
485
+ impl const Div for $t {
480
486
type Output = $t;
481
487
482
488
#[ inline]
@@ -496,7 +502,7 @@ div_impl_integer! {
496
502
macro_rules! div_impl_float {
497
503
( $( $t: ty) * ) => ( $(
498
504
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
499
- impl Div for $t {
505
+ impl const Div for $t {
500
506
type Output = $t;
501
507
502
508
#[ inline]
@@ -546,11 +552,13 @@ div_impl_float! { f16 f32 f64 f128 }
546
552
/// ```
547
553
#[ lang = "rem" ]
548
554
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
555
+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
549
556
#[ diagnostic:: on_unimplemented(
550
557
message = "cannot calculate the remainder of `{Self}` divided by `{Rhs}`" ,
551
558
label = "no implementation for `{Self} % {Rhs}`"
552
559
) ]
553
560
#[ doc( alias = "%" ) ]
561
+ #[ const_trait]
554
562
pub trait Rem < Rhs = Self > {
555
563
/// The resulting type after applying the `%` operator.
556
564
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -578,7 +586,7 @@ macro_rules! rem_impl_integer {
578
586
///
579
587
#[ doc = $panic]
580
588
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
581
- impl Rem for $t {
589
+ impl const Rem for $t {
582
590
type Output = $t;
583
591
584
592
#[ inline]
0 commit comments