Auto merge of #130157 - eduardosm:stabilize-const_float_classify, r=R… · qinheping/verify-rust-std@eb2806b (original) (raw)
`@@ -517,7 +517,7 @@ impl f32 {
`
517
517
```` /// ```
`518`
`518`
`#[must_use]
`
`519`
`519`
`#[stable(feature = "rust1", since = "1.0.0")]
`
`520`
``
`-
#[rustc_const_unstable(feature = "const_float_classify", issue = "72505")]
`
``
`520`
`+
#[rustc_const_stable(feature = "const_float_classify", since = "CURRENT_RUSTC_VERSION")]
`
`521`
`521`
`#[inline]
`
`522`
`522`
`` #[allow(clippy::eq_op)] // > if you intended to check if the operand is NaN, use `.is_nan()` instead :)
``
`523`
`523`
`pub const fn is_nan(self) -> bool {
`
`@@ -528,7 +528,6 @@ impl f32 {
`
`528`
`528`
`// concerns about portability, so this implementation is for
`
`529`
`529`
`// private use internally.
`
`530`
`530`
`#[inline]
`
`531`
``
`-
#[rustc_const_unstable(feature = "const_float_classify", issue = "72505")]
`
`532`
`531`
`pub(crate) const fn abs_private(self) -> f32 {
`
`533`
`532`
`` // SAFETY: This transmutation is fine just like in `to_bits`/`from_bits`.
``
`534`
`533`
`unsafe { mem::transmute::<u32, f32>(mem::transmute::<f32, u32>(self) & !Self::SIGN_MASK) }
`
`@@ -551,7 +550,7 @@ impl f32 {
`
`551`
`550`
```` /// ```
552
551
`#[must_use]
`
553
552
`#[stable(feature = "rust1", since = "1.0.0")]
`
554
``
`-
#[rustc_const_unstable(feature = "const_float_classify", issue = "72505")]
`
``
553
`+
#[rustc_const_stable(feature = "const_float_classify", since = "CURRENT_RUSTC_VERSION")]
`
555
554
`#[inline]
`
556
555
`pub const fn is_infinite(self) -> bool {
`
557
556
`// Getting clever with transmutation can result in incorrect answers on some FPUs
`
`@@ -576,7 +575,7 @@ impl f32 {
`
576
575
```` /// ```
`577`
`576`
`#[must_use]
`
`578`
`577`
`#[stable(feature = "rust1", since = "1.0.0")]
`
`579`
``
`-
#[rustc_const_unstable(feature = "const_float_classify", issue = "72505")]
`
``
`578`
`+
#[rustc_const_stable(feature = "const_float_classify", since = "CURRENT_RUSTC_VERSION")]
`
`580`
`579`
`#[inline]
`
`581`
`580`
`pub const fn is_finite(self) -> bool {
`
`582`
`581`
`// There's no need to handle NaN separately: if self is NaN,
`
`@@ -604,7 +603,7 @@ impl f32 {
`
`604`
`603`
`/// [subnormal]: https://en.wikipedia.org/wiki/Denormal_number
`
`605`
`604`
`#[must_use]
`
`606`
`605`
`#[stable(feature = "is_subnormal", since = "1.53.0")]
`
`607`
``
`-
#[rustc_const_unstable(feature = "const_float_classify", issue = "72505")]
`
``
`606`
`+
#[rustc_const_stable(feature = "const_float_classify", since = "CURRENT_RUSTC_VERSION")]
`
`608`
`607`
`#[inline]
`
`609`
`608`
`pub const fn is_subnormal(self) -> bool {
`
`610`
`609`
`matches!(self.classify(), FpCategory::Subnormal)
`
`@@ -631,7 +630,7 @@ impl f32 {
`
`631`
`630`
`/// [subnormal]: https://en.wikipedia.org/wiki/Denormal_number
`
`632`
`631`
`#[must_use]
`
`633`
`632`
`#[stable(feature = "rust1", since = "1.0.0")]
`
`634`
``
`-
#[rustc_const_unstable(feature = "const_float_classify", issue = "72505")]
`
``
`633`
`+
#[rustc_const_stable(feature = "const_float_classify", since = "CURRENT_RUSTC_VERSION")]
`
`635`
`634`
`#[inline]
`
`636`
`635`
`pub const fn is_normal(self) -> bool {
`
`637`
`636`
`matches!(self.classify(), FpCategory::Normal)
`
`@@ -651,7 +650,7 @@ impl f32 {
`
`651`
`650`
`/// assert_eq!(inf.classify(), FpCategory::Infinite);
`
`652`
`651`
```` /// ```
653
652
`#[stable(feature = "rust1", since = "1.0.0")]
`
654
``
`-
#[rustc_const_unstable(feature = "const_float_classify", issue = "72505")]
`
``
653
`+
#[rustc_const_stable(feature = "const_float_classify", since = "CURRENT_RUSTC_VERSION")]
`
655
654
`pub const fn classify(self) -> FpCategory {
`
656
655
`// We used to have complicated logic here that avoids the simple bit-based tests to work
`
657
656
`// around buggy codegen for x87 targets (see
`
`@@ -687,7 +686,7 @@ impl f32 {
`
687
686
```` /// ```
`688`
`687`
`#[must_use]
`
`689`
`688`
`#[stable(feature = "rust1", since = "1.0.0")]
`
`690`
``
`-
#[rustc_const_unstable(feature = "const_float_classify", issue = "72505")]
`
``
`689`
`+
#[rustc_const_stable(feature = "const_float_classify", since = "CURRENT_RUSTC_VERSION")]
`
`691`
`690`
`#[inline]
`
`692`
`691`
`pub const fn is_sign_positive(self) -> bool {
`
`693`
`692`
` !self.is_sign_negative()
`
`@@ -712,7 +711,7 @@ impl f32 {
`
`712`
`711`
```` /// ```
713
712
`#[must_use]
`
714
713
`#[stable(feature = "rust1", since = "1.0.0")]
`
715
``
`-
#[rustc_const_unstable(feature = "const_float_classify", issue = "72505")]
`
``
714
`+
#[rustc_const_stable(feature = "const_float_classify", since = "CURRENT_RUSTC_VERSION")]
`
716
715
`#[inline]
`
717
716
`pub const fn is_sign_negative(self) -> bool {
`
718
717
`// IEEE754 says: isSignMinus(x) is true if and only if x has negative sign. isSignMinus
`