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
Show file tree
Hide file tree
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
Expand Up @@ -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"`.
Expand Down
Loading
Loading