File tree 2 files changed +7
-6
lines changed
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<'_> {
133
133
let arguments = implicit_argument. into_iter ( ) . chain ( explicit_arguments) ;
134
134
135
135
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 {
137
138
ty:: Generator ( gen_def_id, gen_substs, ..) => {
138
139
gen_substs. as_generator ( ) . sig ( gen_def_id, tcx)
139
140
}
Original file line number Diff line number Diff line change @@ -1426,12 +1426,12 @@ fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
1426
1426
Node :: Field ( field) => icx. to_ty ( & field. ty ) ,
1427
1427
1428
1428
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
-
1433
1429
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
+ }
1435
1435
}
1436
1436
1437
1437
Node :: AnonConst ( _) => {
You can’t perform that action at this time.
0 commit comments