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 @@ -143,7 +143,8 @@ fn mir_build(tcx: TyCtxt<'_>, def_id: DefId) -> BodyAndCache<'_> {
143
143
let arguments = implicit_argument. into_iter ( ) . chain ( explicit_arguments) ;
144
144
145
145
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 {
147
148
ty:: Generator ( gen_def_id, gen_substs, ..) => {
148
149
gen_substs. as_generator ( ) . sig ( gen_def_id, tcx)
149
150
}
Original file line number Diff line number Diff line change @@ -1428,12 +1428,12 @@ fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
1428
1428
Node :: Field ( field) => icx. to_ty ( & field. ty ) ,
1429
1429
1430
1430
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
-
1435
1431
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
+ }
1437
1437
}
1438
1438
1439
1439
Node :: AnonConst ( _) => {
You can’t perform that action at this time.
0 commit comments