diff options
| author | bors <bors@rust-lang.org> | 2023-06-30 15:02:46 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-06-30 15:02:46 +0000 |
| commit | f4b80cacf93ca216c75f6ae12f4b9dec19eba42f (patch) | |
| tree | 694ea9b00af6914a8f48844d8b7f86b89c0f64b2 | |
| parent | 56d507dc92d32dc8c9044673bba5b41510a61f62 (diff) | |
| parent | 00cc815e57329bb78d6df886275b3372ee8991be (diff) | |
| download | rust-f4b80cacf93ca216c75f6ae12f4b9dec19eba42f.tar.gz rust-f4b80cacf93ca216c75f6ae12f4b9dec19eba42f.zip | |
Auto merge of #113200 - ferrocene:pa-fix-mir-opt-bless, r=oli-obk
Fix loading target specs in compiletest not working with custom targets In https://github.com/rust-lang/rust/pull/112454#issuecomment-1611351168 it was pointed out that the PR broke blessing mir-opt tests. Since #112418, blessing mir-opt tests generates "synthetic targets", which are custom target specs. Those specs are not included in `--print=all-target-specs-json`, and #112454 required that the current target was returned by that flag. This PR fixes the breakage by loading the target spec for the current target explicitly, if a custom target is detected. r? `@oli-obk`
| -rw-r--r-- | src/tools/compiletest/src/common.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 81684c6f9f9..c95a125c737 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -439,7 +439,7 @@ pub struct TargetCfgs { impl TargetCfgs { fn new(config: &Config) -> TargetCfgs { - let targets: HashMap<String, TargetCfg> = serde_json::from_str(&rustc_output( + let mut targets: HashMap<String, TargetCfg> = serde_json::from_str(&rustc_output( config, &["--print=all-target-specs-json", "-Zunstable-options"], )) @@ -454,6 +454,18 @@ impl TargetCfgs { let mut all_families = HashSet::new(); let mut all_pointer_widths = HashSet::new(); + // Handle custom target specs, which are not included in `--print=all-target-specs-json`. + if config.target.ends_with(".json") { + targets.insert( + config.target.clone(), + serde_json::from_str(&rustc_output( + config, + &["--print=target-spec-json", "-Zunstable-options", "--target", &config.target], + )) + .unwrap(), + ); + } + for (target, cfg) in targets.iter() { all_archs.insert(cfg.arch.clone()); all_oses.insert(cfg.os.clone()); |
