From cb1b2ac4f18a8c87cca5f7e1a582ed1f694ac757 Mon Sep 17 00:00:00 2001 From: Paul Menage Date: Tue, 26 Sep 2023 08:24:20 -0700 Subject: [PATCH] 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 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` --- src/cargo/ops/cargo_compile/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cargo/ops/cargo_compile/mod.rs b/src/cargo/ops/cargo_compile/mod.rs index bd8c4fbfa85..9cf8599c48c 100644 --- a/src/cargo/ops/cargo_compile/mod.rs +++ b/src/cargo/ops/cargo_compile/mod.rs @@ -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()?;