LifetimeDependence: Disable parameter indices in Swift lifetime dependence annotations#86846
Merged
Merged
Conversation
99383e2 to
d18b1b1
Compare
0f3b037 to
df84fad
Compare
Contributor
Author
|
Rebased on top of #86842, ignore all but the last commit. |
df84fad to
c0e7b82
Compare
Lifetime indices are never necessary in Swift, they unnecessarily expose implementation details, and they make lifetime annotations more error-prone, since they may need to be updated if a function's parameter list changes. The Swift Syntax parser also cannot handle lifetime annotations where the target is an index. The main reason the C++ parser supports them is because it is also used for SIL.
c0e7b82 to
63da649
Compare
Contributor
Author
|
@swift-ci smoke test |
Contributor
Author
|
@swift-ci test |
Contributor
Author
|
@swift-ci test windows |
meg-gupta
approved these changes
Feb 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Parameter indices are never necessary in Swift lifetime syntax, they unnecessarily expose implementation details, and they make lifetime annotations more error-prone, since they may need to be updated if a function's parameter list changes.
Indices were only ever mentioned in the lifetimes proposal as an alternative spelling that could be added in response to sufficient demand, so this should not break any code using the feature as documented (confirmed by a manual search of internal codebases).