diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2023-06-07 07:02:49 +0200 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2023-06-07 07:03:27 +0200 |
| commit | a6bef7808fa2ef47d1e44cbed5b9632a46290c0d (patch) | |
| tree | 6f4ff22cd49aff583f296b486a85138783f7a918 | |
| parent | 058e2d2bdd06b63a137f0f7931d5725e530f17e4 (diff) | |
| download | rust-a6bef7808fa2ef47d1e44cbed5b9632a46290c0d.tar.gz rust-a6bef7808fa2ef47d1e44cbed5b9632a46290c0d.zip | |
fix: Fix proc-macro slow test
| -rw-r--r-- | .github/workflows/ci.yaml | 3 | ||||
| -rw-r--r-- | crates/rust-analyzer/tests/slow-tests/main.rs | 13 |
2 files changed, 14 insertions, 2 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 92e353ba8f3..31bb7eed8d7 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 e130c762fc4..0bb29e7080f 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") |
