Auto merge of #14995 - Veykril:proc-macro-slow-test, r=lnicola

fix: Fix proc-macro slow test
This commit is contained in:
bors 2023-06-07 05:04:33 +00:00
commit 1c25885bd2
2 changed files with 14 additions and 2 deletions

View file

@ -63,7 +63,8 @@ jobs:
- name: Install Rust toolchain - name: Install Rust toolchain
run: | run: |
rustup update --no-self-update ${{ env.RUST_CHANNEL }} 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 - name: Cache Dependencies
uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894 uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894

View file

@ -839,6 +839,17 @@ fn resolve_proc_macro() {
return; 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( let server = Project::with_fixture(
r###" r###"
//- /foo/Cargo.toml //- /foo/Cargo.toml
@ -916,7 +927,7 @@ pub fn foo(_input: TokenStream) -> TokenStream {
}, },
"procMacro": { "procMacro": {
"enable": true, "enable": true,
"server": PathBuf::from(env!("CARGO_BIN_EXE_rust-analyzer")), "server": proc_macro_server_path.as_path().as_ref(),
} }
})) }))
.root("foo") .root("foo")