@@ -888,7 +888,7 @@ class ArgUnforwarder {
888
888
assert (operand.getFinalConsumption () !=
889
889
CastConsumptionKind::TakeOnSuccess &&
890
890
" When compiling with sil ownership take on success is disabled" );
891
- // No unforwarding is needed, we always copy.
891
+ // No unforwarding is needed, we always borrow/ copy.
892
892
return false ;
893
893
}
894
894
@@ -1394,12 +1394,14 @@ static ConsumableManagedValue
1394
1394
getManagedSubobject (SILGenFunction &SGF, SILValue value,
1395
1395
const TypeLowering &valueTL,
1396
1396
CastConsumptionKind consumption) {
1397
- if (consumption != CastConsumptionKind::CopyOnSuccess) {
1398
- return {SGF.emitManagedRValueWithCleanup (value, valueTL),
1399
- consumption};
1400
- } else {
1397
+ if (consumption == CastConsumptionKind::CopyOnSuccess) {
1401
1398
return {ManagedValue::forUnmanaged (value), consumption};
1402
1399
}
1400
+
1401
+ assert ((!SGF.F .getModule ().getOptions ().EnableSILOwnership ||
1402
+ consumption != CastConsumptionKind::TakeOnSuccess) &&
1403
+ " TakeOnSuccess should never be used when sil ownership is enabled" );
1404
+ return {SGF.emitManagedRValueWithCleanup (value, valueTL), consumption};
1403
1405
}
1404
1406
1405
1407
static ConsumableManagedValue
0 commit comments