Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 10 additions & 41 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,47 +252,16 @@ pub use crate::macros::cfg_select;
#[macro_use]
mod internal_macros;

#[path = "num/shells/int_macros.rs"]
#[macro_use]
mod int_macros;

#[rustc_diagnostic_item = "i128_legacy_mod"]
#[path = "num/shells/i128.rs"]
pub mod i128;
#[rustc_diagnostic_item = "i16_legacy_mod"]
#[path = "num/shells/i16.rs"]
pub mod i16;
#[rustc_diagnostic_item = "i32_legacy_mod"]
#[path = "num/shells/i32.rs"]
pub mod i32;
#[rustc_diagnostic_item = "i64_legacy_mod"]
#[path = "num/shells/i64.rs"]
pub mod i64;
#[rustc_diagnostic_item = "i8_legacy_mod"]
#[path = "num/shells/i8.rs"]
pub mod i8;
#[rustc_diagnostic_item = "isize_legacy_mod"]
#[path = "num/shells/isize.rs"]
pub mod isize;

#[rustc_diagnostic_item = "u128_legacy_mod"]
#[path = "num/shells/u128.rs"]
pub mod u128;
#[rustc_diagnostic_item = "u16_legacy_mod"]
#[path = "num/shells/u16.rs"]
pub mod u16;
#[rustc_diagnostic_item = "u32_legacy_mod"]
#[path = "num/shells/u32.rs"]
pub mod u32;
#[rustc_diagnostic_item = "u64_legacy_mod"]
#[path = "num/shells/u64.rs"]
pub mod u64;
#[rustc_diagnostic_item = "u8_legacy_mod"]
#[path = "num/shells/u8.rs"]
pub mod u8;
#[rustc_diagnostic_item = "usize_legacy_mod"]
#[path = "num/shells/usize.rs"]
pub mod usize;
#[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)]
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)]
pub use legacy_int_modules::{i128, u128};

#[path = "num/f128.rs"]
pub mod f128;
Expand Down
11 changes: 0 additions & 11 deletions library/core/src/num/shells/i128.rs

This file was deleted.

11 changes: 0 additions & 11 deletions library/core/src/num/shells/i16.rs

This file was deleted.

11 changes: 0 additions & 11 deletions library/core/src/num/shells/i32.rs

This file was deleted.

11 changes: 0 additions & 11 deletions library/core/src/num/shells/i64.rs

This file was deleted.

11 changes: 0 additions & 11 deletions library/core/src/num/shells/i8.rs

This file was deleted.

46 changes: 0 additions & 46 deletions library/core/src/num/shells/int_macros.rs

This file was deleted.

11 changes: 0 additions & 11 deletions library/core/src/num/shells/isize.rs

This file was deleted.

71 changes: 71 additions & 0 deletions library/core/src/num/shells/legacy_int_modules.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#![doc(hidden)]

macro_rules! legacy_int_module {
($T:ident) => (legacy_int_module!($T, #[stable(feature = "rust1", since = "1.0.0")]););
($T:ident, #[$attr:meta]) => (
#[$attr]
#[deprecated(
since = "TBD",
note = "all constants in this module replaced by associated constants on the type"
)]
#[rustc_diagnostic_item = concat!(stringify!($T), "_legacy_mod")]
pub mod $T {
#![doc = concat!("Redundant constants module for the [`", stringify!($T), "` primitive type][", stringify!($T), "].")]
//!
//! New code should use the associated constants directly on the primitive type.

#[doc = concat!(
"The smallest value that can be represented by this integer type. Use ",
"[`", stringify!($T), "::MIN", "`] instead."
)]
///
/// # Examples
///
/// ```rust
/// // deprecated way
#[doc = concat!("let min = std::", stringify!($T), "::MIN;")]
///
/// // intended way
#[doc = concat!("let min = ", stringify!($T), "::MIN;")]
/// ```
///
#[$attr]
#[deprecated(since = "TBD", 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;

#[doc = concat!(
"The largest value that can be represented by this integer type. Use ",
"[`", stringify!($T), "::MAX", "`] instead."
)]
///
/// # Examples
///
/// ```rust
/// // deprecated way
#[doc = concat!("let max = std::", stringify!($T), "::MAX;")]
///
/// // intended way
#[doc = concat!("let max = ", stringify!($T), "::MAX;")]
/// ```
///
#[$attr]
#[deprecated(since = "TBD", 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;
}
)
}

legacy_int_module! { i128, #[stable(feature = "i128", since = "1.26.0")] }
legacy_int_module! { i16 }
legacy_int_module! { i32 }
legacy_int_module! { i64 }
legacy_int_module! { i8 }
legacy_int_module! { isize }
legacy_int_module! { u128, #[stable(feature = "i128", since = "1.26.0")] }
legacy_int_module! { u16 }
legacy_int_module! { u32 }
legacy_int_module! { u64 }
legacy_int_module! { u8 }
legacy_int_module! { usize }
11 changes: 0 additions & 11 deletions library/core/src/num/shells/u128.rs

This file was deleted.

11 changes: 0 additions & 11 deletions library/core/src/num/shells/u16.rs

This file was deleted.

11 changes: 0 additions & 11 deletions library/core/src/num/shells/u32.rs

This file was deleted.

11 changes: 0 additions & 11 deletions library/core/src/num/shells/u64.rs

This file was deleted.

11 changes: 0 additions & 11 deletions library/core/src/num/shells/u8.rs

This file was deleted.

11 changes: 0 additions & 11 deletions library/core/src/num/shells/usize.rs

This file was deleted.

Loading