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<'_> {
144
144
let arguments = implicit_argument. into_iter ( ) . chain ( explicit_arguments) ;
145
145
146
146
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 {
148
149
ty:: Generator ( gen_def_id, gen_substs, ..) => {
149
150
gen_substs. as_generator ( ) . sig ( gen_def_id, tcx)
150
151
}
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<'_> {
188
188
Node :: Field ( field) => icx. to_ty ( & field. ty ) ,
189
189
190
190
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
-
195
191
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
+ }
197
197
}
198
198
199
199
Node :: AnonConst ( _) => {
You can’t perform that action at this time.
0 commit comments