Skip to content

Commit 388f953

Browse files
committed
Stabilize unsigned num_midpoint feature
1 parent f6648f2 commit 388f953

File tree

9 files changed

+14
-27
lines changed

9 files changed

+14
-27
lines changed

library/core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@
130130
#![feature(const_make_ascii)]
131131
#![feature(const_maybe_uninit_assume_init)]
132132
#![feature(const_nonnull_new)]
133-
#![feature(const_num_midpoint)]
134133
#![feature(const_option_ext)]
135134
#![feature(const_pin)]
136135
#![feature(const_pointer_is_aligned)]

library/core/src/num/f128.rs

-2
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,6 @@ impl f128 {
820820
///
821821
/// ```
822822
/// #![feature(f128)]
823-
/// #![feature(num_midpoint)]
824823
/// # // Using aarch64 because `reliable_f128_math` is needed
825824
/// # #[cfg(all(target_arch = "aarch64", target_os = "linux"))] {
826825
///
@@ -830,7 +829,6 @@ impl f128 {
830829
/// ```
831830
#[inline]
832831
#[unstable(feature = "f128", issue = "116909")]
833-
// #[unstable(feature = "num_midpoint", issue = "110840")]
834832
pub fn midpoint(self, other: f128) -> f128 {
835833
const LO: f128 = f128::MIN_POSITIVE * 2.;
836834
const HI: f128 = f128::MAX / 2.;

library/core/src/num/f16.rs

-2
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,6 @@ impl f16 {
806806
///
807807
/// ```
808808
/// #![feature(f16)]
809-
/// #![feature(num_midpoint)]
810809
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
811810
///
812811
/// assert_eq!(1f16.midpoint(4.0), 2.5);
@@ -815,7 +814,6 @@ impl f16 {
815814
/// ```
816815
#[inline]
817816
#[unstable(feature = "f16", issue = "116909")]
818-
// #[unstable(feature = "num_midpoint", issue = "110840")]
819817
pub fn midpoint(self, other: f16) -> f16 {
820818
const LO: f16 = f16::MIN_POSITIVE * 2.;
821819
const HI: f16 = f16::MAX / 2.;

library/core/src/num/f32.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -989,12 +989,11 @@ impl f32 {
989989
/// # Examples
990990
///
991991
/// ```
992-
/// #![feature(num_midpoint)]
993992
/// assert_eq!(1f32.midpoint(4.0), 2.5);
994993
/// assert_eq!((-5.5f32).midpoint(8.0), 1.25);
995994
/// ```
996995
#[inline]
997-
#[unstable(feature = "num_midpoint", issue = "110840")]
996+
#[stable(feature = "num_midpoint", since = "CURRENT_RUSTC_VERSION")]
998997
pub fn midpoint(self, other: f32) -> f32 {
999998
cfg_if! {
1000999
if #[cfg(any(

library/core/src/num/f64.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1007,12 +1007,11 @@ impl f64 {
10071007
/// # Examples
10081008
///
10091009
/// ```
1010-
/// #![feature(num_midpoint)]
10111010
/// assert_eq!(1f64.midpoint(4.0), 2.5);
10121011
/// assert_eq!((-5.5f64).midpoint(8.0), 1.25);
10131012
/// ```
10141013
#[inline]
1015-
#[unstable(feature = "num_midpoint", issue = "110840")]
1014+
#[stable(feature = "num_midpoint", since = "CURRENT_RUSTC_VERSION")]
10161015
pub fn midpoint(self, other: f64) -> f64 {
10171016
const LO: f64 = f64::MIN_POSITIVE * 2.;
10181017
const HI: f64 = f64::MAX / 2.;

library/core/src/num/int_macros.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -3190,14 +3190,13 @@ macro_rules! int_impl {
31903190
/// # Examples
31913191
///
31923192
/// ```
3193-
/// #![feature(num_midpoint)]
3193+
/// #![feature(num_midpoint_signed)]
31943194
#[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(4), 2);")]
31953195
#[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(-1), -1);")]
31963196
#[doc = concat!("assert_eq!((-1", stringify!($SelfT), ").midpoint(0), -1);")]
31973197
/// ```
3198-
#[unstable(feature = "num_midpoint", issue = "110840")]
3199-
#[rustc_const_unstable(feature = "const_num_midpoint", issue = "110840")]
3200-
#[rustc_allow_const_fn_unstable(const_num_midpoint)]
3198+
#[unstable(feature = "num_midpoint_signed", issue = "110840")]
3199+
#[rustc_const_unstable(feature = "num_midpoint_signed", issue = "110840")]
32013200
#[must_use = "this returns the result of the operation, \
32023201
without modifying the original"]
32033202
#[inline]

library/core/src/num/mod.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,17 @@ macro_rules! midpoint_impl {
110110
/// Calculates the middle point of `self` and `rhs`.
111111
///
112112
/// `midpoint(a, b)` is `(a + b) >> 1` as if it were performed in a
113-
/// sufficiently-large signed integral type. This implies that the result is
113+
/// sufficiently-large unsigned integral type. This implies that the result is
114114
/// always rounded towards negative infinity and that no overflow will ever occur.
115115
///
116116
/// # Examples
117117
///
118118
/// ```
119-
/// #![feature(num_midpoint)]
120119
#[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(4), 2);")]
121120
#[doc = concat!("assert_eq!(1", stringify!($SelfT), ".midpoint(4), 2);")]
122121
/// ```
123-
#[unstable(feature = "num_midpoint", issue = "110840")]
124-
#[rustc_const_unstable(feature = "const_num_midpoint", issue = "110840")]
122+
#[stable(feature = "num_midpoint", since = "CURRENT_RUSTC_VERSION")]
123+
#[rustc_const_stable(feature = "const_num_midpoint", since = "CURRENT_RUSTC_VERSION")]
125124
#[must_use = "this returns the result of the operation, \
126125
without modifying the original"]
127126
#[inline]
@@ -135,18 +134,17 @@ macro_rules! midpoint_impl {
135134
/// Calculates the middle point of `self` and `rhs`.
136135
///
137136
/// `midpoint(a, b)` is `(a + b) >> 1` as if it were performed in a
138-
/// sufficiently-large signed integral type. This implies that the result is
137+
/// sufficiently-large unsigned integral type. This implies that the result is
139138
/// always rounded towards negative infinity and that no overflow will ever occur.
140139
///
141140
/// # Examples
142141
///
143142
/// ```
144-
/// #![feature(num_midpoint)]
145143
#[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(4), 2);")]
146144
#[doc = concat!("assert_eq!(1", stringify!($SelfT), ".midpoint(4), 2);")]
147145
/// ```
148-
#[unstable(feature = "num_midpoint", issue = "110840")]
149-
#[rustc_const_unstable(feature = "const_num_midpoint", issue = "110840")]
146+
#[stable(feature = "num_midpoint", since = "CURRENT_RUSTC_VERSION")]
147+
#[rustc_const_stable(feature = "const_num_midpoint", since = "CURRENT_RUSTC_VERSION")]
150148
#[must_use = "this returns the result of the operation, \
151149
without modifying the original"]
152150
#[inline]

library/core/src/num/nonzero.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -1458,8 +1458,6 @@ macro_rules! nonzero_integer_signedness_dependent_methods {
14581458
/// # Examples
14591459
///
14601460
/// ```
1461-
/// #![feature(num_midpoint)]
1462-
///
14631461
/// # use std::num::NonZero;
14641462
/// #
14651463
/// # fn main() { test().unwrap(); }
@@ -1473,9 +1471,8 @@ macro_rules! nonzero_integer_signedness_dependent_methods {
14731471
/// # Some(())
14741472
/// # }
14751473
/// ```
1476-
#[unstable(feature = "num_midpoint", issue = "110840")]
1477-
#[rustc_const_unstable(feature = "const_num_midpoint", issue = "110840")]
1478-
#[rustc_allow_const_fn_unstable(const_num_midpoint)]
1474+
#[stable(feature = "num_midpoint", since = "CURRENT_RUSTC_VERSION")]
1475+
#[rustc_const_stable(feature = "const_num_midpoint", since = "CURRENT_RUSTC_VERSION")]
14791476
#[must_use = "this returns the result of the operation, \
14801477
without modifying the original"]
14811478
#[inline]

library/core/tests/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
#![feature(min_specialization)]
7373
#![feature(never_type)]
7474
#![feature(noop_waker)]
75-
#![feature(num_midpoint)]
75+
#![feature(num_midpoint_signed)]
7676
#![feature(numfmt)]
7777
#![feature(pattern)]
7878
#![feature(pointer_is_aligned_to)]

0 commit comments

Comments
 (0)