Skip to content

Commit

Permalink
Auto merge of rust-lang#14995 - Veykril:proc-macro-slow-test, r=lnicola
Browse files Browse the repository at this point in the history
fix: Fix proc-macro slow test
  • Loading branch information
bors committed Jun 7, 2023
2 parents 058e2d2 + a6bef78 commit 1c25885
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion crates/rust-analyzer/tests/slow-tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 1c25885

Please sign in to comment.