Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Drop support for non-syroot proc macro ABIs #14432

Merged
merged 10 commits into from
Apr 6, 2023
9 changes: 6 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
runs-on: ${{ matrix.os }}
env:
CC: deny_c
# we want to build r-a on stable to check that it keeps building on stable,
# but we also want to test our proc-macro-srv which depends on nightly features
RUSTC_BOOTSTRAP: 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can set RUSTC_BOOTSTRAP to a set of crates like RUSTC_BOOTSTRAP=proc-macro-srv?


strategy:
fail-fast: false
Expand All @@ -50,15 +53,15 @@ jobs:
run: sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml

- name: Compile (tests)
run: cargo test --no-run --locked
run: cargo test --no-run --locked --features sysroot-abi

# It's faster to `test` before `build` ¯\_(ツ)_/¯
- name: Compile (rust-analyzer)
if: matrix.os == 'ubuntu-latest'
run: cargo build --quiet
run: cargo build --quiet --features sysroot-abi

- name: Test
run: cargo test -- --nocapture --quiet
run: cargo test --features sysroot-abi -- --nocapture --quiet

- name: Run analysis-stats on rust-analyzer
if: matrix.os == 'ubuntu-latest'
Expand Down
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/proc-macro-srv-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ rust-version.workspace = true

[dependencies]
proc-macro-srv.workspace = true
proc-macro-api.workspace = true

[features]
sysroot-abi = ["proc-macro-srv/sysroot-abi"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ use std::io;

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

use crate::ProcMacroSrv;

#[cfg(feature = "sysroot-abi")]
pub fn run() -> io::Result<()> {
let mut srv = ProcMacroSrv::default();
let mut srv = proc_macro_srv::ProcMacroSrv::default();
let mut buf = String::new();

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

Ok(())
}
#[cfg(not(feature = "sysroot-abi"))]
pub fn run() -> io::Result<()> {
let mut buf = String::new();

while let Some(req) = read_request(&mut buf)? {
let res = match req {
msg::Request::ListMacros { .. } => {
msg::Response::ListMacros(Err("server is built without sysroot support".to_owned()))
}
msg::Request::ExpandMacro(..) => msg::Response::ExpandMacro(Err(msg::PanicMessage(
"server is built without sysroot support".to_owned(),
))),
msg::Request::ApiVersionCheck {} => {
msg::Response::ApiVersionCheck(proc_macro_api::msg::CURRENT_API_VERSION)
}
};
write_response(res)?
}

Ok(())
}

fn read_request(buf: &mut String) -> io::Result<Option<msg::Request>> {
msg::Request::read(&mut io::stdin().lock(), buf)
Expand Down
5 changes: 2 additions & 3 deletions crates/proc-macro-srv-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! A standalone binary for `proc-macro-srv`.

use proc_macro_srv::cli;
//! Driver for proc macro server

fn main() -> std::io::Result<()> {
let v = std::env::var("RUST_ANALYZER_INTERNALS_DO_NOT_USE");
Expand All @@ -15,5 +14,5 @@ fn main() -> std::io::Result<()> {
}
}

cli::run()
proc_macro_srv_cli::run()
}
106 changes: 0 additions & 106 deletions crates/proc-macro-srv/src/abis/abi_1_63/mod.rs

This file was deleted.

156 changes: 0 additions & 156 deletions crates/proc-macro-srv/src/abis/abi_1_63/proc_macro/bridge/buffer.rs

This file was deleted.

Loading