Skip to content

Commit d05e8e8

Browse files
committed
Auto merge of rust-lang#133379 - jieyouxu:rollup-00jxo71, r=jieyouxu
Rollup of 4 pull requests Successful merges: - rust-lang#133217 ([AIX] Add option -X32_64 to the "strip" command) - rust-lang#133237 (Minimally constify `Add`) - rust-lang#133355 (Add language tests for aggregate types) - rust-lang#133374 (show abi_unsupported_vector_types lint in future breakage reports) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 256c54d + a850f7c commit d05e8e8

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

core/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
#![feature(const_is_char_boundary)]
175175
#![feature(const_precise_live_drops)]
176176
#![feature(const_str_split_at)]
177+
#![feature(const_trait_impl)]
177178
#![feature(decl_macro)]
178179
#![feature(deprecated_suggestion)]
179180
#![feature(doc_cfg)]

core/src/ops/arith.rs

+13
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
append_const_msg
7474
)]
7575
#[doc(alias = "+")]
76+
#[cfg_attr(not(bootstrap), 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,6 +95,7 @@ pub trait Add<Rhs = Self> {
9495
macro_rules! add_impl {
9596
($($t:ty)*) => ($(
9697
#[stable(feature = "rust1", since = "1.0.0")]
98+
#[cfg(bootstrap)]
9799
impl Add for $t {
98100
type Output = $t;
99101

@@ -103,6 +105,17 @@ macro_rules! add_impl {
103105
fn add(self, other: $t) -> $t { self + other }
104106
}
105107

108+
#[stable(feature = "rust1", since = "1.0.0")]
109+
#[cfg(not(bootstrap))]
110+
impl const Add for $t {
111+
type Output = $t;
112+
113+
#[inline]
114+
#[track_caller]
115+
#[rustc_inherit_overflow_checks]
116+
fn add(self, other: $t) -> $t { self + other }
117+
}
118+
106119
forward_ref_binop! { impl Add, add for $t, $t }
107120
)*)
108121
}

0 commit comments

Comments
 (0)