@@ -682,59 +682,32 @@ impl<'hir> LoweringContext<'_, 'hir> {
682
682
& mut self ,
683
683
capture_clause : CaptureBy ,
684
684
closure_node_id : NodeId ,
685
- yield_ty : Option < hir:: FnRetTy < ' hir > > ,
685
+ _yield_ty : Option < hir:: FnRetTy < ' hir > > ,
686
686
span : Span ,
687
687
// We re-use the async enum, because we have the same cases.
688
688
// FIXME(oli-obk): rename the enum.
689
689
gen_kind : hir:: AsyncGeneratorKind ,
690
690
body : impl FnOnce ( & mut Self ) -> hir:: Expr < ' hir > ,
691
691
) -> hir:: ExprKind < ' hir > {
692
- let output = yield_ty. unwrap_or_else ( || hir:: FnRetTy :: DefaultReturn ( self . lower_span ( span) ) ) ;
693
-
694
- // Resume argument type: `ResumeTy`
695
- let unstable_span =
696
- self . mark_span_with_reason ( DesugaringKind :: Async , span, self . allow_gen_future . clone ( ) ) ;
697
- let resume_ty = hir:: QPath :: LangItem ( hir:: LangItem :: ResumeTy , unstable_span, None ) ;
698
- let input_ty = hir:: Ty {
699
- hir_id : self . next_id ( ) ,
700
- kind : hir:: TyKind :: Path ( resume_ty) ,
701
- span : unstable_span,
702
- } ;
692
+ let output = hir:: FnRetTy :: DefaultReturn ( self . lower_span ( span) ) ;
703
693
704
694
// The closure/generator `FnDecl` takes a single (resume) argument of type `input_ty`.
705
695
let fn_decl = self . arena . alloc ( hir:: FnDecl {
706
- inputs : arena_vec ! [ self ; input_ty ] ,
696
+ inputs : & [ ] ,
707
697
output,
708
698
c_variadic : false ,
709
699
implicit_self : hir:: ImplicitSelfKind :: None ,
710
700
lifetime_elision_allowed : false ,
711
701
} ) ;
712
702
713
- // Lower the argument pattern/ident. The ident is used again in the `.await` lowering.
714
- let ( pat, task_context_hid) = self . pat_ident_binding_mode (
715
- span,
716
- Ident :: with_dummy_span ( sym:: _task_context) ,
717
- hir:: BindingAnnotation :: MUT ,
718
- ) ;
719
- let param = hir:: Param {
720
- hir_id : self . next_id ( ) ,
721
- pat,
722
- ty_span : self . lower_span ( span) ,
723
- span : self . lower_span ( span) ,
724
- } ;
725
- let params = arena_vec ! [ self ; param] ;
726
-
727
703
let body = self . lower_body ( move |this| {
728
704
this. generator_kind = Some ( hir:: GeneratorKind :: Iter ( gen_kind) ) ;
729
705
730
- let old_ctx = this. task_context ;
731
- this. task_context = Some ( task_context_hid) ;
732
706
let res = body ( this) ;
733
- this. task_context = old_ctx;
734
- ( params, res)
707
+ ( & [ ] , res)
735
708
} ) ;
736
709
737
- // `static |_task_context | -> <ret_ty> { body }`:
710
+ // `static |() | -> () { body }`:
738
711
hir:: ExprKind :: Closure ( self . arena . alloc ( hir:: Closure {
739
712
def_id : self . local_def_id ( closure_node_id) ,
740
713
binder : hir:: ClosureBinder :: Default ,
0 commit comments