Skip to content

Commit 1c25885

Browse files
committed
Auto merge of rust-lang#14995 - Veykril:proc-macro-slow-test, r=lnicola
fix: Fix proc-macro slow test
2 parents 058e2d2 + a6bef78 commit 1c25885

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ jobs:
6363
- name: Install Rust toolchain
6464
run: |
6565
rustup update --no-self-update ${{ env.RUST_CHANNEL }}
66-
rustup component add rustfmt rust-src
66+
rustup component add --toolchain ${{ env.RUST_CHANNEL }} rustfmt rust-src
67+
rustup default ${{ env.RUST_CHANNEL }}
6768
6869
- name: Cache Dependencies
6970
uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894

crates/rust-analyzer/tests/slow-tests/main.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,17 @@ fn resolve_proc_macro() {
839839
return;
840840
}
841841

842+
// skip using the sysroot config as to prevent us from loading the sysroot sources
843+
let mut rustc = std::process::Command::new(toolchain::rustc());
844+
rustc.args(["--print", "sysroot"]);
845+
let output = rustc.output().unwrap();
846+
let sysroot =
847+
vfs::AbsPathBuf::try_from(std::str::from_utf8(&output.stdout).unwrap().trim()).unwrap();
848+
849+
let standalone_server_name =
850+
format!("rust-analyzer-proc-macro-srv{}", std::env::consts::EXE_SUFFIX);
851+
let proc_macro_server_path = sysroot.join("libexec").join(&standalone_server_name);
852+
842853
let server = Project::with_fixture(
843854
r###"
844855
//- /foo/Cargo.toml
@@ -916,7 +927,7 @@ pub fn foo(_input: TokenStream) -> TokenStream {
916927
},
917928
"procMacro": {
918929
"enable": true,
919-
"server": PathBuf::from(env!("CARGO_BIN_EXE_rust-analyzer")),
930+
"server": proc_macro_server_path.as_path().as_ref(),
920931
}
921932
}))
922933
.root("foo")

0 commit comments

Comments
 (0)