[6.2] Disallow @_lifetime(borrow) for trivial 'inout' arguments #82217
+105
−57
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[NFC] LifetimeDependence: fix indentation
To avoid diff/merge confusion.
(cherry picked from commit 9dd88e2)
Disallow @_lifetime(borrow) for trivial 'inout' arguments
@_lifetime(borrow holder) // ERROR
func test(holder: inout Holder) -> NE
Fixes rdar://153040843 ([nonescapable] disallow @_lifetime(borrow)
for trivial 'inout' arguments)
(cherry picked from commit a389254)
Update tests after disallowing @_lifetime(borrow) for inout
(cherry picked from commit f6c7524)
--- CCC ---
Explanation: Preemptively prohibit the following two forms of nonsense syntax. It's a common mistake. Fixing it is source-breaking, but the syntax was introduced very recently. The sooner we fix this, the better.
Scope: Only affects users of the supported experiment Lifetimes feature.
Radar/SR Issue: rdar://153040843 ([nonescapable] disallow @_lifetime(borrow) for trivial 'inout' arguments)
main PR: #82189
Risk: Low
Testing: Added a matrix of unit tests
Reviewer: Meghana Gupta