File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,8 @@ fn mir_build(tcx: TyCtxt<'_>, def_id: DefId) -> BodyAndCache<'_> {
144144 let arguments = implicit_argument. into_iter ( ) . chain ( explicit_arguments) ;
145145
146146 let ( yield_ty, return_ty) = if body. generator_kind . is_some ( ) {
147- let gen_sig = match ty. kind {
147+ let gen_ty = tcx. body_tables ( body_id) . node_type ( id) ;
148+ let gen_sig = match gen_ty. kind {
148149 ty:: Generator ( gen_def_id, gen_substs, ..) => {
149150 gen_substs. as_generator ( ) . sig ( gen_def_id, tcx)
150151 }
Original file line number Diff line number Diff line change @@ -188,12 +188,12 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
188188 Node :: Field ( field) => icx. to_ty ( & field. ty ) ,
189189
190190 Node :: Expr ( & Expr { kind : ExprKind :: Closure ( .., gen) , .. } ) => {
191- if gen. is_some ( ) {
192- return tcx. typeck_tables_of ( def_id) . node_type ( hir_id) ;
193- }
194-
195191 let substs = InternalSubsts :: identity_for_item ( tcx, def_id) ;
196- tcx. mk_closure ( def_id, substs)
192+ if let Some ( movability) = gen {
193+ tcx. mk_generator ( def_id, substs, movability)
194+ } else {
195+ tcx. mk_closure ( def_id, substs)
196+ }
197197 }
198198
199199 Node :: AnonConst ( _) => {
You can’t perform that action at this time.
0 commit comments