From a5f3b1e5dfa90b45404ed6a4719b59a3698b08b6 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Mon, 24 Feb 2025 19:49:15 -0500 Subject: [PATCH] Make `std/src/num` mirror `core/src/num` The float modules in `std` are currently top-level but for `core`, they are nested within the `num` directory and referenced by `#[path = ...]`. For consistency, adjust `std` to use the same structure as `core`. Also change the `f16` and `f128` gates from outer attributes to inner attributes like `core` has. --- library/std/src/lib.rs | 6 ++++-- library/std/src/{ => num}/f128.rs | 2 ++ library/std/src/{ => num}/f16.rs | 2 ++ library/std/src/{ => num}/f32.rs | 0 library/std/src/{ => num}/f64.rs | 0 library/std/src/{num.rs => num/mod.rs} | 0 6 files changed, 8 insertions(+), 2 deletions(-) rename library/std/src/{ => num}/f128.rs (99%) rename library/std/src/{ => num}/f16.rs (99%) rename library/std/src/{ => num}/f32.rs (100%) rename library/std/src/{ => num}/f64.rs (100%) rename library/std/src/{num.rs => num/mod.rs} (100%) diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 4b2418a498581..a3f0f3cc55a19 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -585,11 +585,13 @@ pub use alloc_crate::string; #[stable(feature = "rust1", since = "1.0.0")] pub use alloc_crate::vec; -#[unstable(feature = "f128", issue = "116909")] +#[path = "num/f128.rs"] pub mod f128; -#[unstable(feature = "f16", issue = "116909")] +#[path = "num/f16.rs"] pub mod f16; +#[path = "num/f32.rs"] pub mod f32; +#[path = "num/f64.rs"] pub mod f64; #[macro_use] diff --git a/library/std/src/f128.rs b/library/std/src/num/f128.rs similarity index 99% rename from library/std/src/f128.rs rename to library/std/src/num/f128.rs index bb4acde48224c..c0190de089f4a 100644 --- a/library/std/src/f128.rs +++ b/library/std/src/num/f128.rs @@ -4,6 +4,8 @@ //! //! Mathematically significant numbers are provided in the `consts` sub-module. +#![unstable(feature = "f128", issue = "116909")] + #[unstable(feature = "f128", issue = "116909")] pub use core::f128::consts; diff --git a/library/std/src/f16.rs b/library/std/src/num/f16.rs similarity index 99% rename from library/std/src/f16.rs rename to library/std/src/num/f16.rs index 4792eac1f9e28..4a4a8fd839a97 100644 --- a/library/std/src/f16.rs +++ b/library/std/src/num/f16.rs @@ -4,6 +4,8 @@ //! //! Mathematically significant numbers are provided in the `consts` sub-module. +#![unstable(feature = "f16", issue = "116909")] + #[unstable(feature = "f16", issue = "116909")] pub use core::f16::consts; diff --git a/library/std/src/f32.rs b/library/std/src/num/f32.rs similarity index 100% rename from library/std/src/f32.rs rename to library/std/src/num/f32.rs diff --git a/library/std/src/f64.rs b/library/std/src/num/f64.rs similarity index 100% rename from library/std/src/f64.rs rename to library/std/src/num/f64.rs diff --git a/library/std/src/num.rs b/library/std/src/num/mod.rs similarity index 100% rename from library/std/src/num.rs rename to library/std/src/num/mod.rs