Skip to content

Commit c02d6d9

Browse files
authored
Rollup merge of rust-lang#139868 - thaliaarchi:move-env-consts-pal, r=joboet
Move `pal::env` into `std::sys::env_consts` Combine the `std::env::consts` platform implementations as a single file. Use the Unix file as the base, since it has 28 entries, and fold the 8 singleton platforms into it. The Unix file was roughly grouped into Linux, Apple, BSD, and everything else, roughly in alphabetical order. Alphabetically order them to make it easier to maintain and discard the Unix-specific groups to generalize it to all platforms. I'd prefer to have no fallback implementation, as I consider it a bug; however TEEOS, Trusty, and Xous have no definitions here. Since they otherwise have `pal` abstractions, that indicates that there are several platforms without `pal` abstractions which are also missing here. To support unsupported, create a little macro to handle the fallback case and not introduce ordering between the `cfg`s like `cfg_if!`. I've named the module `std::sys::env_consts`, because they are used in `std::env::consts` and I intend to use the name `std::sys::env` for the combination of `Args` and `Vars`. cc `@joboet` `@ChrisDenton` Tracked in rust-lang#117276.
2 parents 5b0e26b + cac458c commit c02d6d9

File tree

25 files changed

+194
-187
lines changed

25 files changed

+194
-187
lines changed

library/std/src/env.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ impl fmt::Debug for ArgsOs {
950950
/// Constants associated with the current target
951951
#[stable(feature = "env", since = "1.0.0")]
952952
pub mod consts {
953-
use crate::sys::env::os;
953+
use crate::sys::env_consts::os;
954954

955955
/// A string describing the architecture of the CPU that is currently in use.
956956
/// An example value may be: `"x86"`, `"arm"` or `"riscv64"`.

0 commit comments

Comments
 (0)