File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 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) ]
Original file line number Diff line number Diff line change 7373 append_const_msg
7474) ]
7575#[ doc( alias = "+" ) ]
76+ #[ cfg_attr( not( bootstrap) , const_trait) ]
7677pub 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> {
9495macro_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}
You can’t perform that action at this time.
0 commit comments