Skip to content

Commit 4bed89f

Browse files
Correctly pass toolchain to cargo command
1 parent d793f80 commit 4bed89f

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

build_system/src/test.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -672,17 +672,14 @@ where
672672
F: Fn(&[&dyn AsRef<OsStr>], Option<&Path>, &Env) -> Result<(), String>,
673673
{
674674
let toolchain = get_toolchain()?;
675+
let toolchain_arg = format!("+{}", toolchain);
675676
let rustc_version = String::from_utf8(
676677
run_command_with_env(&[&args.config_info.rustc_command[0], &"-V"], cwd, Some(env))?.stdout,
677678
)
678679
.map_err(|error| format!("Failed to retrieve rustc version: {:?}", error))?;
679680
let rustc_toolchain_version = String::from_utf8(
680681
run_command_with_env(
681-
&[
682-
&args.config_info.rustc_command[0],
683-
&format!("+{}", toolchain),
684-
&"-V",
685-
],
682+
&[&args.config_info.rustc_command[0], &toolchain_arg, &"-V"],
686683
cwd,
687684
Some(env),
688685
)?
@@ -697,7 +694,7 @@ where
697694
);
698695
eprintln!("Using `{}`.", rustc_toolchain_version);
699696
}
700-
let mut cargo_command: Vec<&dyn AsRef<OsStr>> = vec![&"cargo", &toolchain];
697+
let mut cargo_command: Vec<&dyn AsRef<OsStr>> = vec![&"cargo", &toolchain_arg];
701698
cargo_command.extend_from_slice(&command);
702699
callback(&cargo_command, cwd, env)
703700
}

0 commit comments

Comments
 (0)