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 @@ -133,7 +133,8 @@ fn mir_build(tcx: TyCtxt<'_>, def_id: DefId) -> BodyAndCache<'_> {
133133 let arguments = implicit_argument. into_iter ( ) . chain ( explicit_arguments) ;
134134
135135 let ( yield_ty, return_ty) = if body. generator_kind . is_some ( ) {
136- let gen_sig = match ty. kind {
136+ let gen_ty = tcx. body_tables ( body_id) . node_type ( id) ;
137+ let gen_sig = match gen_ty. kind {
137138 ty:: Generator ( gen_def_id, gen_substs, ..) => {
138139 gen_substs. as_generator ( ) . sig ( gen_def_id, tcx)
139140 }
Original file line number Diff line number Diff line change @@ -1426,12 +1426,12 @@ fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
14261426 Node :: Field ( field) => icx. to_ty ( & field. ty ) ,
14271427
14281428 Node :: Expr ( & hir:: Expr { kind : hir:: ExprKind :: Closure ( .., gen) , .. } ) => {
1429- if gen. is_some ( ) {
1430- return tcx. typeck_tables_of ( def_id) . node_type ( hir_id) ;
1431- }
1432-
14331429 let substs = InternalSubsts :: identity_for_item ( tcx, def_id) ;
1434- tcx. mk_closure ( def_id, substs)
1430+ if let Some ( movability) = gen {
1431+ tcx. mk_generator ( def_id, substs, movability)
1432+ } else {
1433+ tcx. mk_closure ( def_id, substs)
1434+ }
14351435 }
14361436
14371437 Node :: AnonConst ( _) => {
You can’t perform that action at this time.
0 commit comments