From 17671569f21f92b5e8acca4e106f4eef1d50513d Mon Sep 17 00:00:00 2001 From: cyrgani Date: Mon, 22 Sep 2025 15:09:43 +0200 Subject: [PATCH] fully deprecate the legacy integral modules --- .../src/dep_graph/serialized.rs | 2 +- library/core/src/lib.rs | 6 +- library/core/src/num/f32.rs | 62 +++++++++------- library/core/src/num/f64.rs | 62 +++++++++------- library/core/src/num/int_macros.rs | 4 +- .../core/src/num/shells/legacy_int_modules.rs | 8 +- library/core/src/num/uint_macros.rs | 4 +- library/coretests/tests/array.rs | 2 +- library/coretests/tests/num/int_macros.rs | 3 +- library/coretests/tests/num/uint_macros.rs | 15 ++-- .../stdarch/crates/core_arch/src/mips/msa.rs | 1 - .../ui/confusing_method_to_numeric_cast.fixed | 2 +- .../ui/confusing_method_to_numeric_cast.rs | 2 +- .../ui/manual_saturating_arithmetic.fixed | 2 +- .../tests/ui/manual_saturating_arithmetic.rs | 2 +- .../tests/ui/suspicious_arithmetic_impl.rs | 2 +- src/tools/miri/tests/pass/float.rs | 74 ++++++++++--------- .../pass/shims/x86/intrinsics-x86-sse.rs | 3 +- .../pass/shims/x86/intrinsics-x86-sse2.rs | 3 +- src/tools/rustfmt/src/vertical.rs | 2 +- tests/ui/consts/issue-90762.rs | 2 +- 21 files changed, 138 insertions(+), 125 deletions(-) diff --git a/compiler/rustc_query_system/src/dep_graph/serialized.rs b/compiler/rustc_query_system/src/dep_graph/serialized.rs index 0012bf79a1f5d..061e29048e213 100644 --- a/compiler/rustc_query_system/src/dep_graph/serialized.rs +++ b/compiler/rustc_query_system/src/dep_graph/serialized.rs @@ -44,7 +44,7 @@ use std::cmp::max; use std::marker::PhantomData; use std::sync::Arc; use std::sync::atomic::Ordering; -use std::{iter, mem, u64}; +use std::{iter, mem}; use rustc_data_structures::fingerprint::{Fingerprint, PackedFingerprint}; use rustc_data_structures::fx::FxHashMap; diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 9ecc2365e69b7..11ae915e0525c 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -256,12 +256,10 @@ mod internal_macros; #[path = "num/shells/legacy_int_modules.rs"] mod legacy_int_modules; #[stable(feature = "rust1", since = "1.0.0")] -#[allow(clippy::useless_attribute)] // FIXME false positive (https://github.com/rust-lang/rust-clippy/issues/15636) -#[allow(deprecated_in_future)] +#[allow(deprecated)] pub use legacy_int_modules::{i8, i16, i32, i64, isize, u8, u16, u32, u64, usize}; #[stable(feature = "i128", since = "1.26.0")] -#[allow(clippy::useless_attribute)] // FIXME false positive (https://github.com/rust-lang/rust-clippy/issues/15636) -#[allow(deprecated_in_future)] +#[allow(deprecated)] pub use legacy_int_modules::{i128, u128}; #[path = "num/f128.rs"] diff --git a/library/core/src/num/f32.rs b/library/core/src/num/f32.rs index 6fe4285374b23..f087d0c5c53f4 100644 --- a/library/core/src/num/f32.rs +++ b/library/core/src/num/f32.rs @@ -23,14 +23,14 @@ use crate::{cfg_select, intrinsics, mem}; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let r = std::f32::RADIX; /// /// // intended way /// let r = f32::RADIX; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `RADIX` associated constant on `f32`")] +#[deprecated(since = "1.94.0", note = "replaced by the `RADIX` associated constant on `f32`")] #[rustc_diagnostic_item = "f32_legacy_const_radix"] pub const RADIX: u32 = f32::RADIX; @@ -41,7 +41,7 @@ pub const RADIX: u32 = f32::RADIX; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let d = std::f32::MANTISSA_DIGITS; /// /// // intended way @@ -49,7 +49,7 @@ pub const RADIX: u32 = f32::RADIX; /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[deprecated( - since = "TBD", + since = "1.94.0", note = "replaced by the `MANTISSA_DIGITS` associated constant on `f32`" )] #[rustc_diagnostic_item = "f32_legacy_const_mantissa_dig"] @@ -62,14 +62,14 @@ pub const MANTISSA_DIGITS: u32 = f32::MANTISSA_DIGITS; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let d = std::f32::DIGITS; /// /// // intended way /// let d = f32::DIGITS; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `DIGITS` associated constant on `f32`")] +#[deprecated(since = "1.94.0", note = "replaced by the `DIGITS` associated constant on `f32`")] #[rustc_diagnostic_item = "f32_legacy_const_digits"] pub const DIGITS: u32 = f32::DIGITS; @@ -84,14 +84,14 @@ pub const DIGITS: u32 = f32::DIGITS; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let e = std::f32::EPSILON; /// /// // intended way /// let e = f32::EPSILON; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `EPSILON` associated constant on `f32`")] +#[deprecated(since = "1.94.0", note = "replaced by the `EPSILON` associated constant on `f32`")] #[rustc_diagnostic_item = "f32_legacy_const_epsilon"] pub const EPSILON: f32 = f32::EPSILON; @@ -102,14 +102,14 @@ pub const EPSILON: f32 = f32::EPSILON; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let min = std::f32::MIN; /// /// // intended way /// let min = f32::MIN; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `MIN` associated constant on `f32`")] +#[deprecated(since = "1.94.0", note = "replaced by the `MIN` associated constant on `f32`")] #[rustc_diagnostic_item = "f32_legacy_const_min"] pub const MIN: f32 = f32::MIN; @@ -120,14 +120,17 @@ pub const MIN: f32 = f32::MIN; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let min = std::f32::MIN_POSITIVE; /// /// // intended way /// let min = f32::MIN_POSITIVE; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `MIN_POSITIVE` associated constant on `f32`")] +#[deprecated( + since = "1.94.0", + note = "replaced by the `MIN_POSITIVE` associated constant on `f32`" +)] #[rustc_diagnostic_item = "f32_legacy_const_min_positive"] pub const MIN_POSITIVE: f32 = f32::MIN_POSITIVE; @@ -138,14 +141,14 @@ pub const MIN_POSITIVE: f32 = f32::MIN_POSITIVE; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let max = std::f32::MAX; /// /// // intended way /// let max = f32::MAX; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `MAX` associated constant on `f32`")] +#[deprecated(since = "1.94.0", note = "replaced by the `MAX` associated constant on `f32`")] #[rustc_diagnostic_item = "f32_legacy_const_max"] pub const MAX: f32 = f32::MAX; @@ -156,14 +159,14 @@ pub const MAX: f32 = f32::MAX; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let min = std::f32::MIN_EXP; /// /// // intended way /// let min = f32::MIN_EXP; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `MIN_EXP` associated constant on `f32`")] +#[deprecated(since = "1.94.0", note = "replaced by the `MIN_EXP` associated constant on `f32`")] #[rustc_diagnostic_item = "f32_legacy_const_min_exp"] pub const MIN_EXP: i32 = f32::MIN_EXP; @@ -174,14 +177,14 @@ pub const MIN_EXP: i32 = f32::MIN_EXP; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let max = std::f32::MAX_EXP; /// /// // intended way /// let max = f32::MAX_EXP; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `MAX_EXP` associated constant on `f32`")] +#[deprecated(since = "1.94.0", note = "replaced by the `MAX_EXP` associated constant on `f32`")] #[rustc_diagnostic_item = "f32_legacy_const_max_exp"] pub const MAX_EXP: i32 = f32::MAX_EXP; @@ -192,14 +195,14 @@ pub const MAX_EXP: i32 = f32::MAX_EXP; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let min = std::f32::MIN_10_EXP; /// /// // intended way /// let min = f32::MIN_10_EXP; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `MIN_10_EXP` associated constant on `f32`")] +#[deprecated(since = "1.94.0", note = "replaced by the `MIN_10_EXP` associated constant on `f32`")] #[rustc_diagnostic_item = "f32_legacy_const_min_10_exp"] pub const MIN_10_EXP: i32 = f32::MIN_10_EXP; @@ -210,14 +213,14 @@ pub const MIN_10_EXP: i32 = f32::MIN_10_EXP; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let max = std::f32::MAX_10_EXP; /// /// // intended way /// let max = f32::MAX_10_EXP; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `MAX_10_EXP` associated constant on `f32`")] +#[deprecated(since = "1.94.0", note = "replaced by the `MAX_10_EXP` associated constant on `f32`")] #[rustc_diagnostic_item = "f32_legacy_const_max_10_exp"] pub const MAX_10_EXP: i32 = f32::MAX_10_EXP; @@ -228,14 +231,14 @@ pub const MAX_10_EXP: i32 = f32::MAX_10_EXP; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let nan = std::f32::NAN; /// /// // intended way /// let nan = f32::NAN; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `NAN` associated constant on `f32`")] +#[deprecated(since = "1.94.0", note = "replaced by the `NAN` associated constant on `f32`")] #[rustc_diagnostic_item = "f32_legacy_const_nan"] pub const NAN: f32 = f32::NAN; @@ -246,14 +249,14 @@ pub const NAN: f32 = f32::NAN; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let inf = std::f32::INFINITY; /// /// // intended way /// let inf = f32::INFINITY; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `INFINITY` associated constant on `f32`")] +#[deprecated(since = "1.94.0", note = "replaced by the `INFINITY` associated constant on `f32`")] #[rustc_diagnostic_item = "f32_legacy_const_infinity"] pub const INFINITY: f32 = f32::INFINITY; @@ -264,14 +267,17 @@ pub const INFINITY: f32 = f32::INFINITY; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let ninf = std::f32::NEG_INFINITY; /// /// // intended way /// let ninf = f32::NEG_INFINITY; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `NEG_INFINITY` associated constant on `f32`")] +#[deprecated( + since = "1.94.0", + note = "replaced by the `NEG_INFINITY` associated constant on `f32`" +)] #[rustc_diagnostic_item = "f32_legacy_const_neg_infinity"] pub const NEG_INFINITY: f32 = f32::NEG_INFINITY; diff --git a/library/core/src/num/f64.rs b/library/core/src/num/f64.rs index d0aca152415e2..e4410937fdfe2 100644 --- a/library/core/src/num/f64.rs +++ b/library/core/src/num/f64.rs @@ -23,14 +23,14 @@ use crate::{intrinsics, mem}; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let r = std::f64::RADIX; /// /// // intended way /// let r = f64::RADIX; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `RADIX` associated constant on `f64`")] +#[deprecated(since = "1.94.0", note = "replaced by the `RADIX` associated constant on `f64`")] #[rustc_diagnostic_item = "f64_legacy_const_radix"] pub const RADIX: u32 = f64::RADIX; @@ -41,7 +41,7 @@ pub const RADIX: u32 = f64::RADIX; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let d = std::f64::MANTISSA_DIGITS; /// /// // intended way @@ -49,7 +49,7 @@ pub const RADIX: u32 = f64::RADIX; /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[deprecated( - since = "TBD", + since = "1.94.0", note = "replaced by the `MANTISSA_DIGITS` associated constant on `f64`" )] #[rustc_diagnostic_item = "f64_legacy_const_mantissa_dig"] @@ -62,14 +62,14 @@ pub const MANTISSA_DIGITS: u32 = f64::MANTISSA_DIGITS; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let d = std::f64::DIGITS; /// /// // intended way /// let d = f64::DIGITS; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `DIGITS` associated constant on `f64`")] +#[deprecated(since = "1.94.0", note = "replaced by the `DIGITS` associated constant on `f64`")] #[rustc_diagnostic_item = "f64_legacy_const_digits"] pub const DIGITS: u32 = f64::DIGITS; @@ -84,14 +84,14 @@ pub const DIGITS: u32 = f64::DIGITS; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let e = std::f64::EPSILON; /// /// // intended way /// let e = f64::EPSILON; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `EPSILON` associated constant on `f64`")] +#[deprecated(since = "1.94.0", note = "replaced by the `EPSILON` associated constant on `f64`")] #[rustc_diagnostic_item = "f64_legacy_const_epsilon"] pub const EPSILON: f64 = f64::EPSILON; @@ -102,14 +102,14 @@ pub const EPSILON: f64 = f64::EPSILON; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let min = std::f64::MIN; /// /// // intended way /// let min = f64::MIN; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `MIN` associated constant on `f64`")] +#[deprecated(since = "1.94.0", note = "replaced by the `MIN` associated constant on `f64`")] #[rustc_diagnostic_item = "f64_legacy_const_min"] pub const MIN: f64 = f64::MIN; @@ -120,14 +120,17 @@ pub const MIN: f64 = f64::MIN; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let min = std::f64::MIN_POSITIVE; /// /// // intended way /// let min = f64::MIN_POSITIVE; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `MIN_POSITIVE` associated constant on `f64`")] +#[deprecated( + since = "1.94.0", + note = "replaced by the `MIN_POSITIVE` associated constant on `f64`" +)] #[rustc_diagnostic_item = "f64_legacy_const_min_positive"] pub const MIN_POSITIVE: f64 = f64::MIN_POSITIVE; @@ -138,14 +141,14 @@ pub const MIN_POSITIVE: f64 = f64::MIN_POSITIVE; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let max = std::f64::MAX; /// /// // intended way /// let max = f64::MAX; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `MAX` associated constant on `f64`")] +#[deprecated(since = "1.94.0", note = "replaced by the `MAX` associated constant on `f64`")] #[rustc_diagnostic_item = "f64_legacy_const_max"] pub const MAX: f64 = f64::MAX; @@ -156,14 +159,14 @@ pub const MAX: f64 = f64::MAX; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let min = std::f64::MIN_EXP; /// /// // intended way /// let min = f64::MIN_EXP; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `MIN_EXP` associated constant on `f64`")] +#[deprecated(since = "1.94.0", note = "replaced by the `MIN_EXP` associated constant on `f64`")] #[rustc_diagnostic_item = "f64_legacy_const_min_exp"] pub const MIN_EXP: i32 = f64::MIN_EXP; @@ -174,14 +177,14 @@ pub const MIN_EXP: i32 = f64::MIN_EXP; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let max = std::f64::MAX_EXP; /// /// // intended way /// let max = f64::MAX_EXP; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `MAX_EXP` associated constant on `f64`")] +#[deprecated(since = "1.94.0", note = "replaced by the `MAX_EXP` associated constant on `f64`")] #[rustc_diagnostic_item = "f64_legacy_const_max_exp"] pub const MAX_EXP: i32 = f64::MAX_EXP; @@ -192,14 +195,14 @@ pub const MAX_EXP: i32 = f64::MAX_EXP; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let min = std::f64::MIN_10_EXP; /// /// // intended way /// let min = f64::MIN_10_EXP; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `MIN_10_EXP` associated constant on `f64`")] +#[deprecated(since = "1.94.0", note = "replaced by the `MIN_10_EXP` associated constant on `f64`")] #[rustc_diagnostic_item = "f64_legacy_const_min_10_exp"] pub const MIN_10_EXP: i32 = f64::MIN_10_EXP; @@ -210,14 +213,14 @@ pub const MIN_10_EXP: i32 = f64::MIN_10_EXP; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let max = std::f64::MAX_10_EXP; /// /// // intended way /// let max = f64::MAX_10_EXP; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `MAX_10_EXP` associated constant on `f64`")] +#[deprecated(since = "1.94.0", note = "replaced by the `MAX_10_EXP` associated constant on `f64`")] #[rustc_diagnostic_item = "f64_legacy_const_max_10_exp"] pub const MAX_10_EXP: i32 = f64::MAX_10_EXP; @@ -228,14 +231,14 @@ pub const MAX_10_EXP: i32 = f64::MAX_10_EXP; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let nan = std::f64::NAN; /// /// // intended way /// let nan = f64::NAN; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `NAN` associated constant on `f64`")] +#[deprecated(since = "1.94.0", note = "replaced by the `NAN` associated constant on `f64`")] #[rustc_diagnostic_item = "f64_legacy_const_nan"] pub const NAN: f64 = f64::NAN; @@ -246,14 +249,14 @@ pub const NAN: f64 = f64::NAN; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let inf = std::f64::INFINITY; /// /// // intended way /// let inf = f64::INFINITY; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `INFINITY` associated constant on `f64`")] +#[deprecated(since = "1.94.0", note = "replaced by the `INFINITY` associated constant on `f64`")] #[rustc_diagnostic_item = "f64_legacy_const_infinity"] pub const INFINITY: f64 = f64::INFINITY; @@ -264,14 +267,17 @@ pub const INFINITY: f64 = f64::INFINITY; /// /// ```rust /// // deprecated way -/// # #[allow(deprecated, deprecated_in_future)] +/// # #[allow(deprecated)] /// let ninf = std::f64::NEG_INFINITY; /// /// // intended way /// let ninf = f64::NEG_INFINITY; /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[deprecated(since = "TBD", note = "replaced by the `NEG_INFINITY` associated constant on `f64`")] +#[deprecated( + since = "1.94.0", + note = "replaced by the `NEG_INFINITY` associated constant on `f64`" +)] #[rustc_diagnostic_item = "f64_legacy_const_neg_infinity"] pub const NEG_INFINITY: f64 = f64::NEG_INFINITY; diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index f49f5f3c3afb1..41e4b2ea01193 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -3876,7 +3876,7 @@ macro_rules! int_impl { #[inline(always)] #[rustc_promotable] #[rustc_const_stable(feature = "const_min_value", since = "1.32.0")] - #[deprecated(since = "TBD", note = "replaced by the `MIN` associated constant on this type")] + #[deprecated(since = "1.94.0", note = "replaced by the `MIN` associated constant on this type")] #[rustc_diagnostic_item = concat!(stringify!($SelfT), "_legacy_fn_min_value")] pub const fn min_value() -> Self { Self::MIN @@ -3890,7 +3890,7 @@ macro_rules! int_impl { #[inline(always)] #[rustc_promotable] #[rustc_const_stable(feature = "const_max_value", since = "1.32.0")] - #[deprecated(since = "TBD", note = "replaced by the `MAX` associated constant on this type")] + #[deprecated(since = "1.94.0", note = "replaced by the `MAX` associated constant on this type")] #[rustc_diagnostic_item = concat!(stringify!($SelfT), "_legacy_fn_max_value")] pub const fn max_value() -> Self { Self::MAX diff --git a/library/core/src/num/shells/legacy_int_modules.rs b/library/core/src/num/shells/legacy_int_modules.rs index 6b4f253911157..4e9a813701172 100644 --- a/library/core/src/num/shells/legacy_int_modules.rs +++ b/library/core/src/num/shells/legacy_int_modules.rs @@ -5,8 +5,8 @@ macro_rules! legacy_int_module { ($T:ident, #[$attr:meta]) => ( #[$attr] #[deprecated( - since = "TBD", - note = "all constants in this module replaced by associated constants on the type" + since = "1.94.0", + note = "all constants in this module replaced by associated constants on the type", )] #[rustc_diagnostic_item = concat!(stringify!($T), "_legacy_mod")] pub mod $T { @@ -30,7 +30,7 @@ macro_rules! legacy_int_module { /// ``` /// #[$attr] - #[deprecated(since = "TBD", note = "replaced by the `MIN` associated constant on this type")] + #[deprecated(since = "1.94.0", note = "replaced by the `MIN` associated constant on this type")] #[rustc_diagnostic_item = concat!(stringify!($T), "_legacy_const_min")] pub const MIN: $T = $T::MIN; @@ -50,7 +50,7 @@ macro_rules! legacy_int_module { /// ``` /// #[$attr] - #[deprecated(since = "TBD", note = "replaced by the `MAX` associated constant on this type")] + #[deprecated(since = "1.94.0", note = "replaced by the `MAX` associated constant on this type")] #[rustc_diagnostic_item = concat!(stringify!($T), "_legacy_const_max")] pub const MAX: $T = $T::MAX; } diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index bf901c9b4ad31..2aaae30ca1223 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -3960,7 +3960,7 @@ macro_rules! uint_impl { #[rustc_promotable] #[inline(always)] #[rustc_const_stable(feature = "const_max_value", since = "1.32.0")] - #[deprecated(since = "TBD", note = "replaced by the `MIN` associated constant on this type")] + #[deprecated(since = "1.94.0", note = "replaced by the `MIN` associated constant on this type")] #[rustc_diagnostic_item = concat!(stringify!($SelfT), "_legacy_fn_min_value")] pub const fn min_value() -> Self { Self::MIN } @@ -3972,7 +3972,7 @@ macro_rules! uint_impl { #[rustc_promotable] #[inline(always)] #[rustc_const_stable(feature = "const_max_value", since = "1.32.0")] - #[deprecated(since = "TBD", note = "replaced by the `MAX` associated constant on this type")] + #[deprecated(since = "1.94.0", note = "replaced by the `MAX` associated constant on this type")] #[rustc_diagnostic_item = concat!(stringify!($SelfT), "_legacy_fn_max_value")] pub const fn max_value() -> Self { Self::MAX } } diff --git a/library/coretests/tests/array.rs b/library/coretests/tests/array.rs index 2b4429092e98b..5a24f02cbf3d9 100644 --- a/library/coretests/tests/array.rs +++ b/library/coretests/tests/array.rs @@ -646,7 +646,7 @@ fn array_mixed_equality_integers() { #[test] fn array_mixed_equality_nans() { - let array3: [f32; 3] = [1.0, std::f32::NAN, 3.0]; + let array3: [f32; 3] = [1.0, f32::NAN, 3.0]; let slice3: &[f32] = &{ array3 }; assert!(!(array3 == slice3)); diff --git a/library/coretests/tests/num/int_macros.rs b/library/coretests/tests/num/int_macros.rs index 37336f49ef1b6..2b641f595eba4 100644 --- a/library/coretests/tests/num/int_macros.rs +++ b/library/coretests/tests/num/int_macros.rs @@ -2,7 +2,8 @@ macro_rules! int_module { ($T:ident, $U:ident) => { use core::num::ParseIntError; use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr}; - use core::$T::*; + const MAX: $T = $T::MAX; + const MIN: $T = $T::MIN; const UMAX: $U = $U::MAX; diff --git a/library/coretests/tests/num/uint_macros.rs b/library/coretests/tests/num/uint_macros.rs index 72d500e575fa0..93f73d1330b96 100644 --- a/library/coretests/tests/num/uint_macros.rs +++ b/library/coretests/tests/num/uint_macros.rs @@ -2,15 +2,14 @@ macro_rules! uint_module { ($T:ident) => { use core::num::ParseIntError; use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr}; - use core::$T::*; use crate::num; #[test] fn test_overflows() { - assert!(MAX > 0); - assert!(MIN <= 0); - assert!((MIN + MAX).wrapping_add(1) == 0); + assert!($T::MAX > 0); + assert!($T::MIN <= 0); + assert!(($T::MIN + $T::MAX).wrapping_add(1) == 0); } #[test] @@ -25,7 +24,7 @@ macro_rules! uint_module { assert!(0b0110 as $T == (0b1100 as $T).bitxor(0b1010 as $T)); assert!(0b1110 as $T == (0b0111 as $T).shl(1)); assert!(0b0111 as $T == (0b1110 as $T).shr(1)); - assert!(MAX - (0b1011 as $T) == (0b1011 as $T).not()); + assert!($T::MAX - (0b1011 as $T) == (0b1011 as $T).not()); } const A: $T = 0b0101100; @@ -354,7 +353,7 @@ macro_rules! uint_module { assert_eq_const_safe!($T: R.wrapping_pow(2), 1 as $T); assert_eq_const_safe!(Option<$T>: R.checked_pow(2), None); assert_eq_const_safe!(($T, bool): R.overflowing_pow(2), (1 as $T, true)); - assert_eq_const_safe!($T: R.saturating_pow(2), MAX); + assert_eq_const_safe!($T: R.saturating_pow(2), $T::MAX); } } @@ -461,14 +460,14 @@ macro_rules! uint_module { fn test_next_multiple_of() { assert_eq_const_safe!($T: (16 as $T).next_multiple_of(8), 16); assert_eq_const_safe!($T: (23 as $T).next_multiple_of(8), 24); - assert_eq_const_safe!($T: MAX.next_multiple_of(1), MAX); + assert_eq_const_safe!($T: $T::MAX.next_multiple_of(1), $T::MAX); } fn test_checked_next_multiple_of() { assert_eq_const_safe!(Option<$T>: (16 as $T).checked_next_multiple_of(8), Some(16)); assert_eq_const_safe!(Option<$T>: (23 as $T).checked_next_multiple_of(8), Some(24)); assert_eq_const_safe!(Option<$T>: (1 as $T).checked_next_multiple_of(0), None); - assert_eq_const_safe!(Option<$T>: MAX.checked_next_multiple_of(2), None); + assert_eq_const_safe!(Option<$T>: $T::MAX.checked_next_multiple_of(2), None); } fn test_is_next_multiple_of() { diff --git a/library/stdarch/crates/core_arch/src/mips/msa.rs b/library/stdarch/crates/core_arch/src/mips/msa.rs index 563e121a7badb..6246433da5585 100644 --- a/library/stdarch/crates/core_arch/src/mips/msa.rs +++ b/library/stdarch/crates/core_arch/src/mips/msa.rs @@ -9187,7 +9187,6 @@ mod tests { core_arch::{mips::msa::*, simd::*}, mem, }; - use std::{f32, f64}; use stdarch_test::simd_test; #[simd_test(enable = "msa")] diff --git a/src/tools/clippy/tests/ui/confusing_method_to_numeric_cast.fixed b/src/tools/clippy/tests/ui/confusing_method_to_numeric_cast.fixed index b9691a3284ac0..c7ebe17c4b94c 100644 --- a/src/tools/clippy/tests/ui/confusing_method_to_numeric_cast.fixed +++ b/src/tools/clippy/tests/ui/confusing_method_to_numeric_cast.fixed @@ -1,6 +1,6 @@ #![feature(float_minimum_maximum)] #![warn(clippy::confusing_method_to_numeric_cast)] -#![allow(function_casts_as_integer)] +#![allow(function_casts_as_integer, deprecated)] fn main() { let _ = u16::MAX as usize; //~ confusing_method_to_numeric_cast diff --git a/src/tools/clippy/tests/ui/confusing_method_to_numeric_cast.rs b/src/tools/clippy/tests/ui/confusing_method_to_numeric_cast.rs index b402cbf92cb2b..00f8858551533 100644 --- a/src/tools/clippy/tests/ui/confusing_method_to_numeric_cast.rs +++ b/src/tools/clippy/tests/ui/confusing_method_to_numeric_cast.rs @@ -1,6 +1,6 @@ #![feature(float_minimum_maximum)] #![warn(clippy::confusing_method_to_numeric_cast)] -#![allow(function_casts_as_integer)] +#![allow(function_casts_as_integer, deprecated)] fn main() { let _ = u16::max as usize; //~ confusing_method_to_numeric_cast diff --git a/src/tools/clippy/tests/ui/manual_saturating_arithmetic.fixed b/src/tools/clippy/tests/ui/manual_saturating_arithmetic.fixed index 8dd142b2c79ac..d99477e623a2d 100644 --- a/src/tools/clippy/tests/ui/manual_saturating_arithmetic.fixed +++ b/src/tools/clippy/tests/ui/manual_saturating_arithmetic.fixed @@ -1,4 +1,4 @@ -#![allow(clippy::legacy_numeric_constants, unused_imports)] +#![allow(clippy::legacy_numeric_constants, unused_imports, deprecated)] fn main() { let _ = 1u32.saturating_add(1); diff --git a/src/tools/clippy/tests/ui/manual_saturating_arithmetic.rs b/src/tools/clippy/tests/ui/manual_saturating_arithmetic.rs index 9cc8bc42410da..48f2ba90a943a 100644 --- a/src/tools/clippy/tests/ui/manual_saturating_arithmetic.rs +++ b/src/tools/clippy/tests/ui/manual_saturating_arithmetic.rs @@ -1,4 +1,4 @@ -#![allow(clippy::legacy_numeric_constants, unused_imports)] +#![allow(clippy::legacy_numeric_constants, unused_imports, deprecated)] fn main() { let _ = 1u32.checked_add(1).unwrap_or(u32::max_value()); diff --git a/src/tools/clippy/tests/ui/suspicious_arithmetic_impl.rs b/src/tools/clippy/tests/ui/suspicious_arithmetic_impl.rs index 9798d2049c624..acd64ee79096b 100644 --- a/src/tools/clippy/tests/ui/suspicious_arithmetic_impl.rs +++ b/src/tools/clippy/tests/ui/suspicious_arithmetic_impl.rs @@ -1,4 +1,4 @@ -#![allow(clippy::legacy_numeric_constants)] +#![allow(clippy::legacy_numeric_constants, deprecated)] #![warn(clippy::suspicious_arithmetic_impl)] use std::ops::{ Add, AddAssign, BitAnd, BitOr, BitOrAssign, BitXor, Div, DivAssign, Mul, MulAssign, Rem, Shl, Shr, Sub, diff --git a/src/tools/miri/tests/pass/float.rs b/src/tools/miri/tests/pass/float.rs index a74a66d5455a8..92e6d29911905 100644 --- a/src/tools/miri/tests/pass/float.rs +++ b/src/tools/miri/tests/pass/float.rs @@ -14,14 +14,15 @@ use std::any::type_name; use std::cmp::min; use std::fmt::{Debug, Display, LowerHex}; use std::hint::black_box; -use std::{f32, f64}; +use std::f32::consts as f32_consts; +use std::f64::consts as f64_consts; use utils::check_nondet; /// Compare the two floats, allowing for $ulp many ULPs of error. /// /// ULP means "Units in the Last Place" or "Units of Least Precision". -/// The ULP of a float `a`` is the smallest possible change at `a`, so the ULP difference represents how +/// The ULP of a float `a` is the smallest possible change at `a`, so the ULP difference represents how /// many discrete floating-point steps are needed to reach the actual value from the expected value. /// /// Essentially ULP can be seen as a distance metric of floating-point numbers, but with @@ -1017,9 +1018,9 @@ fn mul_add() { // FIXME(f16_f128): add when supported assert_eq!(3.0f32.mul_add(2.0f32, 5.0f32), 11.0); - assert_eq!(0.0f32.mul_add(-2.0, f32::consts::E), f32::consts::E); + assert_eq!(0.0f32.mul_add(-2.0, f32_consts::E), f32_consts::E); assert_eq!(3.0f64.mul_add(2.0, 5.0), 11.0); - assert_eq!(0.0f64.mul_add(-2.0f64, f64::consts::E), f64::consts::E); + assert_eq!(0.0f64.mul_add(-2.0f64, f64_consts::E), f64_consts::E); assert_eq!((-3.2f32).mul_add(2.4, f32::NEG_INFINITY), f32::NEG_INFINITY); assert_eq!((-3.2f64).mul_add(2.4, f64::NEG_INFINITY), f64::NEG_INFINITY); @@ -1098,13 +1099,13 @@ fn libm() { assert_biteq((-0f32).powi(9), -0.0, "-0^x = -0 where x is negative"); assert_biteq((-0f64).powi(99), -0.0, "-0^x = -0 where x is negative"); - assert_approx_eq!(1f32.exp(), f32::consts::E); - assert_approx_eq!(1f64.exp(), f64::consts::E); + assert_approx_eq!(1f32.exp(), f32_consts::E); + assert_approx_eq!(1f64.exp(), f64_consts::E); assert_eq!(0f32.exp(), 1.0); assert_eq!(0f64.exp(), 1.0); - assert_approx_eq!(1f32.exp_m1(), f32::consts::E - 1.0); - assert_approx_eq!(1f64.exp_m1(), f64::consts::E - 1.0); + assert_approx_eq!(1f32.exp_m1(), f32_consts::E - 1.0); + assert_approx_eq!(1f64.exp_m1(), f64_consts::E - 1.0); assert_approx_eq!(f32::NEG_INFINITY.exp_m1(), -1.0); assert_approx_eq!(f64::NEG_INFINITY.exp_m1(), -1.0); @@ -1113,8 +1114,8 @@ fn libm() { assert_eq!(0f32.exp2(), 1.0); assert_eq!(0f64.exp2(), 1.0); - assert_approx_eq!(f32::consts::E.ln(), 1f32); - assert_approx_eq!(f64::consts::E.ln(), 1f64); + assert_approx_eq!(f32_consts::E.ln(), 1f32); + assert_approx_eq!(f64_consts::E.ln(), 1f64); assert_eq!(1f32.ln(), 0.0); assert_eq!(1f64.ln(), 0.0); @@ -1122,10 +1123,10 @@ fn libm() { assert_approx_eq!(0f64.ln_1p(), 0f64); assert_approx_eq!(10f32.log10(), 1f32); - assert_approx_eq!(f64::consts::E.log10(), f64::consts::LOG10_E); + assert_approx_eq!(f64_consts::E.log10(), f64_consts::LOG10_E); assert_approx_eq!(8f32.log2(), 3f32); - assert_approx_eq!(f64::consts::E.log2(), f64::consts::LOG2_E); + assert_approx_eq!(f64_consts::E.log2(), f64_consts::LOG2_E); #[allow(deprecated)] { @@ -1148,12 +1149,12 @@ fn libm() { assert_eq!(0f32.sin(), 0f32); assert_eq!(0f64.sin(), 0f64); - assert_approx_eq!((f64::consts::PI / 2f64).sin(), 1f64); - assert_approx_eq!(f32::consts::FRAC_PI_6.sin(), 0.5); - assert_approx_eq!(f64::consts::FRAC_PI_6.sin(), 0.5); + assert_approx_eq!((f64_consts::PI / 2f64).sin(), 1f64); + assert_approx_eq!(f32_consts::FRAC_PI_6.sin(), 0.5); + assert_approx_eq!(f64_consts::FRAC_PI_6.sin(), 0.5); // Increase error tolerance to 16ULP because of the extra operation. - assert_approx_eq!(f32::consts::FRAC_PI_4.sin().asin(), f32::consts::FRAC_PI_4, 16); - assert_approx_eq!(f64::consts::FRAC_PI_4.sin().asin(), f64::consts::FRAC_PI_4, 16); + assert_approx_eq!(f32_consts::FRAC_PI_4.sin().asin(), f32_consts::FRAC_PI_4, 16); + assert_approx_eq!(f64_consts::FRAC_PI_4.sin().asin(), f64_consts::FRAC_PI_4, 16); assert_biteq(0.0f32.asin(), 0.0f32, "asin(+0) = +0"); assert_biteq((-0.0f32).asin(), -0.0, "asin(-0) = -0"); assert_biteq(0.0f64.asin(), 0.0, "asin(+0) = +0"); @@ -1166,10 +1167,10 @@ fn libm() { // Ensure `sin` always returns something that is a valid input for `asin`, and same for // `cos` and `acos`. - let halve_pi_f32 = std::f32::consts::FRAC_PI_2; - let halve_pi_f64 = std::f64::consts::FRAC_PI_2; - let pi_f32 = std::f32::consts::PI; - let pi_f64 = std::f64::consts::PI; + let halve_pi_f32 = f32_consts::FRAC_PI_2; + let halve_pi_f64 = f64_consts::FRAC_PI_2; + let pi_f32 = f32_consts::PI; + let pi_f64 = f64_consts::PI; for _ in 0..64 { // sin() should be clamped to [-1, 1] so asin() can never return NaN assert!(!halve_pi_f32.sin().asin().is_nan()); @@ -1181,12 +1182,12 @@ fn libm() { assert_eq!(0f32.cos(), 1f32); assert_eq!(0f64.cos(), 1f64); - assert_approx_eq!((f64::consts::PI * 2f64).cos(), 1f64); - assert_approx_eq!(f32::consts::FRAC_PI_3.cos(), 0.5); - assert_approx_eq!(f64::consts::FRAC_PI_3.cos(), 0.5); + assert_approx_eq!((f64_consts::PI * 2f64).cos(), 1f64); + assert_approx_eq!(f32_consts::FRAC_PI_3.cos(), 0.5); + assert_approx_eq!(f64_consts::FRAC_PI_3.cos(), 0.5); // Increase error tolerance to 16ULP because of the extra operation. - assert_approx_eq!(f32::consts::FRAC_PI_4.cos().acos(), f32::consts::FRAC_PI_4, 16); - assert_approx_eq!(f64::consts::FRAC_PI_4.cos().acos(), f64::consts::FRAC_PI_4, 16); + assert_approx_eq!(f32_consts::FRAC_PI_4.cos().acos(), f32_consts::FRAC_PI_4, 16); + assert_approx_eq!(f64_consts::FRAC_PI_4.cos().acos(), f64_consts::FRAC_PI_4, 16); assert_biteq(1.0f32.acos(), 0.0, "acos(1) = 0"); assert_biteq(1.0f64.acos(), 0.0, "acos(1) = 0"); @@ -1209,7 +1210,8 @@ fn libm() { macro_rules! fixed_atan2_cases{ ($float_type:ident) => {{ use std::$float_type::consts::{PI, FRAC_PI_2, FRAC_PI_4}; - use $float_type::{INFINITY, NEG_INFINITY}; + const INFINITY: $float_type = $float_type::INFINITY; + const NEG_INFINITY: $float_type = $float_type::NEG_INFINITY; // atan2(±0,−0) = ±π. assert_eq!($float_type::atan2(0.0, -0.0), PI, "atan2(0,−0) = π"); @@ -1249,11 +1251,11 @@ fn libm() { assert_approx_eq!( 1.0f32.tanh(), - (1.0 - f32::consts::E.powi(-2)) / (1.0 + f32::consts::E.powi(-2)) + (1.0 - f32_consts::E.powi(-2)) / (1.0 + f32_consts::E.powi(-2)) ); assert_approx_eq!( 1.0f64.tanh(), - (1.0 - f64::consts::E.powi(-2)) / (1.0 + f64::consts::E.powi(-2)) + (1.0 - f64_consts::E.powi(-2)) / (1.0 + f64_consts::E.powi(-2)) ); assert_eq!(f32::INFINITY.tanh(), 1.0); assert_eq!(f32::NEG_INFINITY.tanh(), -1.0); @@ -1265,17 +1267,17 @@ fn libm() { assert_approx_eq!(5.0f32.gamma(), 24.0); assert_approx_eq!(5.0f64.gamma(), 24.0); - assert_approx_eq!((-0.5f32).gamma(), (-2.0) * f32::consts::PI.sqrt()); - assert_approx_eq!((-0.5f64).gamma(), (-2.0) * f64::consts::PI.sqrt()); + assert_approx_eq!((-0.5f32).gamma(), (-2.0) * f32_consts::PI.sqrt()); + assert_approx_eq!((-0.5f64).gamma(), (-2.0) * f64_consts::PI.sqrt()); assert_eq!(2.0f32.ln_gamma(), (0.0, 1)); assert_eq!(2.0f64.ln_gamma(), (0.0, 1)); // Gamma(-0.5) = -2*sqrt(π) let (val, sign) = (-0.5f32).ln_gamma(); - assert_approx_eq!(val, (2.0 * f32::consts::PI.sqrt()).ln()); + assert_approx_eq!(val, (2.0 * f32_consts::PI.sqrt()).ln()); assert_eq!(sign, -1); let (val, sign) = (-0.5f64).ln_gamma(); - assert_approx_eq!(val, (2.0 * f64::consts::PI.sqrt()).ln()); + assert_approx_eq!(val, (2.0 * f64_consts::PI.sqrt()).ln()); assert_eq!(sign, -1); assert_approx_eq!(1.0f32.erf(), 0.84270079294971486934122063508260926f32); @@ -1472,7 +1474,7 @@ fn test_non_determinism() { check_nondet(|| a.log(b)); check_nondet(|| a.exp()); check_nondet(|| 10f32.exp2()); - check_nondet(|| f32::consts::E.ln()); + check_nondet(|| f32_consts::E.ln()); check_nondet(|| 10f32.log10()); check_nondet(|| 8f32.log2()); check_nondet(|| 1f32.ln_1p()); @@ -1509,8 +1511,8 @@ fn test_non_determinism() { check_nondet(|| a.exp()); check_nondet(|| 50f64.exp2()); check_nondet(|| 3f64.ln()); - check_nondet(|| f64::consts::E.log10()); - check_nondet(|| f64::consts::E.log2()); + check_nondet(|| f64_consts::E.log10()); + check_nondet(|| f64_consts::E.log2()); check_nondet(|| 1f64.ln_1p()); check_nondet(|| 27.0f64.cbrt()); check_nondet(|| 3.0f64.hypot(4.0f64)); diff --git a/src/tools/miri/tests/pass/shims/x86/intrinsics-x86-sse.rs b/src/tools/miri/tests/pass/shims/x86/intrinsics-x86-sse.rs index be3f961e10ffa..9136b5eda3870 100644 --- a/src/tools/miri/tests/pass/shims/x86/intrinsics-x86-sse.rs +++ b/src/tools/miri/tests/pass/shims/x86/intrinsics-x86-sse.rs @@ -6,9 +6,10 @@ use std::arch::x86::*; #[cfg(target_arch = "x86_64")] use std::arch::x86_64::*; -use std::f32::NAN; use std::mem::transmute; +const NAN: f32 = f32::NAN; + fn main() { assert!(is_x86_feature_detected!("sse")); diff --git a/src/tools/miri/tests/pass/shims/x86/intrinsics-x86-sse2.rs b/src/tools/miri/tests/pass/shims/x86/intrinsics-x86-sse2.rs index 242aa0e89f631..570da30f0b622 100644 --- a/src/tools/miri/tests/pass/shims/x86/intrinsics-x86-sse2.rs +++ b/src/tools/miri/tests/pass/shims/x86/intrinsics-x86-sse2.rs @@ -6,9 +6,10 @@ use std::arch::x86::*; #[cfg(target_arch = "x86_64")] use std::arch::x86_64::*; -use std::f64::NAN; use std::mem::transmute; +const NAN: f64 = f64::NAN; + fn main() { assert!(is_x86_feature_detected!("sse2")); diff --git a/src/tools/rustfmt/src/vertical.rs b/src/tools/rustfmt/src/vertical.rs index 1ec239c382100..0edbb61eb3b3b 100644 --- a/src/tools/rustfmt/src/vertical.rs +++ b/src/tools/rustfmt/src/vertical.rs @@ -198,7 +198,7 @@ fn struct_field_prefix_max_min_width( .rewrite_prefix(context, shape) .map(|field_str| trimmed_last_line_width(&field_str)) }) - .fold_ok((0, ::std::usize::MAX), |(max_len, min_len), len| { + .fold_ok((0, usize::MAX), |(max_len, min_len), len| { (cmp::max(max_len, len), cmp::min(min_len, len)) }) .unwrap_or((0, 0)) diff --git a/tests/ui/consts/issue-90762.rs b/tests/ui/consts/issue-90762.rs index db40e50d4995f..cc060366b80bf 100644 --- a/tests/ui/consts/issue-90762.rs +++ b/tests/ui/consts/issue-90762.rs @@ -27,5 +27,5 @@ fn main() { for (i, b) in FOO.iter().enumerate() { assert!(b.load(Ordering::Relaxed), "{} not set", i); } - assert_eq!(BAR.fetch_add(1, Ordering::Relaxed), usize::max_value()); + assert_eq!(BAR.fetch_add(1, Ordering::Relaxed), usize::MAX); }