diff --git a/build.rs b/build.rs index 99dbf4059..c738a90f0 100644 --- a/build.rs +++ b/build.rs @@ -199,7 +199,11 @@ fn can_compile>(test: T) -> bool { let rustc = var("RUSTC").unwrap(); let target = var("TARGET").unwrap(); - let mut cmd = if let Ok(wrapper) = var("RUSTC_WRAPPER") { + let wrapper = var("RUSTC_WRAPPER") + .ok() + .and_then(|w| if w.is_empty() { None } else { Some(w) }); + + let mut cmd = if let Some(wrapper) = wrapper { let mut cmd = std::process::Command::new(wrapper); // The wrapper's first argument is supposed to be the path to rustc. cmd.arg(rustc);