Generate the right MIR for by use closures
This commit is contained in:
parent
81a926cc2a
commit
57cb498989
10 changed files with 65 additions and 47 deletions
|
@ -170,7 +170,7 @@ pub(crate) fn coroutine_by_move_body_def_id<'tcx>(
|
|||
// this when building the field projection in the MIR body later on.
|
||||
let mut parent_capture_ty = parent_capture.place.ty();
|
||||
parent_capture_ty = match parent_capture.info.capture_kind {
|
||||
ty::UpvarCapture::ByValue => parent_capture_ty,
|
||||
ty::UpvarCapture::ByValue | ty::UpvarCapture::ByUse => parent_capture_ty,
|
||||
ty::UpvarCapture::ByRef(kind) => Ty::new_ref(
|
||||
tcx,
|
||||
tcx.lifetimes.re_erased,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue