@@ -98,7 +98,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
9898 }
9999
100100 let expr_hir_id = self . lower_node_id ( e. id ) ;
101- self . lower_attrs ( expr_hir_id, & e. attrs , e. span ) ;
101+ let attrs = self . lower_attrs ( expr_hir_id, & e. attrs , e. span ) ;
102102
103103 let kind = match & e. kind {
104104 ExprKind :: Array ( exprs) => hir:: ExprKind :: Array ( self . lower_exprs ( exprs) ) ,
@@ -232,10 +232,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
232232 * fn_arg_span,
233233 ) ,
234234 None => self . lower_expr_closure (
235+ attrs,
235236 binder,
236237 * capture_clause,
237238 e. id ,
238- expr_hir_id,
239239 * constness,
240240 * movability,
241241 fn_decl,
@@ -1052,10 +1052,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
10521052
10531053 fn lower_expr_closure (
10541054 & mut self ,
1055+ attrs : & [ rustc_hir:: Attribute ] ,
10551056 binder : & ClosureBinder ,
10561057 capture_clause : CaptureBy ,
10571058 closure_id : NodeId ,
1058- closure_hir_id : hir:: HirId ,
10591059 constness : Const ,
10601060 movability : Movability ,
10611061 decl : & FnDecl ,
@@ -1067,15 +1067,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
10671067 let ( binder_clause, generic_params) = self . lower_closure_binder ( binder) ;
10681068
10691069 let ( body_id, closure_kind) = self . with_new_scopes ( fn_decl_span, move |this| {
1070- let mut coroutine_kind = if this
1071- . attrs
1072- . get ( & closure_hir_id. local_id )
1073- . is_some_and ( |attrs| attrs. iter ( ) . any ( |attr| attr. has_name ( sym:: coroutine) ) )
1074- {
1075- Some ( hir:: CoroutineKind :: Coroutine ( Movability :: Movable ) )
1076- } else {
1077- None
1078- } ;
1070+
1071+ let mut coroutine_kind = find_attr ! ( attrs, AttributeKind :: Coroutine ( _) => hir:: CoroutineKind :: Coroutine ( Movability :: Movable ) ) ;
1072+
10791073 // FIXME(contracts): Support contracts on closures?
10801074 let body_id = this. lower_fn_body ( decl, None , |this| {
10811075 this. coroutine_kind = coroutine_kind;
0 commit comments