Skip to main content

core/num/shells/
legacy_int_modules.rs

1#![doc(hidden)]
2
3macro_rules! legacy_int_module {
4    ($T:ident) => (legacy_int_module!($T, #[stable(feature = "rust1", since = "1.0.0")]););
5    ($T:ident, #[$attr:meta]) => (
6        #[$attr]
7        #[deprecated(
8            since = "TBD",
9            note = "all constants in this module replaced by associated constants on the type"
10        )]
11        #[rustc_diagnostic_item = concat!(stringify!($T), "_legacy_mod")]
12        pub mod $T {
13            #![doc = concat!("Redundant constants module for the [`", stringify!($T), "` primitive type][", stringify!($T), "].")]
14            //!
15            //! New code should use the associated constants directly on the primitive type.
16
17            #[doc = concat!(
18                "The smallest value that can be represented by this integer type. Use ",
19                "[`", stringify!($T), "::MIN", "`] instead."
20            )]
21            ///
22            /// # Examples
23            ///
24            /// ```rust
25            /// // deprecated way
26            #[doc = concat!("let min = std::", stringify!($T), "::MIN;")]
27            ///
28            /// // intended way
29            #[doc = concat!("let min = ", stringify!($T), "::MIN;")]
30            /// ```
31            ///
32            #[$attr]
33            #[deprecated(since = "TBD", note = "replaced by the `MIN` associated constant on this type")]
34            #[rustc_diagnostic_item = concat!(stringify!($T), "_legacy_const_min")]
35            pub const MIN: $T = $T::MIN;
36
37            #[doc = concat!(
38                "The largest value that can be represented by this integer type. Use ",
39                "[`", stringify!($T), "::MAX", "`] instead."
40            )]
41            ///
42            /// # Examples
43            ///
44            /// ```rust
45            /// // deprecated way
46            #[doc = concat!("let max = std::", stringify!($T), "::MAX;")]
47            ///
48            /// // intended way
49            #[doc = concat!("let max = ", stringify!($T), "::MAX;")]
50            /// ```
51            ///
52            #[$attr]
53            #[deprecated(since = "TBD", note = "replaced by the `MAX` associated constant on this type")]
54            #[rustc_diagnostic_item = concat!(stringify!($T), "_legacy_const_max")]
55            pub const MAX: $T = $T::MAX;
56        }
57    )
58}
59
60#[stable(feature = "i128", since = "1.26.0")]
#[deprecated(since = "TBD", note =
"all constants in this module replaced by associated constants on the type")]
#[rustc_diagnostic_item = "i128_legacy_mod"]
pub mod i128 {
    #![doc =
    "Redundant constants module for the [`i128` primitive type][i128]."]
    //!
    //! New code should use the associated constants directly on the primitive type.
    #[doc =
    "The smallest value that can be represented by this integer type. Use [`i128::MIN`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let min = std::i128::MIN;"]
    ///
    /// // intended way
    #[doc = "let min = i128::MIN;"]
    /// ```
    ///
    #[stable(feature = "i128", since = "1.26.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MIN` associated constant on this type")]
    #[rustc_diagnostic_item = "i128_legacy_const_min"]
    pub const MIN: i128 = i128::MIN;
    #[doc =
    "The largest value that can be represented by this integer type. Use [`i128::MAX`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let max = std::i128::MAX;"]
    ///
    /// // intended way
    #[doc = "let max = i128::MAX;"]
    /// ```
    ///
    #[stable(feature = "i128", since = "1.26.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MAX` associated constant on this type")]
    #[rustc_diagnostic_item = "i128_legacy_const_max"]
    pub const MAX: i128 = i128::MAX;
}legacy_int_module! { i128, #[stable(feature = "i128", since = "1.26.0")] }
61#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "TBD", note =
"all constants in this module replaced by associated constants on the type")]
#[rustc_diagnostic_item = "i16_legacy_mod"]
pub mod i16 {
    #![doc =
    "Redundant constants module for the [`i16` primitive type][i16]."]
    //!
    //! New code should use the associated constants directly on the primitive type.
    #[doc =
    "The smallest value that can be represented by this integer type. Use [`i16::MIN`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let min = std::i16::MIN;"]
    ///
    /// // intended way
    #[doc = "let min = i16::MIN;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MIN` associated constant on this type")]
    #[rustc_diagnostic_item = "i16_legacy_const_min"]
    pub const MIN: i16 = i16::MIN;
    #[doc =
    "The largest value that can be represented by this integer type. Use [`i16::MAX`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let max = std::i16::MAX;"]
    ///
    /// // intended way
    #[doc = "let max = i16::MAX;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MAX` associated constant on this type")]
    #[rustc_diagnostic_item = "i16_legacy_const_max"]
    pub const MAX: i16 = i16::MAX;
}legacy_int_module! { i16 }
62#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "TBD", note =
"all constants in this module replaced by associated constants on the type")]
#[rustc_diagnostic_item = "i32_legacy_mod"]
pub mod i32 {
    #![doc =
    "Redundant constants module for the [`i32` primitive type][i32]."]
    //!
    //! New code should use the associated constants directly on the primitive type.
    #[doc =
    "The smallest value that can be represented by this integer type. Use [`i32::MIN`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let min = std::i32::MIN;"]
    ///
    /// // intended way
    #[doc = "let min = i32::MIN;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MIN` associated constant on this type")]
    #[rustc_diagnostic_item = "i32_legacy_const_min"]
    pub const MIN: i32 = i32::MIN;
    #[doc =
    "The largest value that can be represented by this integer type. Use [`i32::MAX`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let max = std::i32::MAX;"]
    ///
    /// // intended way
    #[doc = "let max = i32::MAX;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MAX` associated constant on this type")]
    #[rustc_diagnostic_item = "i32_legacy_const_max"]
    pub const MAX: i32 = i32::MAX;
}legacy_int_module! { i32 }
63#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "TBD", note =
"all constants in this module replaced by associated constants on the type")]
#[rustc_diagnostic_item = "i64_legacy_mod"]
pub mod i64 {
    #![doc =
    "Redundant constants module for the [`i64` primitive type][i64]."]
    //!
    //! New code should use the associated constants directly on the primitive type.
    #[doc =
    "The smallest value that can be represented by this integer type. Use [`i64::MIN`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let min = std::i64::MIN;"]
    ///
    /// // intended way
    #[doc = "let min = i64::MIN;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MIN` associated constant on this type")]
    #[rustc_diagnostic_item = "i64_legacy_const_min"]
    pub const MIN: i64 = i64::MIN;
    #[doc =
    "The largest value that can be represented by this integer type. Use [`i64::MAX`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let max = std::i64::MAX;"]
    ///
    /// // intended way
    #[doc = "let max = i64::MAX;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MAX` associated constant on this type")]
    #[rustc_diagnostic_item = "i64_legacy_const_max"]
    pub const MAX: i64 = i64::MAX;
}legacy_int_module! { i64 }
64#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "TBD", note =
"all constants in this module replaced by associated constants on the type")]
#[rustc_diagnostic_item = "i8_legacy_mod"]
pub mod i8 {
    #![doc = "Redundant constants module for the [`i8` primitive type][i8]."]
    //!
    //! New code should use the associated constants directly on the primitive type.
    #[doc =
    "The smallest value that can be represented by this integer type. Use [`i8::MIN`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let min = std::i8::MIN;"]
    ///
    /// // intended way
    #[doc = "let min = i8::MIN;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MIN` associated constant on this type")]
    #[rustc_diagnostic_item = "i8_legacy_const_min"]
    pub const MIN: i8 = i8::MIN;
    #[doc =
    "The largest value that can be represented by this integer type. Use [`i8::MAX`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let max = std::i8::MAX;"]
    ///
    /// // intended way
    #[doc = "let max = i8::MAX;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MAX` associated constant on this type")]
    #[rustc_diagnostic_item = "i8_legacy_const_max"]
    pub const MAX: i8 = i8::MAX;
}legacy_int_module! { i8 }
65#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "TBD", note =
"all constants in this module replaced by associated constants on the type")]
#[rustc_diagnostic_item = "isize_legacy_mod"]
pub mod isize {
    #![doc =
    "Redundant constants module for the [`isize` primitive type][isize]."]
    //!
    //! New code should use the associated constants directly on the primitive type.
    #[doc =
    "The smallest value that can be represented by this integer type. Use [`isize::MIN`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let min = std::isize::MIN;"]
    ///
    /// // intended way
    #[doc = "let min = isize::MIN;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MIN` associated constant on this type")]
    #[rustc_diagnostic_item = "isize_legacy_const_min"]
    pub const MIN: isize = isize::MIN;
    #[doc =
    "The largest value that can be represented by this integer type. Use [`isize::MAX`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let max = std::isize::MAX;"]
    ///
    /// // intended way
    #[doc = "let max = isize::MAX;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MAX` associated constant on this type")]
    #[rustc_diagnostic_item = "isize_legacy_const_max"]
    pub const MAX: isize = isize::MAX;
}legacy_int_module! { isize }
66#[stable(feature = "i128", since = "1.26.0")]
#[deprecated(since = "TBD", note =
"all constants in this module replaced by associated constants on the type")]
#[rustc_diagnostic_item = "u128_legacy_mod"]
pub mod u128 {
    #![doc =
    "Redundant constants module for the [`u128` primitive type][u128]."]
    //!
    //! New code should use the associated constants directly on the primitive type.
    #[doc =
    "The smallest value that can be represented by this integer type. Use [`u128::MIN`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let min = std::u128::MIN;"]
    ///
    /// // intended way
    #[doc = "let min = u128::MIN;"]
    /// ```
    ///
    #[stable(feature = "i128", since = "1.26.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MIN` associated constant on this type")]
    #[rustc_diagnostic_item = "u128_legacy_const_min"]
    pub const MIN: u128 = u128::MIN;
    #[doc =
    "The largest value that can be represented by this integer type. Use [`u128::MAX`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let max = std::u128::MAX;"]
    ///
    /// // intended way
    #[doc = "let max = u128::MAX;"]
    /// ```
    ///
    #[stable(feature = "i128", since = "1.26.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MAX` associated constant on this type")]
    #[rustc_diagnostic_item = "u128_legacy_const_max"]
    pub const MAX: u128 = u128::MAX;
}legacy_int_module! { u128, #[stable(feature = "i128", since = "1.26.0")] }
67#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "TBD", note =
"all constants in this module replaced by associated constants on the type")]
#[rustc_diagnostic_item = "u16_legacy_mod"]
pub mod u16 {
    #![doc =
    "Redundant constants module for the [`u16` primitive type][u16]."]
    //!
    //! New code should use the associated constants directly on the primitive type.
    #[doc =
    "The smallest value that can be represented by this integer type. Use [`u16::MIN`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let min = std::u16::MIN;"]
    ///
    /// // intended way
    #[doc = "let min = u16::MIN;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MIN` associated constant on this type")]
    #[rustc_diagnostic_item = "u16_legacy_const_min"]
    pub const MIN: u16 = u16::MIN;
    #[doc =
    "The largest value that can be represented by this integer type. Use [`u16::MAX`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let max = std::u16::MAX;"]
    ///
    /// // intended way
    #[doc = "let max = u16::MAX;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MAX` associated constant on this type")]
    #[rustc_diagnostic_item = "u16_legacy_const_max"]
    pub const MAX: u16 = u16::MAX;
}legacy_int_module! { u16 }
68#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "TBD", note =
"all constants in this module replaced by associated constants on the type")]
#[rustc_diagnostic_item = "u32_legacy_mod"]
pub mod u32 {
    #![doc =
    "Redundant constants module for the [`u32` primitive type][u32]."]
    //!
    //! New code should use the associated constants directly on the primitive type.
    #[doc =
    "The smallest value that can be represented by this integer type. Use [`u32::MIN`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let min = std::u32::MIN;"]
    ///
    /// // intended way
    #[doc = "let min = u32::MIN;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MIN` associated constant on this type")]
    #[rustc_diagnostic_item = "u32_legacy_const_min"]
    pub const MIN: u32 = u32::MIN;
    #[doc =
    "The largest value that can be represented by this integer type. Use [`u32::MAX`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let max = std::u32::MAX;"]
    ///
    /// // intended way
    #[doc = "let max = u32::MAX;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MAX` associated constant on this type")]
    #[rustc_diagnostic_item = "u32_legacy_const_max"]
    pub const MAX: u32 = u32::MAX;
}legacy_int_module! { u32 }
69#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "TBD", note =
"all constants in this module replaced by associated constants on the type")]
#[rustc_diagnostic_item = "u64_legacy_mod"]
pub mod u64 {
    #![doc =
    "Redundant constants module for the [`u64` primitive type][u64]."]
    //!
    //! New code should use the associated constants directly on the primitive type.
    #[doc =
    "The smallest value that can be represented by this integer type. Use [`u64::MIN`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let min = std::u64::MIN;"]
    ///
    /// // intended way
    #[doc = "let min = u64::MIN;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MIN` associated constant on this type")]
    #[rustc_diagnostic_item = "u64_legacy_const_min"]
    pub const MIN: u64 = u64::MIN;
    #[doc =
    "The largest value that can be represented by this integer type. Use [`u64::MAX`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let max = std::u64::MAX;"]
    ///
    /// // intended way
    #[doc = "let max = u64::MAX;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MAX` associated constant on this type")]
    #[rustc_diagnostic_item = "u64_legacy_const_max"]
    pub const MAX: u64 = u64::MAX;
}legacy_int_module! { u64 }
70#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "TBD", note =
"all constants in this module replaced by associated constants on the type")]
#[rustc_diagnostic_item = "u8_legacy_mod"]
pub mod u8 {
    #![doc = "Redundant constants module for the [`u8` primitive type][u8]."]
    //!
    //! New code should use the associated constants directly on the primitive type.
    #[doc =
    "The smallest value that can be represented by this integer type. Use [`u8::MIN`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let min = std::u8::MIN;"]
    ///
    /// // intended way
    #[doc = "let min = u8::MIN;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MIN` associated constant on this type")]
    #[rustc_diagnostic_item = "u8_legacy_const_min"]
    pub const MIN: u8 = u8::MIN;
    #[doc =
    "The largest value that can be represented by this integer type. Use [`u8::MAX`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let max = std::u8::MAX;"]
    ///
    /// // intended way
    #[doc = "let max = u8::MAX;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MAX` associated constant on this type")]
    #[rustc_diagnostic_item = "u8_legacy_const_max"]
    pub const MAX: u8 = u8::MAX;
}legacy_int_module! { u8 }
71#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "TBD", note =
"all constants in this module replaced by associated constants on the type")]
#[rustc_diagnostic_item = "usize_legacy_mod"]
pub mod usize {
    #![doc =
    "Redundant constants module for the [`usize` primitive type][usize]."]
    //!
    //! New code should use the associated constants directly on the primitive type.
    #[doc =
    "The smallest value that can be represented by this integer type. Use [`usize::MIN`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let min = std::usize::MIN;"]
    ///
    /// // intended way
    #[doc = "let min = usize::MIN;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MIN` associated constant on this type")]
    #[rustc_diagnostic_item = "usize_legacy_const_min"]
    pub const MIN: usize = usize::MIN;
    #[doc =
    "The largest value that can be represented by this integer type. Use [`usize::MAX`] instead."]
    ///
    /// # Examples
    ///
    /// ```rust
    /// // deprecated way
    #[doc = "let max = std::usize::MAX;"]
    ///
    /// // intended way
    #[doc = "let max = usize::MAX;"]
    /// ```
    ///
    #[stable(feature = "rust1", since = "1.0.0")]
    #[deprecated(since = "TBD", note =
    "replaced by the `MAX` associated constant on this type")]
    #[rustc_diagnostic_item = "usize_legacy_const_max"]
    pub const MAX: usize = usize::MAX;
}legacy_int_module! { usize }