Skip to content

Commit 00d45b8

Browse files
committed
Auto merge of rust-lang#120381 - fee1-dead-contrib:reconstify-add, r=compiler-errors
Reconstify `Add` r? project-const-traits I'm not happy with the ui test changes (or failures because I did not bless them and include the diffs in this PR). There is at least some bugs I need to look and try fix: 1. A third duplicated diagnostic when a consumer crate that does not have `effects` enabled has a trait selection error for an upstream const_trait trait. See tests/ui/ufcs/ufcs-qpath-self-mismatch.rs. 2. For some reason, making `Add` a const trait would stop us from suggesting `T: Add` when we try to add two `T`s without that bound. See tests/ui/suggestions/issue-97677.rs
2 parents 69b5218 + 9d9e19a commit 00d45b8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: core/src/ops/arith.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
append_const_msg
7474
)]
7575
#[doc(alias = "+")]
76+
#[const_trait]
7677
pub trait Add<Rhs = Self> {
7778
/// The resulting type after applying the `+` operator.
7879
#[stable(feature = "rust1", since = "1.0.0")]
@@ -94,7 +95,8 @@ pub trait Add<Rhs = Self> {
9495
macro_rules! add_impl {
9596
($($t:ty)*) => ($(
9697
#[stable(feature = "rust1", since = "1.0.0")]
97-
impl Add for $t {
98+
#[rustc_const_unstable(feature = "const_ops", issue = "90080")]
99+
impl const Add for $t {
98100
type Output = $t;
99101

100102
#[inline]

0 commit comments

Comments
 (0)