mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[allocbox-to-stack] When we promote an argument that is moveonly, use consumable_and_assignable, not assignable_but_not_consumable.
Otherwise, since the compiler views assignable_but_not_consumable in this position as a sign of an escaping closure, we emit escaping closure errors instead of nonescaping closure errors.
This commit is contained in:
@@ -1041,7 +1041,7 @@ specializeApplySite(SILOptFunctionBuilder &FuncBuilder, ApplySite Apply,
|
||||
auto boxType = F->getArgument(index)->getType().castTo<SILBoxType>();
|
||||
bool isMutable = boxType->getLayout()->getFields()[0].isMutable();
|
||||
auto checkKind =
|
||||
isMutable ? MarkMustCheckInst::CheckKind::AssignableButNotConsumable
|
||||
isMutable ? MarkMustCheckInst::CheckKind::ConsumableAndAssignable
|
||||
: MarkMustCheckInst::CheckKind::NoConsumeOrAssign;
|
||||
hoistMarkMustCheckInsts(ClonedFn->getArgument(index), checkKind);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user