|
75 | 75 | /// ``` |
76 | 76 | #[lang = "add"] |
77 | 77 | #[stable(feature = "rust1", since = "1.0.0")] |
78 | | -#[rustc_on_unimplemented = "no implementation for `{Self} + {RHS}`"] |
| 78 | +#[rustc_on_unimplemented( |
| 79 | + on( |
| 80 | + all(_Self="{integer}", RHS="{float}"), |
| 81 | + message="cannot add a float to an integer", |
| 82 | + ), |
| 83 | + on( |
| 84 | + all(_Self="{float}", RHS="{integer}"), |
| 85 | + message="cannot add an integer to a float", |
| 86 | + ), |
| 87 | + message="cannot add `{RHS}` to `{Self}`", |
| 88 | + label="no implementation for `{Self} + {RHS}`", |
| 89 | +)] |
79 | 90 | pub trait Add<RHS=Self> { |
80 | 91 | /// The resulting type after applying the `+` operator. |
81 | 92 | #[stable(feature = "rust1", since = "1.0.0")] |
@@ -170,7 +181,8 @@ add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } |
170 | 181 | /// ``` |
171 | 182 | #[lang = "sub"] |
172 | 183 | #[stable(feature = "rust1", since = "1.0.0")] |
173 | | -#[rustc_on_unimplemented = "no implementation for `{Self} - {RHS}`"] |
| 184 | +#[rustc_on_unimplemented(message="cannot substract `{RHS}` from `{Self}`", |
| 185 | + label="no implementation for `{Self} - {RHS}`")] |
174 | 186 | pub trait Sub<RHS=Self> { |
175 | 187 | /// The resulting type after applying the `-` operator. |
176 | 188 | #[stable(feature = "rust1", since = "1.0.0")] |
@@ -287,7 +299,8 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } |
287 | 299 | /// ``` |
288 | 300 | #[lang = "mul"] |
289 | 301 | #[stable(feature = "rust1", since = "1.0.0")] |
290 | | -#[rustc_on_unimplemented = "no implementation for `{Self} * {RHS}`"] |
| 302 | +#[rustc_on_unimplemented(message="cannot multiply `{RHS}` to `{Self}`", |
| 303 | + label="no implementation for `{Self} * {RHS}`")] |
291 | 304 | pub trait Mul<RHS=Self> { |
292 | 305 | /// The resulting type after applying the `*` operator. |
293 | 306 | #[stable(feature = "rust1", since = "1.0.0")] |
@@ -408,7 +421,8 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } |
408 | 421 | /// ``` |
409 | 422 | #[lang = "div"] |
410 | 423 | #[stable(feature = "rust1", since = "1.0.0")] |
411 | | -#[rustc_on_unimplemented = "no implementation for `{Self} / {RHS}`"] |
| 424 | +#[rustc_on_unimplemented(message="cannot divide `{Self}` by `{RHS}`", |
| 425 | + label="no implementation for `{Self} / {RHS}`")] |
412 | 426 | pub trait Div<RHS=Self> { |
413 | 427 | /// The resulting type after applying the `/` operator. |
414 | 428 | #[stable(feature = "rust1", since = "1.0.0")] |
@@ -490,7 +504,8 @@ div_impl_float! { f32 f64 } |
490 | 504 | /// ``` |
491 | 505 | #[lang = "rem"] |
492 | 506 | #[stable(feature = "rust1", since = "1.0.0")] |
493 | | -#[rustc_on_unimplemented = "no implementation for `{Self} % {RHS}`"] |
| 507 | +#[rustc_on_unimplemented(message="cannot mod `{Self}` by `{RHS}`", |
| 508 | + label="no implementation for `{Self} % {RHS}`")] |
494 | 509 | pub trait Rem<RHS=Self> { |
495 | 510 | /// The resulting type after applying the `%` operator. |
496 | 511 | #[stable(feature = "rust1", since = "1.0.0")] |
@@ -647,7 +662,8 @@ neg_impl_numeric! { isize i8 i16 i32 i64 i128 f32 f64 } |
647 | 662 | /// ``` |
648 | 663 | #[lang = "add_assign"] |
649 | 664 | #[stable(feature = "op_assign_traits", since = "1.8.0")] |
650 | | -#[rustc_on_unimplemented = "no implementation for `{Self} += {Rhs}`"] |
| 665 | +#[rustc_on_unimplemented(message="cannot add-assign `{Rhs}` to `{Self}`", |
| 666 | + label="no implementation for `{Self} += {Rhs}`")] |
651 | 667 | pub trait AddAssign<Rhs=Self> { |
652 | 668 | /// Performs the `+=` operation. |
653 | 669 | #[stable(feature = "op_assign_traits", since = "1.8.0")] |
@@ -700,7 +716,8 @@ add_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } |
700 | 716 | /// ``` |
701 | 717 | #[lang = "sub_assign"] |
702 | 718 | #[stable(feature = "op_assign_traits", since = "1.8.0")] |
703 | | -#[rustc_on_unimplemented = "no implementation for `{Self} -= {Rhs}`"] |
| 719 | +#[rustc_on_unimplemented(message="cannot substract-assign `{Rhs}` from `{Self}`", |
| 720 | + label="no implementation for `{Self} -= {Rhs}`")] |
704 | 721 | pub trait SubAssign<Rhs=Self> { |
705 | 722 | /// Performs the `-=` operation. |
706 | 723 | #[stable(feature = "op_assign_traits", since = "1.8.0")] |
@@ -744,7 +761,8 @@ sub_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } |
744 | 761 | /// ``` |
745 | 762 | #[lang = "mul_assign"] |
746 | 763 | #[stable(feature = "op_assign_traits", since = "1.8.0")] |
747 | | -#[rustc_on_unimplemented = "no implementation for `{Self} *= {Rhs}`"] |
| 764 | +#[rustc_on_unimplemented(message="cannot multiply-assign `{Rhs}` to `{Self}`", |
| 765 | + label="no implementation for `{Self} *= {Rhs}`")] |
748 | 766 | pub trait MulAssign<Rhs=Self> { |
749 | 767 | /// Performs the `*=` operation. |
750 | 768 | #[stable(feature = "op_assign_traits", since = "1.8.0")] |
@@ -788,7 +806,8 @@ mul_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } |
788 | 806 | /// ``` |
789 | 807 | #[lang = "div_assign"] |
790 | 808 | #[stable(feature = "op_assign_traits", since = "1.8.0")] |
791 | | -#[rustc_on_unimplemented = "no implementation for `{Self} /= {Rhs}`"] |
| 809 | +#[rustc_on_unimplemented(message="cannot divide-assign `{Self}` by `{Rhs}`", |
| 810 | + label="no implementation for `{Self} /= {Rhs}`")] |
792 | 811 | pub trait DivAssign<Rhs=Self> { |
793 | 812 | /// Performs the `/=` operation. |
794 | 813 | #[stable(feature = "op_assign_traits", since = "1.8.0")] |
@@ -835,7 +854,8 @@ div_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } |
835 | 854 | /// ``` |
836 | 855 | #[lang = "rem_assign"] |
837 | 856 | #[stable(feature = "op_assign_traits", since = "1.8.0")] |
838 | | -#[rustc_on_unimplemented = "no implementation for `{Self} %= {Rhs}`"] |
| 857 | +#[rustc_on_unimplemented(message="cannot mod-assign `{Self}` by `{Rhs}``", |
| 858 | + label="no implementation for `{Self} %= {Rhs}`")] |
839 | 859 | pub trait RemAssign<Rhs=Self> { |
840 | 860 | /// Performs the `%=` operation. |
841 | 861 | #[stable(feature = "op_assign_traits", since = "1.8.0")] |
|
0 commit comments