[move-only] Suppress moveonly errors when an inout is captured by an escaping closure since we will already emit a more specific capture error.

This commit is contained in:
Michael Gottesman
2023-02-20 13:54:23 -08:00
parent 33c7dddd28
commit 799dba1184
8 changed files with 171 additions and 135 deletions

View File

@@ -410,6 +410,11 @@ void SILGenFunction::emitCaptures(SILLocation loc,
} else {
// If we have a mutable binding for a 'let', such as 'self' in an
// 'init' method, load it.
if (Val->getType().isMoveOnly()) {
Val = B.createMarkMustCheckInst(
loc, Val,
MarkMustCheckInst::CheckKind::AssignableButNotConsumable);
}
Val = emitLoad(loc, Val, tl, SGFContext(), IsNotTake).forward(*this);
}