1
Fork 0

Fix FnMut/Fn shim for coroutine-closures that capture references

This commit is contained in:
Michael Goulet 2024-06-29 17:25:44 -04:00
parent 294436d273
commit 90143b0be8
18 changed files with 214 additions and 51 deletions

View file

@ -127,9 +127,9 @@ fn fn_sig_for_fn_abi<'tcx>(
coroutine_kind = ty::ClosureKind::FnOnce;
// Implementations of `FnMut` and `Fn` for coroutine-closures
// still take their receiver by (mut) ref.
// still take their receiver by ref.
if receiver_by_ref {
Ty::new_mut_ref(tcx, tcx.lifetimes.re_erased, coroutine_ty)
Ty::new_imm_ref(tcx, tcx.lifetimes.re_erased, coroutine_ty)
} else {
coroutine_ty
}