Skip to content

[stdlib] make _overrideLifetime() functions public#81224

Merged
glessard merged 4 commits into
swiftlang:mainfrom
glessard:override-lifetime-publicly
May 7, 2025
Merged

[stdlib] make _overrideLifetime() functions public#81224
glessard merged 4 commits into
swiftlang:mainfrom
glessard:override-lifetime-publicly

Conversation

@glessard

Copy link
Copy Markdown
Contributor

These functions are discussed in the lifetime annotations pitch: swiftlang/swift-evolution#2750
They are necessary to implement functions returning non-escapable values, such as Data.bytes.

Addresses rdar://150400414

@glessard
glessard requested review from a team and eeckstein as code owners April 30, 2025 23:35
@glessard

Copy link
Copy Markdown
Contributor Author

@swift-ci please smoke test

@meg-gupta meg-gupta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@glessard
glessard enabled auto-merge May 1, 2025 00:06

@atrick atrick left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! This is super helpful.

@atrick

atrick commented May 1, 2025

Copy link
Copy Markdown
Contributor

@glessard you can remove these TODOs now:

  // TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence
  // should be expressed by a builtin that is hidden within the function body.

They were originally to discourage people from using @_unsafeNonescapableResult in more places, but we won't be able to remove that annotation any time soon and the TODO is unhelpful for anyone not working on the compiler.

glessard added 2 commits May 6, 2025 15:19
These TODOs aren’t particularly actionable. What we really want is a way to define `_overrideLifetime()` in a not-unsafe way, and that will probably be a `Builtin` operation.
@glessard

glessard commented May 6, 2025

Copy link
Copy Markdown
Contributor Author

@swift-ci please smoke test

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.

3 participants