Skip to content

Commit 00cc815

Browse files
committed
fix loading target specs in compiletest not working with custom targets
1 parent af9df2f commit 00cc815

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/tools/compiletest/src/common.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ pub struct TargetCfgs {
439439

440440
impl TargetCfgs {
441441
fn new(config: &Config) -> TargetCfgs {
442-
let targets: HashMap<String, TargetCfg> = serde_json::from_str(&rustc_output(
442+
let mut targets: HashMap<String, TargetCfg> = serde_json::from_str(&rustc_output(
443443
config,
444444
&["--print=all-target-specs-json", "-Zunstable-options"],
445445
))
@@ -454,6 +454,18 @@ impl TargetCfgs {
454454
let mut all_families = HashSet::new();
455455
let mut all_pointer_widths = HashSet::new();
456456

457+
// Handle custom target specs, which are not included in `--print=all-target-specs-json`.
458+
if config.target.ends_with(".json") {
459+
targets.insert(
460+
config.target.clone(),
461+
serde_json::from_str(&rustc_output(
462+
config,
463+
&["--print=target-spec-json", "-Zunstable-options", "--target", &config.target],
464+
))
465+
.unwrap(),
466+
);
467+
}
468+
457469
for (target, cfg) in targets.iter() {
458470
all_archs.insert(cfg.arch.clone());
459471
all_oses.insert(cfg.os.clone());

0 commit comments

Comments
 (0)