Skip to content

Move pal::env to std::sys::env_consts #139868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions compiler/rustc_target/src/spec/base/linux_musl.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use crate::spec::{LinkSelfContainedDefault, TargetOptions, base, crt_objects};

pub(crate) fn opts() -> TargetOptions {
let mut base = base::linux::opts();

base.env = "musl".into();
base.pre_link_objects_self_contained = crt_objects::pre_musl_self_contained();
base.post_link_objects_self_contained = crt_objects::post_musl_self_contained();
base.link_self_contained = LinkSelfContainedDefault::InferredForMusl;

base
TargetOptions {
env: "musl".into(),
pre_link_objects_self_contained: crt_objects::pre_musl_self_contained(),
post_link_objects_self_contained: crt_objects::post_musl_self_contained(),
link_self_contained: LinkSelfContainedDefault::InferredForMusl,
..base::linux::opts()
}
}
15 changes: 7 additions & 8 deletions compiler/rustc_target/src/spec/base/linux_ohos.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use crate::spec::{TargetOptions, TlsModel, base};

pub(crate) fn opts() -> TargetOptions {
let mut base = base::linux::opts();

base.env = "ohos".into();
base.crt_static_default = false;
base.tls_model = TlsModel::Emulated;
base.has_thread_local = false;

base
TargetOptions {
env: "ohos".into(),
crt_static_default: false,
tls_model: TlsModel::Emulated,
has_thread_local: false,
..base::linux::opts()
}
}
2 changes: 1 addition & 1 deletion library/std/src/env.rs
Original file line number Diff line number Diff line change
@@ -950,7 +950,7 @@ impl fmt::Debug for ArgsOs {
/// Constants associated with the current target
#[stable(feature = "env", since = "1.0.0")]
pub mod consts {
use crate::sys::env::os;
use crate::sys::env_consts::os;

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

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions library/std/src/sys/mod.rs
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ pub mod anonymous_pipe;
pub mod args;
pub mod backtrace;
pub mod cmath;
pub mod env_consts;
pub mod exit_guard;
pub mod fd;
pub mod fs;
9 changes: 0 additions & 9 deletions library/std/src/sys/pal/hermit/env.rs

This file was deleted.

1 change: 0 additions & 1 deletion library/std/src/sys/pal/hermit/mod.rs
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@

use crate::os::raw::c_char;

pub mod env;
pub mod futex;
pub mod os;
#[path = "../unsupported/pipe.rs"]
9 changes: 0 additions & 9 deletions library/std/src/sys/pal/sgx/env.rs

This file was deleted.

1 change: 0 additions & 1 deletion library/std/src/sys/pal/sgx/mod.rs
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ use crate::io::ErrorKind;
use crate::sync::atomic::{AtomicBool, Ordering};

pub mod abi;
pub mod env;
mod libunwind_integration;
pub mod os;
#[path = "../unsupported/pipe.rs"]
9 changes: 0 additions & 9 deletions library/std/src/sys/pal/solid/env.rs

This file was deleted.

1 change: 0 additions & 1 deletion library/std/src/sys/pal/solid/mod.rs
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@ pub mod itron {
use super::unsupported;
}

pub mod env;
// `error` is `pub(crate)` so that it can be accessed by `itron/error.rs` as
// `crate::sys::error`
pub(crate) mod error;
3 changes: 0 additions & 3 deletions library/std/src/sys/pal/teeos/mod.rs
Original file line number Diff line number Diff line change
@@ -6,9 +6,6 @@
#![allow(unused_variables)]
#![allow(dead_code)]

#[path = "../unsupported/env.rs"]
pub mod env;
//pub mod fd;
pub mod os;
#[path = "../unsupported/pipe.rs"]
pub mod pipe;
2 changes: 0 additions & 2 deletions library/std/src/sys/pal/trusty/mod.rs
Original file line number Diff line number Diff line change
@@ -3,8 +3,6 @@
#[path = "../unsupported/common.rs"]
#[deny(unsafe_op_in_unsafe_fn)]
mod common;
#[path = "../unsupported/env.rs"]
pub mod env;
#[path = "../unsupported/os.rs"]
pub mod os;
#[path = "../unsupported/pipe.rs"]
9 changes: 0 additions & 9 deletions library/std/src/sys/pal/uefi/env.rs

This file was deleted.

1 change: 0 additions & 1 deletion library/std/src/sys/pal/uefi/mod.rs
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@
//! [`OsString`]: crate::ffi::OsString
#![forbid(unsafe_op_in_unsafe_fn)]

pub mod env;
pub mod helpers;
pub mod os;
#[path = "../unsupported/pipe.rs"]
1 change: 0 additions & 1 deletion library/std/src/sys/pal/unix/mod.rs
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ use crate::io::ErrorKind;
#[macro_use]
pub mod weak;

pub mod env;
#[cfg(target_os = "fuchsia")]
pub mod fuchsia;
pub mod futex;
9 changes: 0 additions & 9 deletions library/std/src/sys/pal/unsupported/env.rs

This file was deleted.

1 change: 0 additions & 1 deletion library/std/src/sys/pal/unsupported/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![deny(unsafe_op_in_unsafe_fn)]

pub mod env;
pub mod os;
pub mod pipe;
pub mod thread;
11 changes: 0 additions & 11 deletions library/std/src/sys/pal/wasi/env.rs

This file was deleted.

1 change: 0 additions & 1 deletion library/std/src/sys/pal/wasi/mod.rs
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@
//! compiling for wasm. That way it's a compile time error for something that's
//! guaranteed to be a runtime error!
pub mod env;
#[allow(unused)]
#[path = "../wasm/atomics/futex.rs"]
pub mod futex;
2 changes: 0 additions & 2 deletions library/std/src/sys/pal/wasip2/mod.rs
Original file line number Diff line number Diff line change
@@ -6,8 +6,6 @@
//! To begin with, this target mirrors the wasi target 1 to 1, but over
//! time this will change significantly.
#[path = "../wasi/env.rs"]
pub mod env;
#[allow(unused)]
#[path = "../wasm/atomics/futex.rs"]
pub mod futex;
9 changes: 0 additions & 9 deletions library/std/src/sys/pal/wasm/env.rs

This file was deleted.

1 change: 0 additions & 1 deletion library/std/src/sys/pal/wasm/mod.rs
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@
#![deny(unsafe_op_in_unsafe_fn)]

pub mod env;
#[path = "../unsupported/os.rs"]
pub mod os;
#[path = "../unsupported/pipe.rs"]
9 changes: 0 additions & 9 deletions library/std/src/sys/pal/windows/env.rs

This file was deleted.

1 change: 0 additions & 1 deletion library/std/src/sys/pal/windows/mod.rs
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@ pub mod compat;
pub mod api;

pub mod c;
pub mod env;
#[cfg(not(target_vendor = "win7"))]
pub mod futex;
pub mod handle;
2 changes: 0 additions & 2 deletions library/std/src/sys/pal/xous/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#![forbid(unsafe_op_in_unsafe_fn)]

#[path = "../unsupported/env.rs"]
pub mod env;
pub mod os;
#[path = "../unsupported/pipe.rs"]
pub mod pipe;
1 change: 0 additions & 1 deletion library/std/src/sys/pal/zkvm/mod.rs
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@
pub const WORD_SIZE: usize = size_of::<u32>();

pub mod abi;
pub mod env;
pub mod os;
#[path = "../unsupported/pipe.rs"]
pub mod pipe;