@@ -2035,28 +2035,22 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
20352035 fn_decl : & ' a ast:: FnDecl ,
20362036 span : Span ,
20372037 _node_id : NodeId ) {
2038- match fn_kind {
2039- FnKind :: ItemFn ( _, header, _, _) => {
2040- // Check for const fn and async fn declarations.
2041- if header. asyncness . node . is_async ( ) {
2042- gate_feature_post ! ( & self , async_await, span, "async fn is unstable" ) ;
2043- }
2038+ if let Some ( header) = fn_kind. header ( ) {
2039+ // Check for const fn and async fn declarations.
2040+ if header. asyncness . node . is_async ( ) {
2041+ gate_feature_post ! ( & self , async_await, span, "async fn is unstable" ) ;
2042+ }
20442043
2045- if fn_decl. c_variadic {
2046- gate_feature_post ! ( & self , c_variadic, span,
2047- "C-varaidic functions are unstable" ) ;
2048- }
2049- // Stability of const fn methods are covered in
2050- // `visit_trait_item` and `visit_impl_item` below; this is
2051- // because default methods don't pass through this point.
2044+ // Stability of const fn methods are covered in
2045+ // `visit_trait_item` and `visit_impl_item` below; this is
2046+ // because default methods don't pass through this point.
2047+ self . check_abi ( header. abi , span) ;
2048+ }
20522049
2053- self . check_abi ( header. abi , span) ;
2054- }
2055- FnKind :: Method ( _, sig, _, _) => {
2056- self . check_abi ( sig. header . abi , span) ;
2057- }
2058- _ => { }
2050+ if fn_decl. c_variadic {
2051+ gate_feature_post ! ( & self , c_variadic, span, "C-variadic functions are unstable" ) ;
20592052 }
2053+
20602054 visit:: walk_fn ( self , fn_kind, fn_decl, span) ;
20612055 }
20622056
@@ -2074,9 +2068,12 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
20742068 if block. is_none ( ) {
20752069 self . check_abi ( sig. header . abi , ti. span ) ;
20762070 }
2071+ if sig. header . asyncness . node . is_async ( ) {
2072+ gate_feature_post ! ( & self , async_await, ti. span, "async fn is unstable" ) ;
2073+ }
20772074 if sig. decl . c_variadic {
20782075 gate_feature_post ! ( & self , c_variadic, ti. span,
2079- "C-varaidic functions are unstable" ) ;
2076+ "C-variadic functions are unstable" ) ;
20802077 }
20812078 if sig. header . constness . node == ast:: Constness :: Const {
20822079 gate_feature_post ! ( & self , const_fn, ti. span, "const fn is unstable" ) ;
0 commit comments