From 84ea721e3d578ba5742ff6ffb9dba6e1add373ec Mon Sep 17 00:00:00 2001 From: Maarten <50550545+mmvanheusden@users.noreply.github.com> Date: Fri, 2 Aug 2024 11:11:54 +0000 Subject: [PATCH 1/3] Format std::env::consts docstrings This clarifies possible outputs the constants might be. --- std/src/env.rs | 74 +++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/std/src/env.rs b/std/src/env.rs index 80890e61471c6..e90f24b16dd68 100644 --- a/std/src/env.rs +++ b/std/src/env.rs @@ -949,20 +949,20 @@ pub mod consts { /// /// Some possible values: /// - /// - x86 - /// - x86_64 - /// - arm - /// - aarch64 - /// - loongarch64 - /// - m68k - /// - csky - /// - mips - /// - mips64 - /// - powerpc - /// - powerpc64 - /// - riscv64 - /// - s390x - /// - sparc64 + /// - `x86` + /// - `x86_64` + /// - `arm` + /// - `aarch64` + /// - `loongarch64` + /// - `m68k` + /// - `csky` + /// - `mips` + /// - `mips64` + /// - `powerpc` + /// - `powerpc64` + /// - `riscv64` + /// - `s390x` + /// - `sparc64` #[stable(feature = "env", since = "1.0.0")] pub const ARCH: &str = env!("STD_ENV_ARCH"); @@ -970,8 +970,8 @@ pub mod consts { /// /// Some possible values: /// - /// - unix - /// - windows + /// - `unix` + /// - `windows` #[stable(feature = "env", since = "1.0.0")] pub const FAMILY: &str = os::FAMILY; @@ -980,16 +980,16 @@ pub mod consts { /// /// Some possible values: /// - /// - linux - /// - macos - /// - ios - /// - freebsd - /// - dragonfly - /// - netbsd - /// - openbsd - /// - solaris - /// - android - /// - windows + /// - `linux` + /// - `macos` + /// - `ios` + /// - `freebsd` + /// - `dragonfly` + /// - `netbsd` + /// - `openbsd` + /// - `solaris` + /// - `android` + /// - `windows` #[stable(feature = "env", since = "1.0.0")] pub const OS: &str = os::OS; @@ -998,7 +998,7 @@ pub mod consts { /// /// Some possible values: /// - /// - lib + /// - `lib` /// - `""` (an empty string) #[stable(feature = "env", since = "1.0.0")] pub const DLL_PREFIX: &str = os::DLL_PREFIX; @@ -1008,9 +1008,9 @@ pub mod consts { /// /// Some possible values: /// - /// - .so - /// - .dylib - /// - .dll + /// - `.so` + /// - `.dylib` + /// - `.dll` #[stable(feature = "env", since = "1.0.0")] pub const DLL_SUFFIX: &str = os::DLL_SUFFIX; @@ -1019,9 +1019,9 @@ pub mod consts { /// /// Some possible values: /// - /// - so - /// - dylib - /// - dll + /// - `so` + /// - `dylib` + /// - `dll` #[stable(feature = "env", since = "1.0.0")] pub const DLL_EXTENSION: &str = os::DLL_EXTENSION; @@ -1030,9 +1030,9 @@ pub mod consts { /// /// Some possible values: /// - /// - .exe - /// - .nexe - /// - .pexe + /// - `.exe` + /// - `.nexe` + /// - `.pexe` /// - `""` (an empty string) #[stable(feature = "env", since = "1.0.0")] pub const EXE_SUFFIX: &str = os::EXE_SUFFIX; @@ -1042,7 +1042,7 @@ pub mod consts { /// /// Some possible values: /// - /// - exe + /// - `exe` /// - `""` (an empty string) #[stable(feature = "env", since = "1.0.0")] pub const EXE_EXTENSION: &str = os::EXE_EXTENSION; From e0fe4a7ca28c04feae0509193bd573efc9d6e3b8 Mon Sep 17 00:00:00 2001 From: Maarten <50550545+mmvanheusden@users.noreply.github.com> Date: Thu, 15 Aug 2024 14:35:22 +0000 Subject: [PATCH 2/3] Add unordered list with possible values for each const --- std/src/env.rs | 189 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 125 insertions(+), 64 deletions(-) diff --git a/std/src/env.rs b/std/src/env.rs index e90f24b16dd68..031fb9fff873d 100644 --- a/std/src/env.rs +++ b/std/src/env.rs @@ -944,106 +944,167 @@ impl fmt::Debug for ArgsOs { pub mod consts { use crate::sys::env::os; - /// A string describing the architecture of the CPU that is currently - /// in use. + /// A string describing the architecture of the CPU that is currently in use. + /// An example value may be: `"x86"`, `"arm"` or `"riscv64"`. /// - /// Some possible values: + ///
Full list of possible values /// - /// - `x86` - /// - `x86_64` - /// - `arm` - /// - `aarch64` - /// - `loongarch64` - /// - `m68k` - /// - `csky` - /// - `mips` - /// - `mips64` - /// - `powerpc` - /// - `powerpc64` - /// - `riscv64` - /// - `s390x` - /// - `sparc64` + /// * `"x86"` + /// * `"x86_64"` + /// * `"arm"` + /// * `"aarch64"` + /// * `"m68k"` + /// * `"mips"` + /// * `"mips32r6"` + /// * `"mips64"` + /// * `"mips64r6"` + /// * `"csky"` + /// * `"powerpc"` + /// * `"powerpc64"` + /// * `"riscv32"` + /// * `"riscv64"` + /// * `"s390x"` + /// * `"sparc"` + /// * `"sparc64"` + /// * `"hexagon"` + /// * `"loongarch64"` + /// + ///
#[stable(feature = "env", since = "1.0.0")] pub const ARCH: &str = env!("STD_ENV_ARCH"); - /// The family of the operating system. Example value is `unix`. + /// A string describing the family of the operating system. + /// An example value may be: `"unix"`, or `"windows"`. + /// + /// This value may be an empty string if the family is unknown. + /// + ///
Full list of possible values /// - /// Some possible values: + /// * `"unix"` + /// * `"windows"` + /// * `"itron"` + /// * `""` /// - /// - `unix` - /// - `windows` + ///
#[stable(feature = "env", since = "1.0.0")] pub const FAMILY: &str = os::FAMILY; /// A string describing the specific operating system in use. - /// Example value is `linux`. + /// An example value may be: `"linux"`, or `"freebsd"`. /// - /// Some possible values: + ///
Full list of possible values /// - /// - `linux` - /// - `macos` - /// - `ios` - /// - `freebsd` - /// - `dragonfly` - /// - `netbsd` - /// - `openbsd` - /// - `solaris` - /// - `android` - /// - `windows` + /// * `"linux"` + /// * `"windows"` + /// * `"macos"` + /// * `"android"` + /// * `"ios"` + /// * `"openbsd"` + /// * `"freebsd"` + /// * `"netbsd"` + /// * `"wasi"` + /// * `"hermit"` + /// * `"aix"` + /// * `"apple"` + /// * `"dragonfly"` + /// * `"emscripten"` + /// * `"espidf"` + /// * `"fortanix"` + /// * `"uefi"` + /// * `"fuchsia"` + /// * `"haiku"` + /// * `"hermit"` + /// * `"watchos"` + /// * `"visionos"` + /// * `"tvos"` + /// * `"horizon"` + /// * `"hurd"` + /// * `"illumos"` + /// * `"l4re"` + /// * `"nto"` + /// * `"redox"` + /// * `"solaris"` + /// * `"solid_asp3` + /// * `"vita"` + /// * `"vxworks"` + /// * `"xous"` + /// + ///
#[stable(feature = "env", since = "1.0.0")] pub const OS: &str = os::OS; - /// Specifies the filename prefix used for shared libraries on this - /// platform. Example value is `lib`. - /// - /// Some possible values: - /// - /// - `lib` - /// - `""` (an empty string) + /// Specifies the filename prefix, if any, used for shared libraries on this platform. + /// This is either `"lib"` or an empty string. (`""`). #[stable(feature = "env", since = "1.0.0")] pub const DLL_PREFIX: &str = os::DLL_PREFIX; - /// Specifies the filename suffix used for shared libraries on this - /// platform. Example value is `.so`. + /// Specifies the filename suffix, if any, used for shared libraries on this platform. + /// An example value may be: `".so"`, `".elf"`, or `".dll"`. + /// + ///
Full list of possible values /// - /// Some possible values: + /// * `".so"` + /// * `".dylib"` + /// * `".dll"` + /// * `".sgxs"` + /// * `".a"` + /// * `".elf"` + /// * `".wasm"` + /// * `""` (an empty string) /// - /// - `.so` - /// - `.dylib` - /// - `.dll` + ///
#[stable(feature = "env", since = "1.0.0")] pub const DLL_SUFFIX: &str = os::DLL_SUFFIX; - /// Specifies the file extension used for shared libraries on this - /// platform that goes after the dot. Example value is `so`. + /// Specifies the file extension, if any, used for shared libraries on this platform that goes after the dot. + /// An example value may be: `"so"`, `"elf"`, or `"dll"`. + /// + ///
Full list of possible values /// - /// Some possible values: + /// * `"so"` + /// * `"dylib"` + /// * `"dll"` + /// * `"sgxs"` + /// * `"a"` + /// * `"elf"` + /// * `"wasm"` + /// * `""` (an empty string) /// - /// - `so` - /// - `dylib` - /// - `dll` + ///
#[stable(feature = "env", since = "1.0.0")] pub const DLL_EXTENSION: &str = os::DLL_EXTENSION; - /// Specifies the filename suffix used for executable binaries on this - /// platform. Example value is `.exe`. + /// Specifies the filename suffix, if any, used for executable binaries on this platform. + /// An example value may be: `".exe"`, or `".efi"`. /// - /// Some possible values: + ///
Full list of possible values /// - /// - `.exe` - /// - `.nexe` - /// - `.pexe` - /// - `""` (an empty string) + /// * `".exe"` + /// * `".efi"` + /// * `".js"` + /// * `".sgxs"` + /// * `".elf"` + /// * `".wasm"` + /// * `""` (an empty string) + /// + ///
#[stable(feature = "env", since = "1.0.0")] pub const EXE_SUFFIX: &str = os::EXE_SUFFIX; - /// Specifies the file extension, if any, used for executable binaries - /// on this platform. Example value is `exe`. + /// Specifies the file extension, if any, used for executable binaries on this platform. + /// An example value may be: `"exe"`, or an empty string (`""`). + /// + ///
Full list of possible values /// - /// Some possible values: + /// * `"exe"` + /// * `"efi"` + /// * `"js"` + /// * `"sgxs"` + /// * `"elf"` + /// * `"wasm"` + /// * `""` (an empty string) /// - /// - `exe` - /// - `""` (an empty string) + ///
#[stable(feature = "env", since = "1.0.0")] pub const EXE_EXTENSION: &str = os::EXE_EXTENSION; } From 028104e3bdefd2c4a0c5cfbec797a8919619c1b0 Mon Sep 17 00:00:00 2001 From: Maarten <50550545+mmvanheusden@users.noreply.github.com> Date: Fri, 16 Aug 2024 15:34:51 +0000 Subject: [PATCH 3/3] Refer to other docs --- std/src/env.rs | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/std/src/env.rs b/std/src/env.rs index 031fb9fff873d..a13f788acb73f 100644 --- a/std/src/env.rs +++ b/std/src/env.rs @@ -983,6 +983,7 @@ pub mod consts { /// * `"unix"` /// * `"windows"` /// * `"itron"` + /// * `"wasm"` /// * `""` /// /// @@ -1041,18 +1042,7 @@ pub mod consts { /// Specifies the filename suffix, if any, used for shared libraries on this platform. /// An example value may be: `".so"`, `".elf"`, or `".dll"`. /// - ///
Full list of possible values - /// - /// * `".so"` - /// * `".dylib"` - /// * `".dll"` - /// * `".sgxs"` - /// * `".a"` - /// * `".elf"` - /// * `".wasm"` - /// * `""` (an empty string) - /// - ///
+ /// The possible values are identical to those of [`DLL_EXTENSION`], but with the leading period included. #[stable(feature = "env", since = "1.0.0")] pub const DLL_SUFFIX: &str = os::DLL_SUFFIX; @@ -1077,17 +1067,7 @@ pub mod consts { /// Specifies the filename suffix, if any, used for executable binaries on this platform. /// An example value may be: `".exe"`, or `".efi"`. /// - ///
Full list of possible values - /// - /// * `".exe"` - /// * `".efi"` - /// * `".js"` - /// * `".sgxs"` - /// * `".elf"` - /// * `".wasm"` - /// * `""` (an empty string) - /// - ///
+ /// The possible values are identical to those of [`EXE_EXTENSION`], but with the leading period included. #[stable(feature = "env", since = "1.0.0")] pub const EXE_SUFFIX: &str = os::EXE_SUFFIX;