rustc_expand: Remove redundant field from proc macro expander structures
This information is already available from `ExpnData`
This commit is contained in:
parent
28f4dba438
commit
de897f5205
5 changed files with 18 additions and 33 deletions
|
@ -9,14 +9,12 @@ use rustc_data_structures::sync::Lrc;
|
|||
use rustc_errors::ErrorReported;
|
||||
use rustc_parse::nt_to_tokenstream;
|
||||
use rustc_parse::parser::ForceCollect;
|
||||
use rustc_span::def_id::CrateNum;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
const EXEC_STRATEGY: pm::bridge::server::SameThread = pm::bridge::server::SameThread;
|
||||
|
||||
pub struct BangProcMacro {
|
||||
pub client: pm::bridge::client::Client<fn(pm::TokenStream) -> pm::TokenStream>,
|
||||
pub krate: CrateNum,
|
||||
}
|
||||
|
||||
impl base::ProcMacro for BangProcMacro {
|
||||
|
@ -26,7 +24,7 @@ impl base::ProcMacro for BangProcMacro {
|
|||
span: Span,
|
||||
input: TokenStream,
|
||||
) -> Result<TokenStream, ErrorReported> {
|
||||
let server = proc_macro_server::Rustc::new(ecx, self.krate);
|
||||
let server = proc_macro_server::Rustc::new(ecx);
|
||||
self.client.run(&EXEC_STRATEGY, server, input, ecx.ecfg.proc_macro_backtrace).map_err(|e| {
|
||||
let mut err = ecx.struct_span_err(span, "proc macro panicked");
|
||||
if let Some(s) = e.as_str() {
|
||||
|
@ -40,7 +38,6 @@ impl base::ProcMacro for BangProcMacro {
|
|||
|
||||
pub struct AttrProcMacro {
|
||||
pub client: pm::bridge::client::Client<fn(pm::TokenStream, pm::TokenStream) -> pm::TokenStream>,
|
||||
pub krate: CrateNum,
|
||||
}
|
||||
|
||||
impl base::AttrProcMacro for AttrProcMacro {
|
||||
|
@ -51,7 +48,7 @@ impl base::AttrProcMacro for AttrProcMacro {
|
|||
annotation: TokenStream,
|
||||
annotated: TokenStream,
|
||||
) -> Result<TokenStream, ErrorReported> {
|
||||
let server = proc_macro_server::Rustc::new(ecx, self.krate);
|
||||
let server = proc_macro_server::Rustc::new(ecx);
|
||||
self.client
|
||||
.run(&EXEC_STRATEGY, server, annotation, annotated, ecx.ecfg.proc_macro_backtrace)
|
||||
.map_err(|e| {
|
||||
|
@ -67,7 +64,6 @@ impl base::AttrProcMacro for AttrProcMacro {
|
|||
|
||||
pub struct ProcMacroDerive {
|
||||
pub client: pm::bridge::client::Client<fn(pm::TokenStream) -> pm::TokenStream>,
|
||||
pub krate: CrateNum,
|
||||
}
|
||||
|
||||
impl MultiItemModifier for ProcMacroDerive {
|
||||
|
@ -101,7 +97,7 @@ impl MultiItemModifier for ProcMacroDerive {
|
|||
nt_to_tokenstream(&item, &ecx.sess.parse_sess, CanSynthesizeMissingTokens::No)
|
||||
};
|
||||
|
||||
let server = proc_macro_server::Rustc::new(ecx, self.krate);
|
||||
let server = proc_macro_server::Rustc::new(ecx);
|
||||
let stream =
|
||||
match self.client.run(&EXEC_STRATEGY, server, input, ecx.ecfg.proc_macro_backtrace) {
|
||||
Ok(stream) => stream,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue