Rollup merge of #139868 - thaliaarchi:move-env-consts-pal, r=joboet
Move `pal::env` to `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 #117276.
This commit is contained in:
commit
709f4fee50
27 changed files with 251 additions and 248 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue