Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--.github/workflows/ci.yaml16
-rw-r--r--crates/proc-macro-srv/proc-macro-test/imp/.gitignore1
-rw-r--r--crates/proc-macro-srv/proc-macro-test/imp/Cargo.lock7
-rw-r--r--crates/rust-analyzer/tests/slow-tests/main.rs23
4 files changed, 17 insertions, 30 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index fa4612f1b0..645b596f97 100644
--- a/.github/workflows/ci.yaml
+++ b/.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/crates/proc-macro-srv/proc-macro-test/imp/.gitignore b/crates/proc-macro-srv/proc-macro-test/imp/.gitignore
index 2c96eb1b65..2f7896d1d1 100644
--- a/crates/proc-macro-srv/proc-macro-test/imp/.gitignore
+++ b/crates/proc-macro-srv/proc-macro-test/imp/.gitignore
@@ -1,2 +1 @@
target/
-Cargo.lock
diff --git a/crates/proc-macro-srv/proc-macro-test/imp/Cargo.lock b/crates/proc-macro-srv/proc-macro-test/imp/Cargo.lock
new file mode 100644
index 0000000000..99c7ca10af
--- /dev/null
+++ b/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/crates/rust-analyzer/tests/slow-tests/main.rs b/crates/rust-analyzer/tests/slow-tests/main.rs
index 6f7b09c27f..96c2ceef6b 100644
--- a/crates/rust-analyzer/tests/slow-tests/main.rs
+++ b/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(),
});