diff --git a/src/cargo/util/rustc.rs b/src/cargo/util/rustc.rs index 1c25a79bef1..af6d6312131 100644 --- a/src/cargo/util/rustc.rs +++ b/src/cargo/util/rustc.rs @@ -66,12 +66,13 @@ impl Rustc { /// Get a process builder set up to use the found rustc version, with a wrapper if Some pub fn process(&self) -> ProcessBuilder { - if let Some(ref wrapper) = self.wrapper { - let mut cmd = util::process(wrapper); - cmd.arg(&self.path); - cmd - } else { - self.process_no_wrapper() + match self.wrapper { + Some(ref wrapper) if !wrapper.as_os_str().is_empty() => { + let mut cmd = util::process(wrapper); + cmd.arg(&self.path); + cmd + } + _ => self.process_no_wrapper() } } diff --git a/tests/testsuite/check.rs b/tests/testsuite/check.rs index 0468f6a830c..a0984950361 100644 --- a/tests/testsuite/check.rs +++ b/tests/testsuite/check.rs @@ -684,3 +684,9 @@ fn proc_macro() { ).build(); p.cargo("check -v").env("RUST_LOG", "cargo=trace").run(); } + +#[test] +fn does_not_use_empty_rustc_wrapper() { + let p = project().file("src/lib.rs", "").build(); + p.cargo("check").env("RUSTC_WRAPPER", "").run(); +}