chore: Clean up proc-macro-srv CI job

This commit is contained in:
Lukas Wirth 2025-03-18 11:34:14 +01:00
parent 31e412c290
commit 56c9f331ee
4 changed files with 17 additions and 30 deletions

View file

@ -15,7 +15,7 @@ env:
CARGO_NET_RETRY: 10
CI: 1
RUST_BACKTRACE: short
RUSTFLAGS: "-D warnings -D elided_lifetimes_in_paths -D explicit_outlives_requirements -D unsafe_op_in_unsafe_fn -D unused_extern_crates -D unused_lifetimes -D unreachable_pub"
RUSTFLAGS: "-D warnings"
RUSTUP_MAX_RETRIES: 10
jobs:
@ -58,18 +58,15 @@ jobs:
rustup component add --toolchain nightly rust-src rustfmt
# https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/rust.json
- name: Install Rust Problem Matcher
if: matrix.os == 'ubuntu-latest'
run: echo "::add-matcher::.github/rust.json"
- name: Cache Dependencies
uses: Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609
# We don't cache this job, as it will be invalidated every day due to nightly usage
- name: Bump opt-level
if: matrix.os == 'ubuntu-latest'
run: sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml
- name: Test
run: cargo test --features sysroot-abi -p rust-analyzer -p proc-macro-srv -p proc-macro-srv-cli -p proc-macro-api -- --quiet
run: cargo test --features sysroot-abi -p proc-macro-srv -p proc-macro-srv-cli -p proc-macro-api -- --quiet
rust:
if: github.repository == 'rust-lang/rust-analyzer'
@ -79,7 +76,6 @@ jobs:
CC: deny_c
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
@ -103,7 +99,11 @@ jobs:
run: echo "::add-matcher::.github/rust.json"
- name: Cache Dependencies
uses: Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609
uses: Swatinem/rust-cache@27b8ea9368cf428f0bfe41b0876b1a7e809d9844
with:
workspaces: |
. -> target
crates/proc-macro-srv/proc-macro-test/imp -> target
- uses: taiki-e/install-action@nextest

View file

@ -1,2 +1 @@
target/
Cargo.lock

View file

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "proc-macro-test-impl"
version = "0.0.0"

View file

@ -1140,26 +1140,12 @@ fn root_contains_symlink_out_dirs_check() {
}
#[test]
#[cfg(any(feature = "sysroot-abi", rust_analyzer))]
fn resolve_proc_macro() {
use expect_test::expect;
use vfs::AbsPathBuf;
if skip_slow_tests() {
return;
}
let mut sysroot = project_model::Sysroot::discover(
&AbsPathBuf::assert_utf8(std::env::current_dir().unwrap()),
&Default::default(),
);
let loaded_sysroot =
sysroot.load_workspace(&project_model::RustSourceWorkspaceConfig::default_cargo());
if let Some(loaded_sysroot) = loaded_sysroot {
sysroot.set_workspace(loaded_sysroot);
}
let proc_macro_server_path = sysroot.discover_proc_macro_srv().unwrap();
let server = Project::with_fixture(
r###"
//- /foo/Cargo.toml
@ -1171,12 +1157,8 @@ edition = "2021"
bar = {path = "../bar"}
//- /foo/src/main.rs
#![allow(internal_features)]
#![feature(rustc_attrs, decl_macro)]
use bar::Bar;
#[rustc_builtin_macro]
macro derive($item:item) {}
trait Bar {
fn bar();
}
@ -1233,11 +1215,10 @@ pub fn foo(_input: TokenStream) -> TokenStream {
"buildScripts": {
"enable": true
},
"sysroot": null,
"sysroot": "discover",
},
"procMacro": {
"enable": true,
"server": proc_macro_server_path.as_path().as_str(),
}
}))
.root("foo")
@ -1248,7 +1229,7 @@ pub fn foo(_input: TokenStream) -> TokenStream {
let res = server.send_request::<HoverRequest>(HoverParams {
text_document_position_params: TextDocumentPositionParams::new(
server.doc_id("foo/src/main.rs"),
Position::new(12, 9),
Position::new(8, 9),
),
work_done_progress_params: Default::default(),
});