Unnamed repository; edit this file 'description' to name the repository.
Auto merge of #14995 - Veykril:proc-macro-slow-test, r=lnicola
fix: Fix proc-macro slow test
bors 2023-06-07
parent 058e2d2 · parent a6bef78 · commit 1c25885
-rw-r--r--.github/workflows/ci.yaml3
-rw-r--r--crates/rust-analyzer/tests/slow-tests/main.rs13
2 files changed, 14 insertions, 2 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 92e353ba8f..31bb7eed8d 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -63,7 +63,8 @@ jobs:
- name: Install Rust toolchain
run: |
rustup update --no-self-update ${{ env.RUST_CHANNEL }}
- rustup component add rustfmt rust-src
+ rustup component add --toolchain ${{ env.RUST_CHANNEL }} rustfmt rust-src
+ rustup default ${{ env.RUST_CHANNEL }}
- name: Cache Dependencies
uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894
diff --git a/crates/rust-analyzer/tests/slow-tests/main.rs b/crates/rust-analyzer/tests/slow-tests/main.rs
index e130c762fc..0bb29e7080 100644
--- a/crates/rust-analyzer/tests/slow-tests/main.rs
+++ b/crates/rust-analyzer/tests/slow-tests/main.rs
@@ -839,6 +839,17 @@ fn resolve_proc_macro() {
return;
}
+ // skip using the sysroot config as to prevent us from loading the sysroot sources
+ let mut rustc = std::process::Command::new(toolchain::rustc());
+ rustc.args(["--print", "sysroot"]);
+ let output = rustc.output().unwrap();
+ let sysroot =
+ vfs::AbsPathBuf::try_from(std::str::from_utf8(&output.stdout).unwrap().trim()).unwrap();
+
+ let standalone_server_name =
+ format!("rust-analyzer-proc-macro-srv{}", std::env::consts::EXE_SUFFIX);
+ let proc_macro_server_path = sysroot.join("libexec").join(&standalone_server_name);
+
let server = Project::with_fixture(
r###"
//- /foo/Cargo.toml
@@ -916,7 +927,7 @@ pub fn foo(_input: TokenStream) -> TokenStream {
},
"procMacro": {
"enable": true,
- "server": PathBuf::from(env!("CARGO_BIN_EXE_rust-analyzer")),
+ "server": proc_macro_server_path.as_path().as_ref(),
}
}))
.root("foo")