about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2025-03-18 11:34:14 +0100
committerLukas Wirth <lukastw97@gmail.com>2025-03-18 12:06:25 +0100
commite41cd5f14894c0a0eb2a58a9918a2f44fa63f7f1 (patch)
tree5860fa06480912d4a2891c79eda991813b0f7f8a
parent1f275b66093d2a60d184566cad7049ea71e89498 (diff)
downloadrust-e41cd5f14894c0a0eb2a58a9918a2f44fa63f7f1.tar.gz
rust-e41cd5f14894c0a0eb2a58a9918a2f44fa63f7f1.zip
chore: Clean up proc-macro-srv CI job
-rw-r--r--src/tools/rust-analyzer/.github/workflows/ci.yaml16
-rw-r--r--src/tools/rust-analyzer/crates/proc-macro-srv/proc-macro-test/imp/.gitignore1
-rw-r--r--src/tools/rust-analyzer/crates/proc-macro-srv/proc-macro-test/imp/Cargo.lock7
-rw-r--r--src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/main.rs23
4 files changed, 17 insertions, 30 deletions
diff --git a/src/tools/rust-analyzer/.github/workflows/ci.yaml b/src/tools/rust-analyzer/.github/workflows/ci.yaml
index fa4612f1b06..645b596f97f 100644
--- a/src/tools/rust-analyzer/.github/workflows/ci.yaml
+++ b/src/tools/rust-analyzer/.github/workflows/ci.yaml
@@ -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
 
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv/proc-macro-test/imp/.gitignore b/src/tools/rust-analyzer/crates/proc-macro-srv/proc-macro-test/imp/.gitignore
index 2c96eb1b651..2f7896d1d13 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-srv/proc-macro-test/imp/.gitignore
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv/proc-macro-test/imp/.gitignore
@@ -1,2 +1 @@
 target/
-Cargo.lock
diff --git a/src/tools/rust-analyzer/crates/proc-macro-srv/proc-macro-test/imp/Cargo.lock b/src/tools/rust-analyzer/crates/proc-macro-srv/proc-macro-test/imp/Cargo.lock
new file mode 100644
index 00000000000..99c7ca10aff
--- /dev/null
+++ b/src/tools/rust-analyzer/crates/proc-macro-srv/proc-macro-test/imp/Cargo.lock
@@ -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"
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/main.rs b/src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/main.rs
index 6f7b09c27f1..96c2ceef6ba 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/main.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/tests/slow-tests/main.rs
@@ -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(),
     });