Skip to content

Proc macro tweaks #97004

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

Merged
merged 12 commits into from
May 27, 2022
Prev Previous commit
Next Next commit
Rename ProcMacro trait as BangProcMacro.
Similar to the existing `AttrProcMacro` trait.
  • Loading branch information
nnethercote committed May 27, 2022
commit dbdc7dd0dcb7e7525fec145787d715d31d651a4b
6 changes: 3 additions & 3 deletions compiler/rustc_expand/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ where
}
}

pub trait ProcMacro {
pub trait BangProcMacro {
fn expand<'cx>(
&self,
ecx: &'cx mut ExtCtxt<'_>,
Expand All @@ -275,7 +275,7 @@ pub trait ProcMacro {
) -> Result<TokenStream, ErrorGuaranteed>;
}

impl<F> ProcMacro for F
impl<F> BangProcMacro for F
where
F: Fn(TokenStream) -> TokenStream,
{
Expand Down Expand Up @@ -640,7 +640,7 @@ pub enum SyntaxExtensionKind {
/// A token-based function-like macro.
Bang(
/// An expander with signature TokenStream -> TokenStream.
Box<dyn ProcMacro + sync::Sync + sync::Send>,
Box<dyn BangProcMacro + sync::Sync + sync::Send>,
),

/// An AST-based function-like macro.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/proc_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct BangProcMacro {
pub client: pm::bridge::client::Client<fn(pm::TokenStream) -> pm::TokenStream>,
}

impl base::ProcMacro for BangProcMacro {
impl base::BangProcMacro for BangProcMacro {
fn expand<'cx>(
&self,
ecx: &'cx mut ExtCtxt<'_>,
Expand Down