Skip to content

Commit

Permalink
Use full target spec for cargo rustc --print --target
Browse files Browse the repository at this point in the history
`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 aborts

`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
paulmenage committed Sep 26, 2023
1 parent 3ea3c3a commit cb1b2ac
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 cb1b2ac

Please sign in to comment.