Skip to content

Commit cd3734c

Browse files
committed
[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. (cherry picked from commit 9c9fe09)
1 parent d2b7e70 commit cd3734c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/SILOptimizer/Transforms/AllocBoxToStack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ specializeApplySite(SILOptFunctionBuilder &FuncBuilder, ApplySite Apply,
10411041
auto boxType = F->getArgument(index)->getType().castTo<SILBoxType>();
10421042
bool isMutable = boxType->getLayout()->getFields()[0].isMutable();
10431043
auto checkKind =
1044-
isMutable ? MarkMustCheckInst::CheckKind::AssignableButNotConsumable
1044+
isMutable ? MarkMustCheckInst::CheckKind::ConsumableAndAssignable
10451045
: MarkMustCheckInst::CheckKind::NoConsumeOrAssign;
10461046
hoistMarkMustCheckInsts(ClonedFn->getArgument(index), checkKind);
10471047
}

0 commit comments

Comments
 (0)