|  | 
|  | 1 | +#![doc(hidden)] | 
|  | 2 | + | 
|  | 3 | +macro_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 | +legacy_int_module! { i128, #[stable(feature = "i128", since = "1.26.0")] } | 
|  | 61 | +legacy_int_module! { i16 } | 
|  | 62 | +legacy_int_module! { i32 } | 
|  | 63 | +legacy_int_module! { i64 } | 
|  | 64 | +legacy_int_module! { i8 } | 
|  | 65 | +legacy_int_module! { isize } | 
|  | 66 | +legacy_int_module! { u128, #[stable(feature = "i128", since = "1.26.0")] } | 
|  | 67 | +legacy_int_module! { u16 } | 
|  | 68 | +legacy_int_module! { u32 } | 
|  | 69 | +legacy_int_module! { u64 } | 
|  | 70 | +legacy_int_module! { u8 } | 
|  | 71 | +legacy_int_module! { usize } | 
0 commit comments