@@ -916,10 +916,10 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast,
916916 & sig. decl . output ,
917917 ) ;
918918
919- if let Some ( ( async_node_id , _) ) =
919+ if let Some ( ( coro_node_id , _) ) =
920920 sig. header . coro_kind . map ( |coro_kind| coro_kind. return_id ( ) )
921921 {
922- this. record_lifetime_params_for_impl_trait ( async_node_id ) ;
922+ this. record_lifetime_params_for_impl_trait ( coro_node_id ) ;
923923 }
924924 } ,
925925 ) ;
@@ -942,13 +942,13 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast,
942942 this. visit_generics ( generics) ;
943943
944944 let declaration = & sig. decl ;
945- let async_node_id =
945+ let coro_node_id =
946946 sig. header . coro_kind . map ( |coro_kind| coro_kind. return_id ( ) ) ;
947947
948948 this. with_lifetime_rib (
949949 LifetimeRibKind :: AnonymousCreateParameter {
950950 binder : fn_id,
951- report_in_path : async_node_id . is_some ( ) ,
951+ report_in_path : coro_node_id . is_some ( ) ,
952952 } ,
953953 |this| {
954954 this. resolve_fn_signature (
@@ -961,7 +961,7 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast,
961961 & declaration. output ,
962962 ) ;
963963
964- if let Some ( ( async_node_id, _) ) = async_node_id {
964+ if let Some ( ( async_node_id, _) ) = coro_node_id {
965965 this. record_lifetime_params_for_impl_trait ( async_node_id) ;
966966 }
967967 } ,
@@ -4291,8 +4291,10 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
42914291 // `async |x| ...` gets desugared to `|x| async {...}`, so we need to
42924292 // resolve the arguments within the proper scopes so that usages of them inside the
42934293 // closure are detected as upvars rather than normal closure arg usages.
4294+ //
4295+ // Similarly, `gen |x| ...` gets desugared to `|x| gen {...}`, so we handle that too.
42944296 ExprKind :: Closure ( box ast:: Closure {
4295- coro_kind : Some ( CoroutineKind :: Async { .. } ) ,
4297+ coro_kind : Some ( _ ) ,
42964298 ref fn_decl,
42974299 ref body,
42984300 ..
0 commit comments