@@ -69,16 +69,6 @@ impl_macro_generable! {
69
69
"statement" , . make_stmts, lift . fold_stmt, |_span| SmallVector :: zero( ) ;
70
70
}
71
71
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
-
82
72
pub fn expand_expr ( e : P < ast:: Expr > , fld : & mut MacroExpander ) -> P < ast:: Expr > {
83
73
let expr_span = e. span ;
84
74
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
209
199
fn mac_result < ' a > ( path : & ast:: Path , ident : Option < Ident > , tts : Vec < TokenTree > , mark : Mrk ,
210
200
attrs : Vec < ast:: Attribute > , call_site : Span , fld : & ' a mut MacroExpander )
211
201
-> 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
+ }
213
209
214
210
if path. segments . len ( ) > 1 {
215
211
fld. cx . span_err ( path. span , "expected macro name without module separators" ) ;
0 commit comments