Merge pull request #20579 from Elliot-Roberts/fix-double-target-option

fix: Avoid `--target` option being given twice to `rustc` when invoked through `cargo rustc` while fetching target data layout
This commit is contained in:
Chayim Refael Friedman 2025-08-30 23:41:14 +00:00 committed by GitHub
commit 21614ed2d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,14 +23,11 @@ pub fn get(
QueryConfig::Cargo(sysroot, cargo_toml, _) => {
let mut cmd = sysroot.tool(Tool::Cargo, cargo_toml.parent(), extra_env);
cmd.env("RUSTC_BOOTSTRAP", "1");
cmd.args(["rustc", "-Z", "unstable-options"]).args(RUSTC_ARGS).args([
"--",
"-Z",
"unstable-options",
]);
cmd.args(["rustc", "-Z", "unstable-options"]).args(RUSTC_ARGS);
if let Some(target) = target {
cmd.args(["--target", target]);
}
cmd.args(["--", "-Z", "unstable-options"]);
match utf8_stdout(&mut cmd) {
Ok(output) => return process(output),
Err(e) => {