1
Fork 0

Generate the right MIR for by use closures

This commit is contained in:
Santiago Pastorino 2024-12-17 12:27:02 -03:00
parent 81a926cc2a
commit 57cb498989
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
10 changed files with 65 additions and 47 deletions

View file

@ -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,