File tree 2 files changed +14
-0
lines changed
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 175
175
#![ feature( const_is_char_boundary) ]
176
176
#![ feature( const_precise_live_drops) ]
177
177
#![ feature( const_str_split_at) ]
178
+ #![ feature( const_trait_impl) ]
178
179
#![ feature( decl_macro) ]
179
180
#![ feature( deprecated_suggestion) ]
180
181
#![ feature( doc_cfg) ]
Original file line number Diff line number Diff line change 73
73
append_const_msg
74
74
) ]
75
75
#[ doc( alias = "+" ) ]
76
+ #[ cfg_attr( not( bootstrap) , const_trait) ]
76
77
pub trait Add < Rhs = Self > {
77
78
/// The resulting type after applying the `+` operator.
78
79
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -94,6 +95,7 @@ pub trait Add<Rhs = Self> {
94
95
macro_rules! add_impl {
95
96
( $( $t: ty) * ) => ( $(
96
97
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
98
+ #[ cfg( bootstrap) ]
97
99
impl Add for $t {
98
100
type Output = $t;
99
101
@@ -103,6 +105,17 @@ macro_rules! add_impl {
103
105
fn add( self , other: $t) -> $t { self + other }
104
106
}
105
107
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
+
106
119
forward_ref_binop! { impl Add , add for $t, $t }
107
120
) * )
108
121
}
You can’t perform that action at this time.
0 commit comments