Skip to content

Commit 91a0a59

Browse files
committed
Combine env consts into std::sys::env_consts
1 parent 22dddc6 commit 91a0a59

File tree

25 files changed

+70
-94
lines changed

25 files changed

+70
-94
lines changed

Diff for: 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"`.

Diff for: library/std/src/sys/pal/unix/env.rs renamed to library/std/src/sys/env_consts.rs

+68
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Constants associated with each target.
2+
13
// Keep entries sorted alphabetically.
24

35
#[cfg(target_os = "aix")]
@@ -99,6 +101,17 @@ pub mod os {
99101
pub const EXE_EXTENSION: &str = "";
100102
}
101103

104+
#[cfg(target_os = "hermit")]
105+
pub mod os {
106+
pub const FAMILY: &str = "";
107+
pub const OS: &str = "hermit";
108+
pub const DLL_PREFIX: &str = "";
109+
pub const DLL_SUFFIX: &str = "";
110+
pub const DLL_EXTENSION: &str = "";
111+
pub const EXE_SUFFIX: &str = "";
112+
pub const EXE_EXTENSION: &str = "";
113+
}
114+
102115
#[cfg(target_os = "horizon")]
103116
pub mod os {
104117
pub const FAMILY: &str = "unix";
@@ -242,6 +255,17 @@ pub mod os {
242255
pub const EXE_EXTENSION: &str = "";
243256
}
244257

258+
#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
259+
pub mod os {
260+
pub const FAMILY: &str = "";
261+
pub const OS: &str = "";
262+
pub const DLL_PREFIX: &str = "";
263+
pub const DLL_SUFFIX: &str = ".sgxs";
264+
pub const DLL_EXTENSION: &str = "sgxs";
265+
pub const EXE_SUFFIX: &str = ".sgxs";
266+
pub const EXE_EXTENSION: &str = "sgxs";
267+
}
268+
245269
#[cfg(target_os = "solaris")]
246270
pub mod os {
247271
pub const FAMILY: &str = "unix";
@@ -253,6 +277,17 @@ pub mod os {
253277
pub const EXE_EXTENSION: &str = "";
254278
}
255279

280+
#[cfg(target_os = "solid_asp3")]
281+
pub mod os {
282+
pub const FAMILY: &str = "itron";
283+
pub const OS: &str = "solid";
284+
pub const DLL_PREFIX: &str = "";
285+
pub const DLL_SUFFIX: &str = ".so";
286+
pub const DLL_EXTENSION: &str = "so";
287+
pub const EXE_SUFFIX: &str = "";
288+
pub const EXE_EXTENSION: &str = "";
289+
}
290+
256291
#[cfg(target_os = "tvos")]
257292
pub mod os {
258293
pub const FAMILY: &str = "unix";
@@ -264,6 +299,17 @@ pub mod os {
264299
pub const EXE_EXTENSION: &str = "";
265300
}
266301

302+
#[cfg(target_os = "uefi")]
303+
pub mod os {
304+
pub const FAMILY: &str = "";
305+
pub const OS: &str = "uefi";
306+
pub const DLL_PREFIX: &str = "";
307+
pub const DLL_SUFFIX: &str = "";
308+
pub const DLL_EXTENSION: &str = "";
309+
pub const EXE_SUFFIX: &str = ".efi";
310+
pub const EXE_EXTENSION: &str = "efi";
311+
}
312+
267313
#[cfg(target_os = "visionos")]
268314
pub mod os {
269315
pub const FAMILY: &str = "unix";
@@ -297,6 +343,17 @@ pub mod os {
297343
pub const EXE_EXTENSION: &str = "";
298344
}
299345

346+
#[cfg(all(target_family = "wasm", not(target_os = "linux")))]
347+
pub mod os {
348+
pub const FAMILY: &str = "";
349+
pub const OS: &str = "";
350+
pub const DLL_PREFIX: &str = "";
351+
pub const DLL_SUFFIX: &str = ".wasm";
352+
pub const DLL_EXTENSION: &str = "wasm";
353+
pub const EXE_SUFFIX: &str = ".wasm";
354+
pub const EXE_EXTENSION: &str = "wasm";
355+
}
356+
300357
#[cfg(target_os = "watchos")]
301358
pub mod os {
302359
pub const FAMILY: &str = "unix";
@@ -308,4 +365,15 @@ pub mod os {
308365
pub const EXE_EXTENSION: &str = "";
309366
}
310367

368+
#[cfg(target_family = "windows")]
369+
pub mod os {
370+
pub const FAMILY: &str = "windows";
371+
pub const OS: &str = "windows";
372+
pub const DLL_PREFIX: &str = "";
373+
pub const DLL_SUFFIX: &str = ".dll";
374+
pub const DLL_EXTENSION: &str = "dll";
375+
pub const EXE_SUFFIX: &str = ".exe";
376+
pub const EXE_EXTENSION: &str = "exe";
377+
}
378+
311379
// Keep entries sorted alphabetically.

Diff for: library/std/src/sys/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub mod anonymous_pipe;
1212
pub mod args;
1313
pub mod backtrace;
1414
pub mod cmath;
15+
pub mod env_consts;
1516
pub mod exit_guard;
1617
pub mod fd;
1718
pub mod fs;

Diff for: library/std/src/sys/pal/hermit/env.rs

-9
This file was deleted.

Diff for: library/std/src/sys/pal/hermit/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
use crate::os::raw::c_char;
2020

21-
pub mod env;
2221
pub mod futex;
2322
pub mod os;
2423
#[path = "../unsupported/pipe.rs"]

Diff for: library/std/src/sys/pal/sgx/env.rs

-9
This file was deleted.

Diff for: library/std/src/sys/pal/sgx/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use crate::io::ErrorKind;
99
use crate::sync::atomic::{AtomicBool, Ordering};
1010

1111
pub mod abi;
12-
pub mod env;
1312
mod libunwind_integration;
1413
pub mod os;
1514
#[path = "../unsupported/pipe.rs"]

Diff for: library/std/src/sys/pal/solid/env.rs

-9
This file was deleted.

Diff for: library/std/src/sys/pal/solid/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pub mod itron {
1616
use super::unsupported;
1717
}
1818

19-
pub mod env;
2019
// `error` is `pub(crate)` so that it can be accessed by `itron/error.rs` as
2120
// `crate::sys::error`
2221
pub(crate) mod error;

Diff for: library/std/src/sys/pal/teeos/mod.rs

-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
#![allow(unused_variables)]
77
#![allow(dead_code)]
88

9-
#[path = "../unsupported/env.rs"]
10-
pub mod env;
11-
//pub mod fd;
129
pub mod os;
1310
#[path = "../unsupported/pipe.rs"]
1411
pub mod pipe;

Diff for: library/std/src/sys/pal/trusty/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
#[path = "../unsupported/common.rs"]
44
#[deny(unsafe_op_in_unsafe_fn)]
55
mod common;
6-
#[path = "../unsupported/env.rs"]
7-
pub mod env;
86
#[path = "../unsupported/os.rs"]
97
pub mod os;
108
#[path = "../unsupported/pipe.rs"]

Diff for: library/std/src/sys/pal/uefi/env.rs

-9
This file was deleted.

Diff for: library/std/src/sys/pal/uefi/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
//! [`OsString`]: crate::ffi::OsString
1414
#![forbid(unsafe_op_in_unsafe_fn)]
1515

16-
pub mod env;
1716
pub mod helpers;
1817
pub mod os;
1918
#[path = "../unsupported/pipe.rs"]

Diff for: library/std/src/sys/pal/unix/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use crate::io::ErrorKind;
66
#[macro_use]
77
pub mod weak;
88

9-
pub mod env;
109
#[cfg(target_os = "fuchsia")]
1110
pub mod fuchsia;
1211
pub mod futex;

Diff for: library/std/src/sys/pal/unsupported/env.rs

-9
This file was deleted.

Diff for: library/std/src/sys/pal/unsupported/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![deny(unsafe_op_in_unsafe_fn)]
22

3-
pub mod env;
43
pub mod os;
54
pub mod pipe;
65
pub mod thread;

Diff for: library/std/src/sys/pal/wasi/env.rs

-11
This file was deleted.

Diff for: library/std/src/sys/pal/wasi/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
//! compiling for wasm. That way it's a compile time error for something that's
1414
//! guaranteed to be a runtime error!
1515
16-
pub mod env;
1716
#[allow(unused)]
1817
#[path = "../wasm/atomics/futex.rs"]
1918
pub mod futex;

Diff for: library/std/src/sys/pal/wasip2/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
//! To begin with, this target mirrors the wasi target 1 to 1, but over
77
//! time this will change significantly.
88
9-
#[path = "../wasi/env.rs"]
10-
pub mod env;
119
#[allow(unused)]
1210
#[path = "../wasm/atomics/futex.rs"]
1311
pub mod futex;

Diff for: library/std/src/sys/pal/wasm/env.rs

-9
This file was deleted.

Diff for: library/std/src/sys/pal/wasm/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
1717
#![deny(unsafe_op_in_unsafe_fn)]
1818

19-
pub mod env;
2019
#[path = "../unsupported/os.rs"]
2120
pub mod os;
2221
#[path = "../unsupported/pipe.rs"]

Diff for: library/std/src/sys/pal/windows/env.rs

-9
This file was deleted.

Diff for: library/std/src/sys/pal/windows/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ pub mod compat;
1515
pub mod api;
1616

1717
pub mod c;
18-
pub mod env;
1918
#[cfg(not(target_vendor = "win7"))]
2019
pub mod futex;
2120
pub mod handle;

Diff for: library/std/src/sys/pal/xous/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#![forbid(unsafe_op_in_unsafe_fn)]
22

3-
#[path = "../unsupported/env.rs"]
4-
pub mod env;
53
pub mod os;
64
#[path = "../unsupported/pipe.rs"]
75
pub mod pipe;

Diff for: library/std/src/sys/pal/zkvm/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
pub const WORD_SIZE: usize = size_of::<u32>();
1212

1313
pub mod abi;
14-
pub mod env;
1514
pub mod os;
1615
#[path = "../unsupported/pipe.rs"]
1716
pub mod pipe;

0 commit comments

Comments
 (0)