Skip to content

LifetimeDependence: Disable parameter indices in Swift lifetime dependence annotations#86846

Merged
aidan-hall merged 1 commit into
swiftlang:mainfrom
aidan-hall:disable-lifetime-indices
Feb 6, 2026
Merged

LifetimeDependence: Disable parameter indices in Swift lifetime dependence annotations#86846
aidan-hall merged 1 commit into
swiftlang:mainfrom
aidan-hall:disable-lifetime-indices

Conversation

@aidan-hall
Copy link
Copy Markdown
Contributor

@aidan-hall aidan-hall commented Jan 28, 2026

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).

Copy link
Copy Markdown
Contributor

@meg-gupta meg-gupta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aidan-hall aidan-hall force-pushed the disable-lifetime-indices branch 2 times, most recently from 0f3b037 to df84fad Compare February 5, 2026 16:20
@aidan-hall
Copy link
Copy Markdown
Contributor Author

Rebased on top of #86842, ignore all but the last commit.

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.
@aidan-hall
Copy link
Copy Markdown
Contributor Author

@swift-ci smoke test

@aidan-hall
Copy link
Copy Markdown
Contributor Author

@swift-ci test

@aidan-hall aidan-hall requested a review from meg-gupta February 6, 2026 10:55
@aidan-hall
Copy link
Copy Markdown
Contributor Author

@swift-ci test windows

@aidan-hall aidan-hall merged commit 88b2c1c into swiftlang:main Feb 6, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants