From e00fa2f0062f3ae3cfb811d55096915e747b97fb 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 5c381181218df..0670b6cdb27a1 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -582,11 +582,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 ede2196905118..4c9749fc48ad5 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 286993d736b9c..89e34cc395a59 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