@@ -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,8 @@ 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
+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
212
+ impl const Sub for $t {
210
213
type Output = $t;
211
214
212
215
#[ inline]
@@ -310,11 +313,13 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
310
313
/// ```
311
314
#[ lang = "mul" ]
312
315
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
316
+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
313
317
#[ diagnostic:: on_unimplemented(
314
318
message = "cannot multiply `{Self}` by `{Rhs}`" ,
315
319
label = "no implementation for `{Self} * {Rhs}`"
316
320
) ]
317
321
#[ doc( alias = "*" ) ]
322
+ #[ const_trait]
318
323
pub trait Mul < Rhs = Self > {
319
324
/// The resulting type after applying the `*` operator.
320
325
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -336,7 +341,8 @@ pub trait Mul<Rhs = Self> {
336
341
macro_rules! mul_impl {
337
342
( $( $t: ty) * ) => ( $(
338
343
#[ 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 {
340
346
type Output = $t;
341
347
342
348
#[ inline]
@@ -444,11 +450,13 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
444
450
/// ```
445
451
#[ lang = "div" ]
446
452
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
453
+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
447
454
#[ diagnostic:: on_unimplemented(
448
455
message = "cannot divide `{Self}` by `{Rhs}`" ,
449
456
label = "no implementation for `{Self} / {Rhs}`"
450
457
) ]
451
458
#[ doc( alias = "/" ) ]
459
+ #[ const_trait]
452
460
pub trait Div < Rhs = Self > {
453
461
/// The resulting type after applying the `/` operator.
454
462
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -476,7 +484,8 @@ macro_rules! div_impl_integer {
476
484
///
477
485
#[ doc = $panic]
478
486
#[ 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 {
480
489
type Output = $t;
481
490
482
491
#[ inline]
@@ -496,7 +505,8 @@ div_impl_integer! {
496
505
macro_rules! div_impl_float {
497
506
( $( $t: ty) * ) => ( $(
498
507
#[ 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 {
500
510
type Output = $t;
501
511
502
512
#[ inline]
@@ -546,11 +556,13 @@ div_impl_float! { f16 f32 f64 f128 }
546
556
/// ```
547
557
#[ lang = "rem" ]
548
558
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
559
+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
549
560
#[ diagnostic:: on_unimplemented(
550
561
message = "cannot calculate the remainder of `{Self}` divided by `{Rhs}`" ,
551
562
label = "no implementation for `{Self} % {Rhs}`"
552
563
) ]
553
564
#[ doc( alias = "%" ) ]
565
+ #[ const_trait]
554
566
pub trait Rem < Rhs = Self > {
555
567
/// The resulting type after applying the `%` operator.
556
568
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -578,7 +590,8 @@ macro_rules! rem_impl_integer {
578
590
///
579
591
#[ doc = $panic]
580
592
#[ 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 {
582
595
type Output = $t;
583
596
584
597
#[ inline]
@@ -613,6 +626,7 @@ macro_rules! rem_impl_float {
613
626
/// assert_eq!(x % y, remainder);
614
627
/// ```
615
628
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
629
+ #[ rustc_const_unstable( feature = "const_ops" , issue = "90080" ) ]
616
630
impl Rem for $t {
617
631
type Output = $t;
618
632
0 commit comments