Skip to content

Commit

Permalink
Auto merge of #12743 - paulmenage:fix-rustc-print-target, r=weihanglo
Browse files Browse the repository at this point in the history
Use full target spec for `cargo rustc --print --target`

`cargo::ops::cargo_compile::print()` was using the shortname for the `--target` flag to rustc, but should be using the full target spec;  otherwise a JSON-specified target (e.g. `--target /path/to/some-custom-target.json`) will cause a rustc error such as

`error: Error loading target specification: Could not find specification for target "some-custom-target". Run rustc --print target-list for a list of built-in targets`
  • Loading branch information
bors committed Sep 26, 2023
2 parents 25dc3bd + cb1b2ac commit e6aabe8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cargo/ops/cargo_compile/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ pub fn print<'a>(
process.args(args);
}
if let CompileKind::Target(t) = kind {
process.arg("--target").arg(t.short_name());
process.arg("--target").arg(t.rustc_target());
}
process.arg("--print").arg(print_opt_value);
process.exec()?;
Expand Down

0 comments on commit e6aabe8

Please sign in to comment.