From 9b67b272baf204550613dbd00c8057a3c6d13dfa Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Thu, 6 Sep 2018 00:26:29 +0100 Subject: [PATCH] Don't use an empty RUSTC_WRAPPER --- src/cargo/util/rustc.rs | 13 +++++++------ tests/testsuite/check.rs | 6 ++++++ 2 files changed, 13 insertions(+), 6 deletions(-) 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(); +}