Skip to content

Commit ae8ab3f

Browse files
authored
Merge pull request #26792 from gottesmm/pr-6b1427d9adcb9f6ee87eb47d3a5642dee02f0aa5
[semantic-arc-opts] Convert a piece of code to be an assert.
2 parents 0742e6f + 83dbdc4 commit ae8ab3f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/SILOptimizer/Mandatory/SemanticARCOpts.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,13 @@ static bool isConsumed(
100100
return true;
101101
}
102102
case UseLifetimeConstraint::MustBeLive:
103-
// Ok, this constraint can take something owned as live. Lets
104-
// see if it can also take something that is guaranteed. If it
105-
// can not, then we bail.
106-
map.canAcceptKind(ValueOwnershipKind::Guaranteed);
103+
// Ok, this constraint can take something owned as live. Assert that it
104+
// can also accept something that is guaranteed. Any non-consuming use of
105+
// an owned value should be able to take a guaranteed parameter as well
106+
// (modulo bugs). We assert to catch these.
107+
assert(map.canAcceptKind(ValueOwnershipKind::Guaranteed) &&
108+
"Any non-consuming use of an owned value should be able to take a "
109+
"guaranteed value");
107110
continue;
108111
}
109112
}

0 commit comments

Comments
 (0)