Unnamed repository; edit this file 'description' to name the repository.
Merge pull request #22500 from bjorn3/proc-macro-srv_sysroot_crates
Always use crates from sysroot in proc-macro-srv
Lukas Wirth 3 days ago
parent ce1a27e · parent 2ce4468 · commit 8c12600
-rw-r--r--.github/workflows/ci.yaml2
-rw-r--r--Cargo.lock1
-rw-r--r--crates/proc-macro-api/Cargo.toml1
-rw-r--r--crates/proc-macro-api/src/lib.rs5
-rw-r--r--crates/proc-macro-srv-cli/Cargo.toml1
-rw-r--r--crates/proc-macro-srv-cli/src/lib.rs5
-rw-r--r--crates/proc-macro-srv-cli/src/main.rs4
-rw-r--r--crates/proc-macro-srv-cli/tests/bidirectional_postcard.rs3
-rw-r--r--crates/proc-macro-srv-cli/tests/legacy_json.rs3
-rw-r--r--crates/proc-macro-srv/Cargo.toml3
-rw-r--r--crates/proc-macro-srv/src/lib.rs15
-rw-r--r--crates/rust-analyzer/Cargo.toml1
12 files changed, 11 insertions, 33 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index b9427e1927..3eb4c13465 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -56,7 +56,7 @@ jobs:
- name: Install Rust toolchain
run: |
RUSTC_VERSION=$(cat rust-version)
- rustup-toolchain-install-master ${RUSTC_VERSION} -c cargo -c rust-src -c rustfmt
+ rustup-toolchain-install-master ${RUSTC_VERSION} -c cargo -c rust-src -c rustfmt -c rustc-dev -c llvm-tools
rustup default ${RUSTC_VERSION}
# Emulate a nightly toolchain, because the toolchain installed above does not have "nightly"
diff --git a/Cargo.lock b/Cargo.lock
index 0606ad81ba..440ceb362d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1887,7 +1887,6 @@ dependencies = [
"object",
"paths",
"proc-macro-test",
- "ra-ap-rustc_lexer",
"span",
"temp-dir",
]
diff --git a/crates/proc-macro-api/Cargo.toml b/crates/proc-macro-api/Cargo.toml
index 5542c5da8f..8c85314843 100644
--- a/crates/proc-macro-api/Cargo.toml
+++ b/crates/proc-macro-api/Cargo.toml
@@ -39,7 +39,6 @@ span.workspace = true
[features]
sysroot-abi = ["proc-macro-srv", "proc-macro-srv/sysroot-abi"]
default = []
-in-rust-tree = []
[lints]
workspace = true
diff --git a/crates/proc-macro-api/src/lib.rs b/crates/proc-macro-api/src/lib.rs
index e83ddb8594..a3d6ac5dd6 100644
--- a/crates/proc-macro-api/src/lib.rs
+++ b/crates/proc-macro-api/src/lib.rs
@@ -8,12 +8,11 @@
#![cfg_attr(not(feature = "sysroot-abi"), allow(unused_crate_dependencies))]
#![cfg_attr(
feature = "sysroot-abi",
- feature(proc_macro_internals, proc_macro_diagnostic, proc_macro_span)
+ feature(proc_macro_internals, proc_macro_diagnostic, proc_macro_span, rustc_private)
)]
#![allow(internal_features, unused_features)]
-#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
-#[cfg(feature = "in-rust-tree")]
+#[cfg(feature = "sysroot-abi")]
extern crate rustc_driver as _;
pub mod bidirectional_protocol;
diff --git a/crates/proc-macro-srv-cli/Cargo.toml b/crates/proc-macro-srv-cli/Cargo.toml
index f586fe7644..4641f08783 100644
--- a/crates/proc-macro-srv-cli/Cargo.toml
+++ b/crates/proc-macro-srv-cli/Cargo.toml
@@ -33,7 +33,6 @@ proc-macro-test.path = "../proc-macro-srv/proc-macro-test"
default = []
# default = ["sysroot-abi"]
sysroot-abi = ["proc-macro-srv/sysroot-abi", "proc-macro-api/sysroot-abi"]
-in-rust-tree = ["proc-macro-srv/in-rust-tree", "sysroot-abi"]
[[bin]]
diff --git a/crates/proc-macro-srv-cli/src/lib.rs b/crates/proc-macro-srv-cli/src/lib.rs
index 3d0e2027b7..d540146c78 100644
--- a/crates/proc-macro-srv-cli/src/lib.rs
+++ b/crates/proc-macro-srv-cli/src/lib.rs
@@ -2,10 +2,9 @@
//!
//! This module exposes the server main loop and protocol format for integration testing.
-#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
+#![cfg(feature = "sysroot-abi")]
+#![feature(rustc_private)]
-#[cfg(feature = "in-rust-tree")]
extern crate rustc_driver as _;
-#[cfg(feature = "sysroot-abi")]
pub mod main_loop;
diff --git a/crates/proc-macro-srv-cli/src/main.rs b/crates/proc-macro-srv-cli/src/main.rs
index 928753659f..20b1c73ebf 100644
--- a/crates/proc-macro-srv-cli/src/main.rs
+++ b/crates/proc-macro-srv-cli/src/main.rs
@@ -1,10 +1,10 @@
//! A standalone binary for `proc-macro-srv`.
//! Driver for proc macro server
-#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
+#![cfg_attr(feature = "sysroot-abi", feature(rustc_private))]
#![cfg_attr(not(feature = "sysroot-abi"), allow(unused_crate_dependencies))]
#![allow(clippy::print_stdout, clippy::print_stderr)]
-#[cfg(feature = "in-rust-tree")]
+#[cfg(feature = "sysroot-abi")]
extern crate rustc_driver as _;
mod version;
diff --git a/crates/proc-macro-srv-cli/tests/bidirectional_postcard.rs b/crates/proc-macro-srv-cli/tests/bidirectional_postcard.rs
index 456b9fd70b..4c50f06f4a 100644
--- a/crates/proc-macro-srv-cli/tests/bidirectional_postcard.rs
+++ b/crates/proc-macro-srv-cli/tests/bidirectional_postcard.rs
@@ -1,7 +1,6 @@
#![cfg(feature = "sysroot-abi")]
-#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
+#![feature(rustc_private)]
-#[cfg(feature = "in-rust-tree")]
extern crate rustc_driver as _;
mod common {
diff --git a/crates/proc-macro-srv-cli/tests/legacy_json.rs b/crates/proc-macro-srv-cli/tests/legacy_json.rs
index 562cf0c251..b807fd46d4 100644
--- a/crates/proc-macro-srv-cli/tests/legacy_json.rs
+++ b/crates/proc-macro-srv-cli/tests/legacy_json.rs
@@ -4,9 +4,8 @@
//! channels without needing to spawn the actual server and client processes.
#![cfg(feature = "sysroot-abi")]
-#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
+#![feature(rustc_private)]
-#[cfg(feature = "in-rust-tree")]
extern crate rustc_driver as _;
mod common {
diff --git a/crates/proc-macro-srv/Cargo.toml b/crates/proc-macro-srv/Cargo.toml
index 8e5617f8a2..c3cd447c85 100644
--- a/crates/proc-macro-srv/Cargo.toml
+++ b/crates/proc-macro-srv/Cargo.toml
@@ -23,8 +23,6 @@ paths.workspace = true
span = { path = "../span", version = "0.0.0", default-features = false}
intern.workspace = true
-ra-ap-rustc_lexer.workspace = true
-
[target.'cfg(unix)'.dependencies]
libc.workspace = true
@@ -39,7 +37,6 @@ proc-macro-test.path = "./proc-macro-test"
[features]
default = []
sysroot-abi = []
-in-rust-tree = ["sysroot-abi"]
[lints]
workspace = true
diff --git a/crates/proc-macro-srv/src/lib.rs b/crates/proc-macro-srv/src/lib.rs
index a71323d89d..e989eb62dd 100644
--- a/crates/proc-macro-srv/src/lib.rs
+++ b/crates/proc-macro-srv/src/lib.rs
@@ -7,27 +7,16 @@
//!
//! * We use `tt` for proc-macro `TokenStream` server, it is easier to manipulate and interact with
//! RA than `proc-macro2` token stream.
-//! * By **copying** the whole rustc `lib_proc_macro` code, we are able to build this with `stable`
-//! rustc rather than `unstable`. (Although in general ABI compatibility is still an issue)…
#![cfg(feature = "sysroot-abi")]
-#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
-#![feature(proc_macro_internals, proc_macro_diagnostic, proc_macro_span)]
+#![feature(proc_macro_internals, proc_macro_diagnostic, proc_macro_span, rustc_private)]
#![expect(unreachable_pub, internal_features, clippy::disallowed_types, clippy::print_stderr)]
#![allow(unused_features, unused_crate_dependencies)]
#![deny(deprecated_safe, clippy::undocumented_unsafe_blocks)]
-#[cfg(not(feature = "in-rust-tree"))]
-extern crate proc_macro as rustc_proc_macro;
-#[cfg(feature = "in-rust-tree")]
extern crate rustc_driver as _;
-#[cfg(feature = "in-rust-tree")]
-extern crate rustc_proc_macro;
-
-#[cfg(not(feature = "in-rust-tree"))]
-extern crate ra_ap_rustc_lexer as rustc_lexer;
-#[cfg(feature = "in-rust-tree")]
extern crate rustc_lexer;
+extern crate rustc_proc_macro;
mod bridge;
mod dylib;
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index 27d9576e29..1745384843 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -108,7 +108,6 @@ in-rust-tree = [
"ide/in-rust-tree",
"load-cargo/in-rust-tree",
"parser/in-rust-tree",
- "proc-macro-api/in-rust-tree",
"syntax/in-rust-tree",
]
dhat = ["dep:dhat"]