Introduce proc_macro_srv::abis, impl 1.47 and 1.55

Rather than a "Stable" and "Nightly" ABI we instead name ABIs based on
the version of the rust compiler in which they were introduced. We place
these ABIs in a new module - `proc_macro_srv::abis` - where we also add
some mchinery to abstract over ABIs. This should make it easy to add new
ABIs at a later date as the rust compiler evolves.
This commit is contained in:
Alex Good 2021-07-12 15:47:47 +01:00
parent 14a51d28b5
commit e240eb67a8
28 changed files with 390 additions and 327 deletions

View file

@ -11,23 +11,10 @@
//! rustc rather than `unstable`. (Although in general ABI compatibility is still an issue)…
#![allow(unreachable_pub)]
#[allow(dead_code)]
#[doc(hidden)]
mod proc_macro;
#[allow(dead_code)]
#[doc(hidden)]
mod proc_macro_nightly;
#[doc(hidden)]
mod rustc_server;
#[doc(hidden)]
mod rustc_server_nightly;
mod dylib;
use proc_macro::bridge::client::TokenStream;
mod abis;
use proc_macro_api::{ExpansionResult, ExpansionTask, ListMacrosResult, ListMacrosTask};
use std::{
collections::{hash_map::Entry, HashMap},
@ -62,10 +49,7 @@ impl ProcMacroSrv {
match result {
Ok(expansion) => Ok(ExpansionResult { expansion }),
Err(msg) => {
let msg = msg.as_str().unwrap_or("<unknown error>");
Err(format!("proc-macro panicked: {}", msg))
}
Err(msg) => Err(format!("proc-macro panicked: {}", msg)),
}
}