Skip to content

Commit ada46a0

Browse files
committed
Lifetime inference: restructure to support multiple dependencies.
Restructure the inference logic to allow the same function declaration to independently annotate or infer different lifetime targets. For example: @_lifetime(borrow a) /* DEFAULT: @_lifetime(b: copy b) func f(a: A, b: inout B) -> NE The fact that we prevented this was somewhat accidental and surprising. This restructuring simplifies the code but also gives us much more control over the inference logic. Fixes: rdar://159288750 ("A function cannot have a ~Escapable 'inout' parameter in addition to other ~Escapable parameters" is not actionable)
1 parent d8cbb57 commit ada46a0

File tree

2 files changed

+624
-583
lines changed

2 files changed

+624
-583
lines changed

include/swift/AST/LifetimeDependence.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class LifetimeDependenceInfo {
218218
addressableParamIndicesAndImmortal(addressableParamIndices, isImmortal),
219219
conditionallyAddressableParamIndices(conditionallyAddressableParamIndices),
220220
targetIndex(targetIndex) {
221-
assert(this->isImmortal() || inheritLifetimeParamIndices ||
221+
ASSERT(this->isImmortal() || inheritLifetimeParamIndices ||
222222
scopeLifetimeParamIndices);
223223
ASSERT(!inheritLifetimeParamIndices ||
224224
!inheritLifetimeParamIndices->isEmpty());

0 commit comments

Comments
 (0)