@@ -69,16 +69,6 @@ impl_macro_generable! {
6969 "statement" , . make_stmts, lift . fold_stmt, |_span| SmallVector :: zero( ) ;
7070}
7171
72- // this function is called to detect use of feature-gated or invalid attributes
73- // on macro invoations since they will not be detected after macro expansion
74- fn check_attributes ( attrs : & [ ast:: Attribute ] , fld : & MacroExpander ) {
75- for attr in attrs. iter ( ) {
76- feature_gate:: check_attribute ( & attr, & fld. cx . parse_sess . span_diagnostic ,
77- & fld. cx . parse_sess . codemap ( ) ,
78- & fld. cx . ecfg . features . unwrap ( ) ) ;
79- }
80- }
81-
8272pub fn expand_expr ( e : P < ast:: Expr > , fld : & mut MacroExpander ) -> P < ast:: Expr > {
8373 let expr_span = e. span ;
8474 return e. and_then ( |ast:: Expr { id, node, span, attrs} | match node {
@@ -209,7 +199,13 @@ fn expand_mac_invoc<T>(mac: ast::Mac, ident: Option<Ident>, attrs: Vec<ast::Attr
209199 fn mac_result < ' a > ( path : & ast:: Path , ident : Option < Ident > , tts : Vec < TokenTree > , mark : Mrk ,
210200 attrs : Vec < ast:: Attribute > , call_site : Span , fld : & ' a mut MacroExpander )
211201 -> Option < Box < MacResult + ' a > > {
212- check_attributes ( & attrs, fld) ;
202+ // Detect use of feature-gated or invalid attributes on macro invoations
203+ // since they will not be detected after macro expansion.
204+ for attr in attrs. iter ( ) {
205+ feature_gate:: check_attribute ( & attr, & fld. cx . parse_sess . span_diagnostic ,
206+ & fld. cx . parse_sess . codemap ( ) ,
207+ & fld. cx . ecfg . features . unwrap ( ) ) ;
208+ }
213209
214210 if path. segments . len ( ) > 1 {
215211 fld. cx . span_err ( path. span , "expected macro name without module separators" ) ;
0 commit comments