Skip to content

Commit fe9afd2

Browse files
matthiaskrgrgitbot
authored and
gitbot
committed
Rollup merge of rust-lang#135661 - tgross35:stabilize-float_next_up_down, r=scottmcm
Stabilize `float_next_up_down` FCP completed at [1]. For `f16` and `f128`, this just removes the gates in comments and doctests. Closes rust-lang#91399 [1]: rust-lang#91399 (comment)
2 parents 1f893ef + 1cdc6e3 commit fe9afd2

File tree

5 files changed

+32
-17
lines changed

5 files changed

+32
-17
lines changed

core/src/num/f128.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,6 @@ impl f128 {
504504
///
505505
/// ```rust
506506
/// #![feature(f128)]
507-
/// #![feature(float_next_up_down)]
508507
/// # // FIXME(f16_f128): remove when `eqtf2` is available
509508
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
510509
///
@@ -516,13 +515,15 @@ impl f128 {
516515
/// # }
517516
/// ```
518517
///
518+
/// This operation corresponds to IEEE-754 `nextUp`.
519+
///
519520
/// [`NEG_INFINITY`]: Self::NEG_INFINITY
520521
/// [`INFINITY`]: Self::INFINITY
521522
/// [`MIN`]: Self::MIN
522523
/// [`MAX`]: Self::MAX
523524
#[inline]
525+
#[doc(alias = "nextUp")]
524526
#[unstable(feature = "f128", issue = "116909")]
525-
// #[unstable(feature = "float_next_up_down", issue = "91399")]
526527
pub const fn next_up(self) -> Self {
527528
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
528529
// denormals to zero. This is in general unsound and unsupported, but here
@@ -558,7 +559,6 @@ impl f128 {
558559
///
559560
/// ```rust
560561
/// #![feature(f128)]
561-
/// #![feature(float_next_up_down)]
562562
/// # // FIXME(f16_f128): remove when `eqtf2` is available
563563
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
564564
///
@@ -570,13 +570,15 @@ impl f128 {
570570
/// # }
571571
/// ```
572572
///
573+
/// This operation corresponds to IEEE-754 `nextDown`.
574+
///
573575
/// [`NEG_INFINITY`]: Self::NEG_INFINITY
574576
/// [`INFINITY`]: Self::INFINITY
575577
/// [`MIN`]: Self::MIN
576578
/// [`MAX`]: Self::MAX
577579
#[inline]
580+
#[doc(alias = "nextDown")]
578581
#[unstable(feature = "f128", issue = "116909")]
579-
// #[unstable(feature = "float_next_up_down", issue = "91399")]
580582
pub const fn next_down(self) -> Self {
581583
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
582584
// denormals to zero. This is in general unsound and unsupported, but here

core/src/num/f16.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,6 @@ impl f16 {
497497
///
498498
/// ```rust
499499
/// #![feature(f16)]
500-
/// #![feature(float_next_up_down)]
501500
/// # // FIXME(f16_f128): ABI issues on MSVC
502501
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
503502
///
@@ -509,13 +508,15 @@ impl f16 {
509508
/// # }
510509
/// ```
511510
///
511+
/// This operation corresponds to IEEE-754 `nextUp`.
512+
///
512513
/// [`NEG_INFINITY`]: Self::NEG_INFINITY
513514
/// [`INFINITY`]: Self::INFINITY
514515
/// [`MIN`]: Self::MIN
515516
/// [`MAX`]: Self::MAX
516517
#[inline]
518+
#[doc(alias = "nextUp")]
517519
#[unstable(feature = "f16", issue = "116909")]
518-
// #[unstable(feature = "float_next_up_down", issue = "91399")]
519520
pub const fn next_up(self) -> Self {
520521
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
521522
// denormals to zero. This is in general unsound and unsupported, but here
@@ -551,7 +552,6 @@ impl f16 {
551552
///
552553
/// ```rust
553554
/// #![feature(f16)]
554-
/// #![feature(float_next_up_down)]
555555
/// # // FIXME(f16_f128): ABI issues on MSVC
556556
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
557557
///
@@ -563,13 +563,15 @@ impl f16 {
563563
/// # }
564564
/// ```
565565
///
566+
/// This operation corresponds to IEEE-754 `nextDown`.
567+
///
566568
/// [`NEG_INFINITY`]: Self::NEG_INFINITY
567569
/// [`INFINITY`]: Self::INFINITY
568570
/// [`MIN`]: Self::MIN
569571
/// [`MAX`]: Self::MAX
570572
#[inline]
573+
#[doc(alias = "nextDown")]
571574
#[unstable(feature = "f16", issue = "116909")]
572-
// #[unstable(feature = "float_next_up_down", issue = "91399")]
573575
pub const fn next_down(self) -> Self {
574576
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
575577
// denormals to zero. This is in general unsound and unsupported, but here

core/src/num/f32.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -726,20 +726,23 @@ impl f32 {
726726
/// is finite `x == x.next_up().next_down()` also holds.
727727
///
728728
/// ```rust
729-
/// #![feature(float_next_up_down)]
730729
/// // f32::EPSILON is the difference between 1.0 and the next number up.
731730
/// assert_eq!(1.0f32.next_up(), 1.0 + f32::EPSILON);
732731
/// // But not for most numbers.
733732
/// assert!(0.1f32.next_up() < 0.1 + f32::EPSILON);
734733
/// assert_eq!(16777216f32.next_up(), 16777218.0);
735734
/// ```
736735
///
736+
/// This operation corresponds to IEEE-754 `nextUp`.
737+
///
737738
/// [`NEG_INFINITY`]: Self::NEG_INFINITY
738739
/// [`INFINITY`]: Self::INFINITY
739740
/// [`MIN`]: Self::MIN
740741
/// [`MAX`]: Self::MAX
741742
#[inline]
742-
#[unstable(feature = "float_next_up_down", issue = "91399")]
743+
#[doc(alias = "nextUp")]
744+
#[stable(feature = "float_next_up_down", since = "CURRENT_RUSTC_VERSION")]
745+
#[rustc_const_stable(feature = "float_next_up_down", since = "CURRENT_RUSTC_VERSION")]
743746
pub const fn next_up(self) -> Self {
744747
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
745748
// denormals to zero. This is in general unsound and unsupported, but here
@@ -774,20 +777,23 @@ impl f32 {
774777
/// is finite `x == x.next_down().next_up()` also holds.
775778
///
776779
/// ```rust
777-
/// #![feature(float_next_up_down)]
778780
/// let x = 1.0f32;
779781
/// // Clamp value into range [0, 1).
780782
/// let clamped = x.clamp(0.0, 1.0f32.next_down());
781783
/// assert!(clamped < 1.0);
782784
/// assert_eq!(clamped.next_up(), 1.0);
783785
/// ```
784786
///
787+
/// This operation corresponds to IEEE-754 `nextDown`.
788+
///
785789
/// [`NEG_INFINITY`]: Self::NEG_INFINITY
786790
/// [`INFINITY`]: Self::INFINITY
787791
/// [`MIN`]: Self::MIN
788792
/// [`MAX`]: Self::MAX
789793
#[inline]
790-
#[unstable(feature = "float_next_up_down", issue = "91399")]
794+
#[doc(alias = "nextDown")]
795+
#[stable(feature = "float_next_up_down", since = "CURRENT_RUSTC_VERSION")]
796+
#[rustc_const_stable(feature = "float_next_up_down", since = "CURRENT_RUSTC_VERSION")]
791797
pub const fn next_down(self) -> Self {
792798
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
793799
// denormals to zero. This is in general unsound and unsupported, but here

core/src/num/f64.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -743,20 +743,23 @@ impl f64 {
743743
/// is finite `x == x.next_up().next_down()` also holds.
744744
///
745745
/// ```rust
746-
/// #![feature(float_next_up_down)]
747746
/// // f64::EPSILON is the difference between 1.0 and the next number up.
748747
/// assert_eq!(1.0f64.next_up(), 1.0 + f64::EPSILON);
749748
/// // But not for most numbers.
750749
/// assert!(0.1f64.next_up() < 0.1 + f64::EPSILON);
751750
/// assert_eq!(9007199254740992f64.next_up(), 9007199254740994.0);
752751
/// ```
753752
///
753+
/// This operation corresponds to IEEE-754 `nextUp`.
754+
///
754755
/// [`NEG_INFINITY`]: Self::NEG_INFINITY
755756
/// [`INFINITY`]: Self::INFINITY
756757
/// [`MIN`]: Self::MIN
757758
/// [`MAX`]: Self::MAX
758759
#[inline]
759-
#[unstable(feature = "float_next_up_down", issue = "91399")]
760+
#[doc(alias = "nextUp")]
761+
#[stable(feature = "float_next_up_down", since = "CURRENT_RUSTC_VERSION")]
762+
#[rustc_const_stable(feature = "float_next_up_down", since = "CURRENT_RUSTC_VERSION")]
760763
pub const fn next_up(self) -> Self {
761764
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
762765
// denormals to zero. This is in general unsound and unsupported, but here
@@ -791,20 +794,23 @@ impl f64 {
791794
/// is finite `x == x.next_down().next_up()` also holds.
792795
///
793796
/// ```rust
794-
/// #![feature(float_next_up_down)]
795797
/// let x = 1.0f64;
796798
/// // Clamp value into range [0, 1).
797799
/// let clamped = x.clamp(0.0, 1.0f64.next_down());
798800
/// assert!(clamped < 1.0);
799801
/// assert_eq!(clamped.next_up(), 1.0);
800802
/// ```
801803
///
804+
/// This operation corresponds to IEEE-754 `nextDown`.
805+
///
802806
/// [`NEG_INFINITY`]: Self::NEG_INFINITY
803807
/// [`INFINITY`]: Self::INFINITY
804808
/// [`MIN`]: Self::MIN
805809
/// [`MAX`]: Self::MAX
806810
#[inline]
807-
#[unstable(feature = "float_next_up_down", issue = "91399")]
811+
#[doc(alias = "nextDown")]
812+
#[stable(feature = "float_next_up_down", since = "CURRENT_RUSTC_VERSION")]
813+
#[rustc_const_stable(feature = "float_next_up_down", since = "CURRENT_RUSTC_VERSION")]
808814
pub const fn next_down(self) -> Self {
809815
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
810816
// denormals to zero. This is in general unsound and unsupported, but here

std/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@
333333
#![feature(extend_one)]
334334
#![feature(float_gamma)]
335335
#![feature(float_minimum_maximum)]
336-
#![feature(float_next_up_down)]
337336
#![feature(fmt_internals)]
338337
#![feature(hasher_prefixfree_extras)]
339338
#![feature(hashmap_internals)]

0 commit comments

Comments
 (0)