@@ -103,18 +103,18 @@ macro_rules! midpoint_impl {
103
103
( $SelfT: ty, unsigned) => {
104
104
/// Calculates the middle point of `self` and `rhs`.
105
105
///
106
- /// `midpoint(a, b)` is `(a + b) >> 1 ` as if it were performed in a
107
- /// sufficiently-large signed integral type. This implies that the result is
108
- /// always rounded towards negative infinity and that no overflow will ever occur.
106
+ /// `midpoint(a, b)` is `(a + b) / 2 ` as if it were performed in a
107
+ /// sufficiently-large unsigned integral type. This implies that the result is
108
+ /// always rounded towards zero and that no overflow will ever occur.
109
109
///
110
110
/// # Examples
111
111
///
112
112
/// ```
113
- /// #![feature(num_midpoint)]
114
113
#[ doc = concat!( "assert_eq!(0" , stringify!( $SelfT) , ".midpoint(4), 2);" ) ]
115
114
#[ doc = concat!( "assert_eq!(1" , stringify!( $SelfT) , ".midpoint(4), 2);" ) ]
116
115
/// ```
117
- #[ unstable( feature = "num_midpoint" , issue = "110840" ) ]
116
+ #[ stable( feature = "num_midpoint" , since = "CURRENT_RUSTC_VERSION" ) ]
117
+ #[ rustc_const_stable( feature = "num_midpoint" , since = "CURRENT_RUSTC_VERSION" ) ]
118
118
#[ must_use = "this returns the result of the operation, \
119
119
without modifying the original"]
120
120
#[ inline]
@@ -134,14 +134,14 @@ macro_rules! midpoint_impl {
134
134
/// # Examples
135
135
///
136
136
/// ```
137
- /// #![feature(num_midpoint )]
137
+ /// #![feature(num_midpoint_signed )]
138
138
#[ doc = concat!( "assert_eq!(0" , stringify!( $SelfT) , ".midpoint(4), 2);" ) ]
139
139
#[ doc = concat!( "assert_eq!((-1" , stringify!( $SelfT) , ").midpoint(2), 0);" ) ]
140
140
#[ doc = concat!( "assert_eq!((-7" , stringify!( $SelfT) , ").midpoint(0), -3);" ) ]
141
141
#[ doc = concat!( "assert_eq!(0" , stringify!( $SelfT) , ".midpoint(-7), -3);" ) ]
142
142
#[ doc = concat!( "assert_eq!(0" , stringify!( $SelfT) , ".midpoint(7), 3);" ) ]
143
143
/// ```
144
- #[ unstable( feature = "num_midpoint " , issue = "110840" ) ]
144
+ #[ unstable( feature = "num_midpoint_signed " , issue = "110840" ) ]
145
145
#[ must_use = "this returns the result of the operation, \
146
146
without modifying the original"]
147
147
#[ inline]
@@ -157,18 +157,18 @@ macro_rules! midpoint_impl {
157
157
( $SelfT: ty, $WideT: ty, unsigned) => {
158
158
/// Calculates the middle point of `self` and `rhs`.
159
159
///
160
- /// `midpoint(a, b)` is `(a + b) >> 1 ` as if it were performed in a
161
- /// sufficiently-large signed integral type. This implies that the result is
162
- /// always rounded towards negative infinity and that no overflow will ever occur.
160
+ /// `midpoint(a, b)` is `(a + b) / 2 ` as if it were performed in a
161
+ /// sufficiently-large unsigned integral type. This implies that the result is
162
+ /// always rounded towards zero and that no overflow will ever occur.
163
163
///
164
164
/// # Examples
165
165
///
166
166
/// ```
167
- /// #![feature(num_midpoint)]
168
167
#[ doc = concat!( "assert_eq!(0" , stringify!( $SelfT) , ".midpoint(4), 2);" ) ]
169
168
#[ doc = concat!( "assert_eq!(1" , stringify!( $SelfT) , ".midpoint(4), 2);" ) ]
170
169
/// ```
171
- #[ unstable( feature = "num_midpoint" , issue = "110840" ) ]
170
+ #[ stable( feature = "num_midpoint" , since = "CURRENT_RUSTC_VERSION" ) ]
171
+ #[ rustc_const_stable( feature = "num_midpoint" , since = "CURRENT_RUSTC_VERSION" ) ]
172
172
#[ must_use = "this returns the result of the operation, \
173
173
without modifying the original"]
174
174
#[ inline]
@@ -186,14 +186,14 @@ macro_rules! midpoint_impl {
186
186
/// # Examples
187
187
///
188
188
/// ```
189
- /// #![feature(num_midpoint )]
189
+ /// #![feature(num_midpoint_signed )]
190
190
#[ doc = concat!( "assert_eq!(0" , stringify!( $SelfT) , ".midpoint(4), 2);" ) ]
191
191
#[ doc = concat!( "assert_eq!((-1" , stringify!( $SelfT) , ").midpoint(2), 0);" ) ]
192
192
#[ doc = concat!( "assert_eq!((-7" , stringify!( $SelfT) , ").midpoint(0), -3);" ) ]
193
193
#[ doc = concat!( "assert_eq!(0" , stringify!( $SelfT) , ".midpoint(-7), -3);" ) ]
194
194
#[ doc = concat!( "assert_eq!(0" , stringify!( $SelfT) , ".midpoint(7), 3);" ) ]
195
195
/// ```
196
- #[ unstable( feature = "num_midpoint " , issue = "110840" ) ]
196
+ #[ unstable( feature = "num_midpoint_signed " , issue = "110840" ) ]
197
197
#[ must_use = "this returns the result of the operation, \
198
198
without modifying the original"]
199
199
#[ inline]
0 commit comments