Skip to content

Commit 0ddb66c

Browse files
committed
Allow IdentMacroExpander::expand to access the ident macro invocation's attributes.
1 parent 21ba816 commit 0ddb66c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/libsyntax/ext/base.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ pub trait IdentMacroExpander {
177177
cx: &'cx mut ExtCtxt,
178178
sp: Span,
179179
ident: ast::Ident,
180-
token_tree: Vec<tokenstream::TokenTree> )
180+
token_tree: Vec<tokenstream::TokenTree>,
181+
attrs: Vec<ast::Attribute>)
181182
-> Box<MacResult+'cx>;
182183
}
183184

@@ -193,7 +194,8 @@ impl<F> IdentMacroExpander for F
193194
cx: &'cx mut ExtCtxt,
194195
sp: Span,
195196
ident: ast::Ident,
196-
token_tree: Vec<tokenstream::TokenTree> )
197+
token_tree: Vec<tokenstream::TokenTree>,
198+
_attrs: Vec<ast::Attribute>)
197199
-> Box<MacResult+'cx>
198200
{
199201
(*self)(cx, sp, ident, token_tree)

src/libsyntax/ext/expand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
374374
}
375375
});
376376

377-
kind.make_from(expander.expand(self.cx, span, ident, marked_tts))
377+
kind.make_from(expander.expand(self.cx, span, ident, marked_tts, attrs))
378378
}
379379

380380
MacroRulesTT => {

0 commit comments

Comments
 (0)