From 9aed850b49ecaf644cbe620c3b17e7447e8735d0 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 8 Aug 2022 10:57:26 -0400 Subject: [PATCH] work around RAs RUSTC_WRAPPER hack --- build.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index c470ba1..944d178 100644 --- a/build.rs +++ b/build.rs @@ -70,8 +70,14 @@ fn compile_probe() -> Option { let probefile = Path::new(&out_dir).join("probe.rs"); fs::write(&probefile, PROBE).ok()?; - // Make sure to pick up Cargo rustc configuration. - let mut cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER") { + // Make sure to pick up Cargo rustc configuration, while working around + // . + let wrapper = env::var_os("RUSTC_WRAPPER").filter(|w| { + let wrapper_filename = Path::new(w).file_name().unwrap_or_default(); + // Ignore wrappers with these filenames. + wrapper_filename != "rust-analyzer" && wrapper_filename != "rust-analyzer.exe" + }); + let mut cmd = if let Some(wrapper) = wrapper { let mut cmd = Command::new(wrapper); // The wrapper's first argument is supposed to be the path to rustc. cmd.arg(rustc);