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 @@ -143,7 +143,8 @@ fn mir_build(tcx: TyCtxt<'_>, def_id: DefId) -> BodyAndCache<'_> {
143143 let arguments = implicit_argument. into_iter ( ) . chain ( explicit_arguments) ;
144144
145145 let ( yield_ty, return_ty) = if body. generator_kind . is_some ( ) {
146- let gen_sig = match ty. kind {
146+ let gen_ty = tcx. body_tables ( body_id) . node_type ( id) ;
147+ let gen_sig = match gen_ty. kind {
147148 ty:: Generator ( gen_def_id, gen_substs, ..) => {
148149 gen_substs. as_generator ( ) . sig ( gen_def_id, tcx)
149150 }
Original file line number Diff line number Diff line change @@ -1428,12 +1428,12 @@ fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
14281428 Node :: Field ( field) => icx. to_ty ( & field. ty ) ,
14291429
14301430 Node :: Expr ( & hir:: Expr { kind : hir:: ExprKind :: Closure ( .., gen) , .. } ) => {
1431- if gen. is_some ( ) {
1432- return tcx. typeck_tables_of ( def_id) . node_type ( hir_id) ;
1433- }
1434-
14351431 let substs = InternalSubsts :: identity_for_item ( tcx, def_id) ;
1436- tcx. mk_closure ( def_id, substs)
1432+ if let Some ( movability) = gen {
1433+ tcx. mk_generator ( def_id, substs, movability)
1434+ } else {
1435+ tcx. mk_closure ( def_id, substs)
1436+ }
14371437 }
14381438
14391439 Node :: AnonConst ( _) => {
You can’t perform that action at this time.
0 commit comments