@@ -30,7 +30,6 @@ use crate::tokenstream::TokenTree;
3030
3131use  errors:: { Applicability ,  DiagnosticBuilder ,  Handler } ; 
3232use  rustc_data_structures:: fx:: FxHashMap ; 
33- use  rustc_data_structures:: sync:: Lock ; 
3433use  rustc_target:: spec:: abi:: Abi ; 
3534use  syntax_pos:: { Span ,  DUMMY_SP ,  MultiSpan } ; 
3635use  log:: debug; 
@@ -2088,11 +2087,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
20882087                                       "type ascription is experimental" ) ; 
20892088                } 
20902089            } 
2091-             ast:: ExprKind :: Yield ( ..)  => { 
2092-                 gate_feature_post ! ( & self ,  generators, 
2093-                                   e. span, 
2094-                                   "yield syntax is experimental" ) ; 
2095-             } 
20962090            ast:: ExprKind :: TryBlock ( _)  => { 
20972091                gate_feature_post ! ( & self ,  try_blocks,  e. span,  "`try` expression is experimental" ) ; 
20982092            } 
@@ -2427,10 +2421,6 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
24272421    features
24282422} 
24292423
2430- fn  for_each_in_lock < T > ( vec :  & Lock < Vec < T > > ,  f :  impl  Fn ( & T ) )  { 
2431-     vec. borrow ( ) . iter ( ) . for_each ( f) ; 
2432- } 
2433- 
24342424pub  fn  check_crate ( krate :  & ast:: Crate , 
24352425                   sess :  & ParseSess , 
24362426                   features :  & Features , 
@@ -2443,26 +2433,16 @@ pub fn check_crate(krate: &ast::Crate,
24432433        plugin_attributes, 
24442434    } ; 
24452435
2446-     for_each_in_lock ( & sess. param_attr_spans ,  |span| gate_feature ! ( 
2447-         & ctx, 
2448-         param_attrs, 
2449-         * span, 
2450-         "attributes on function parameters are unstable" 
2451-     ) ) ; 
2452- 
2453-     for_each_in_lock ( & sess. let_chains_spans ,  |span| gate_feature ! ( 
2454-         & ctx, 
2455-         let_chains, 
2456-         * span, 
2457-         "`let` expressions in this position are experimental" 
2458-     ) ) ; 
2459- 
2460-     for_each_in_lock ( & sess. async_closure_spans ,  |span| gate_feature ! ( 
2461-         & ctx, 
2462-         async_closure, 
2463-         * span, 
2464-         "async closures are unstable" 
2465-     ) ) ; 
2436+     macro_rules!  gate_all { 
2437+         ( $spans: ident,  $gate: ident,  $msg: literal)  => { 
2438+             for  span in & * sess. $spans. borrow( )  {  gate_feature!( & ctx,  $gate,  * span,  $msg) ;  } 
2439+         } 
2440+     } 
2441+ 
2442+     gate_all ! ( param_attr_spans,  param_attrs,  "attributes on function parameters are unstable" ) ; 
2443+     gate_all ! ( let_chains_spans,  let_chains,  "`let` expressions in this position are experimental" ) ; 
2444+     gate_all ! ( async_closure_spans,  async_closure,  "async closures are unstable" ) ; 
2445+     gate_all ! ( yield_spans,  generators,  "yield syntax is experimental" ) ; 
24662446
24672447    let  visitor = & mut  PostExpansionVisitor  { 
24682448        context :  & ctx, 
0 commit comments