Skip to content

Commit 9aed850

Browse files
committed
work around RAs RUSTC_WRAPPER hack
1 parent e55761e commit 9aed850

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

build.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,14 @@ fn compile_probe() -> Option<ExitStatus> {
7070
let probefile = Path::new(&out_dir).join("probe.rs");
7171
fs::write(&probefile, PROBE).ok()?;
7272

73-
// Make sure to pick up Cargo rustc configuration.
74-
let mut cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER") {
73+
// Make sure to pick up Cargo rustc configuration, while working around
74+
// <https://github.com/rust-lang/rust-analyzer/issues/12973>.
75+
let wrapper = env::var_os("RUSTC_WRAPPER").filter(|w| {
76+
let wrapper_filename = Path::new(w).file_name().unwrap_or_default();
77+
// Ignore wrappers with these filenames.
78+
wrapper_filename != "rust-analyzer" && wrapper_filename != "rust-analyzer.exe"
79+
});
80+
let mut cmd = if let Some(wrapper) = wrapper {
7581
let mut cmd = Command::new(wrapper);
7682
// The wrapper's first argument is supposed to be the path to rustc.
7783
cmd.arg(rustc);

0 commit comments

Comments
 (0)