mirror of https://github.com/rust-lang/rust.git
restore check for both target os and env
This is better than the old impl of target.ends_with("windows-gnu"), because it also catches things like windows-gnullvm
This commit is contained in:
parent
5b0a0d8254
commit
9a2d1b85ed
|
@ -409,6 +409,7 @@ pub struct TargetCfgs {
|
||||||
pub all_targets: HashSet<String>,
|
pub all_targets: HashSet<String>,
|
||||||
pub all_archs: HashSet<String>,
|
pub all_archs: HashSet<String>,
|
||||||
pub all_oses: HashSet<String>,
|
pub all_oses: HashSet<String>,
|
||||||
|
pub all_oses_and_envs: HashSet<String>,
|
||||||
pub all_envs: HashSet<String>,
|
pub all_envs: HashSet<String>,
|
||||||
pub all_abis: HashSet<String>,
|
pub all_abis: HashSet<String>,
|
||||||
pub all_families: HashSet<String>,
|
pub all_families: HashSet<String>,
|
||||||
|
@ -433,6 +434,7 @@ impl TargetCfgs {
|
||||||
let mut all_targets = HashSet::new();
|
let mut all_targets = HashSet::new();
|
||||||
let mut all_archs = HashSet::new();
|
let mut all_archs = HashSet::new();
|
||||||
let mut all_oses = HashSet::new();
|
let mut all_oses = HashSet::new();
|
||||||
|
let mut all_oses_and_envs = HashSet::new();
|
||||||
let mut all_envs = HashSet::new();
|
let mut all_envs = HashSet::new();
|
||||||
let mut all_abis = HashSet::new();
|
let mut all_abis = HashSet::new();
|
||||||
let mut all_families = HashSet::new();
|
let mut all_families = HashSet::new();
|
||||||
|
@ -441,6 +443,7 @@ impl TargetCfgs {
|
||||||
for (target, cfg) in targets.into_iter() {
|
for (target, cfg) in targets.into_iter() {
|
||||||
all_archs.insert(cfg.arch.clone());
|
all_archs.insert(cfg.arch.clone());
|
||||||
all_oses.insert(cfg.os.clone());
|
all_oses.insert(cfg.os.clone());
|
||||||
|
all_oses_and_envs.insert(cfg.os_and_env());
|
||||||
all_envs.insert(cfg.env.clone());
|
all_envs.insert(cfg.env.clone());
|
||||||
all_abis.insert(cfg.abi.clone());
|
all_abis.insert(cfg.abi.clone());
|
||||||
for family in &cfg.families {
|
for family in &cfg.families {
|
||||||
|
@ -459,6 +462,7 @@ impl TargetCfgs {
|
||||||
all_targets,
|
all_targets,
|
||||||
all_archs,
|
all_archs,
|
||||||
all_oses,
|
all_oses,
|
||||||
|
all_oses_and_envs,
|
||||||
all_envs,
|
all_envs,
|
||||||
all_abis,
|
all_abis,
|
||||||
all_families,
|
all_families,
|
||||||
|
@ -506,6 +510,12 @@ pub struct TargetCfg {
|
||||||
panic: PanicStrategy,
|
panic: PanicStrategy,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl TargetCfg {
|
||||||
|
pub(crate) fn os_and_env(&self) -> String {
|
||||||
|
format!("{}-{}", self.os, self.env)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn default_os() -> String {
|
fn default_os() -> String {
|
||||||
"none".into()
|
"none".into()
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,11 @@ pub(super) fn parse_cfg_name_directive<'a>(
|
||||||
allowed_names: &target_cfgs.all_envs,
|
allowed_names: &target_cfgs.all_envs,
|
||||||
message: "when the target environment is {name}"
|
message: "when the target environment is {name}"
|
||||||
}
|
}
|
||||||
|
condition! {
|
||||||
|
name: &target_cfg.os_and_env(),
|
||||||
|
allowed_names: &target_cfgs.all_oses_and_envs,
|
||||||
|
message: "when the operative system and target environment are {name}"
|
||||||
|
}
|
||||||
condition! {
|
condition! {
|
||||||
name: &target_cfg.abi,
|
name: &target_cfg.abi,
|
||||||
allowed_names: &target_cfgs.all_abis,
|
allowed_names: &target_cfgs.all_abis,
|
||||||
|
|
Loading…
Reference in New Issue