Allow IdentMacroExpander::expand to access the ident macro invocation's attributes.

This commit is contained in:
Jeffrey Seyfried
2016-09-13 05:21:54 +00:00
parent 21ba8160f2
commit 0ddb66c4c7
2 changed files with 5 additions and 3 deletions

View File

@@ -177,7 +177,8 @@ pub trait IdentMacroExpander {
cx: &'cx mut ExtCtxt, cx: &'cx mut ExtCtxt,
sp: Span, sp: Span,
ident: ast::Ident, ident: ast::Ident,
token_tree: Vec<tokenstream::TokenTree> ) token_tree: Vec<tokenstream::TokenTree>,
attrs: Vec<ast::Attribute>)
-> Box<MacResult+'cx>; -> Box<MacResult+'cx>;
} }
@@ -193,7 +194,8 @@ impl<F> IdentMacroExpander for F
cx: &'cx mut ExtCtxt, cx: &'cx mut ExtCtxt,
sp: Span, sp: Span,
ident: ast::Ident, ident: ast::Ident,
token_tree: Vec<tokenstream::TokenTree> ) token_tree: Vec<tokenstream::TokenTree>,
_attrs: Vec<ast::Attribute>)
-> Box<MacResult+'cx> -> Box<MacResult+'cx>
{ {
(*self)(cx, sp, ident, token_tree) (*self)(cx, sp, ident, token_tree)

View File

@@ -374,7 +374,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
} }
}); });
kind.make_from(expander.expand(self.cx, span, ident, marked_tts)) kind.make_from(expander.expand(self.cx, span, ident, marked_tts, attrs))
} }
MacroRulesTT => { MacroRulesTT => {