Skip to content

Commit 7498ec7

Browse files
committed
Drop support for non-syroot proc macro ABIs
1 parent 8ea1afc commit 7498ec7

File tree

28 files changed

+140
-4617
lines changed

28 files changed

+140
-4617
lines changed

Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/proc-macro-srv-cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ rust-version.workspace = true
1010

1111
[dependencies]
1212
proc-macro-srv.workspace = true
13+
proc-macro-api.workspace = true
1314

1415
[features]
1516
sysroot-abi = ["proc-macro-srv/sysroot-abi"]

crates/proc-macro-srv/src/cli.rs renamed to crates/proc-macro-srv-cli/src/lib.rs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ use std::io;
33

44
use proc_macro_api::msg::{self, Message};
55

6-
use crate::ProcMacroSrv;
7-
6+
#[cfg(feature = "sysroot-abi")]
87
pub fn run() -> io::Result<()> {
9-
let mut srv = ProcMacroSrv::default();
8+
let mut srv = proc_macro_srv::ProcMacroSrv::default();
109
let mut buf = String::new();
1110

1211
while let Some(req) = read_request(&mut buf)? {
@@ -24,6 +23,27 @@ pub fn run() -> io::Result<()> {
2423

2524
Ok(())
2625
}
26+
#[cfg(not(feature = "sysroot-abi"))]
27+
pub fn run() -> io::Result<()> {
28+
let mut buf = String::new();
29+
30+
while let Some(req) = read_request(&mut buf)? {
31+
let res = match req {
32+
msg::Request::ListMacros { .. } => {
33+
msg::Response::ListMacros(Err("server is built without sysroot support".to_owned()))
34+
}
35+
msg::Request::ExpandMacro(..) => msg::Response::ExpandMacro(Err(msg::PanicMessage(
36+
"server is built without sysroot support".to_owned(),
37+
))),
38+
msg::Request::ApiVersionCheck {} => {
39+
msg::Response::ApiVersionCheck(proc_macro_api::msg::CURRENT_API_VERSION)
40+
}
41+
};
42+
write_response(res)?
43+
}
44+
45+
Ok(())
46+
}
2747

2848
fn read_request(buf: &mut String) -> io::Result<Option<msg::Request>> {
2949
msg::Request::read(&mut io::stdin().lock(), buf)

crates/proc-macro-srv-cli/src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! A standalone binary for `proc-macro-srv`.
2-
3-
use proc_macro_srv::cli;
2+
//! Driver for proc macro server
43
54
fn main() -> std::io::Result<()> {
65
let v = std::env::var("RUST_ANALYZER_INTERNALS_DO_NOT_USE");
@@ -15,5 +14,5 @@ fn main() -> std::io::Result<()> {
1514
}
1615
}
1716

18-
cli::run()
17+
proc_macro_srv_cli::run()
1918
}

crates/proc-macro-srv/src/abis/abi_1_63/mod.rs

Lines changed: 0 additions & 106 deletions
This file was deleted.

crates/proc-macro-srv/src/abis/abi_1_63/proc_macro/bridge/buffer.rs

Lines changed: 0 additions & 156 deletions
This file was deleted.

0 commit comments

Comments
 (0)