Skip to content

Commit 04a432e

Browse files
authored
Merge pull request dtolnay#447 from dtolnay/workspacewrapper
Apply RUSTC_WORKSPACE_WRAPPER
2 parents 48ae580 + 2de85f1 commit 04a432e

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

build.rs

+10-9
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
use std::env;
3838
use std::ffi::OsString;
39+
use std::iter;
3940
use std::path::Path;
4041
use std::process::{self, Command, Stdio};
4142
use std::str;
@@ -138,15 +139,15 @@ fn compile_probe(rustc_bootstrap: bool) -> bool {
138139
let out_dir = cargo_env_var("OUT_DIR");
139140
let probefile = Path::new("build").join("probe.rs");
140141

141-
// Make sure to pick up Cargo rustc configuration.
142-
let mut cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER") {
143-
let mut cmd = Command::new(wrapper);
144-
// The wrapper's first argument is supposed to be the path to rustc.
145-
cmd.arg(rustc);
146-
cmd
147-
} else {
148-
Command::new(rustc)
149-
};
142+
let rustc_wrapper = env::var_os("RUSTC_WRAPPER").filter(|wrapper| !wrapper.is_empty());
143+
let rustc_workspace_wrapper =
144+
env::var_os("RUSTC_WORKSPACE_WRAPPER").filter(|wrapper| !wrapper.is_empty());
145+
let mut rustc = rustc_wrapper
146+
.into_iter()
147+
.chain(rustc_workspace_wrapper)
148+
.chain(iter::once(rustc));
149+
let mut cmd = Command::new(rustc.next().unwrap());
150+
cmd.args(rustc);
150151

151152
if !rustc_bootstrap {
152153
cmd.env_remove("RUSTC_BOOTSTRAP");

0 commit comments

Comments
 (0)