SILGen: Mark constant captures for no_consume_or_assign checking instead of may_assign_but_not_consume.

An immutable noncopyable capture borrows the captured value in-place and can't do anything
to modify it, and the may_assign_but_not_consume checking behaves badly with some code patterns
generated for resilient types when `self` is captured during a deinit. This change allows for
more accurate checking and fixes rdar://118427997.
This commit is contained in:
Joe Groff
2023-11-15 17:26:42 -08:00
parent f126b714bf
commit 16d974e9e1
4 changed files with 102 additions and 2 deletions

View File

@@ -771,7 +771,7 @@ void SILGenFunction::emitCaptures(SILLocation loc,
val = B.createMarkUnresolvedNonCopyableValueInst(
loc, val,
MarkUnresolvedNonCopyableValueInst::CheckKind::
AssignableButNotConsumable);
NoConsumeOrAssign);
}
val = emitLoad(loc, val, tl, SGFContext(), IsNotTake).forward(*this);
}