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