-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add support for lifetime dependence in parameter position #75096
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
414b128
to
bcc7ff2
Compare
@swift-ci test |
@swift-ci test |
@swift-ci test |
@swift-ci test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
5f0c5f9
to
6f759ff
Compare
@swift-ci test |
@atrick @eeckstein I'll make the suggested mangling changes as a follow on. |
Please provide a comment that describes what this pull request does, because radar numbers aren't useful outside of Apple. |
I do have a mangling question... I assume that we're not going to allow overloading based on the lifetime dependencies of a function. In that case, do we need to have a mangling for all of the lifetime dependencies? |
@DougGregor Yeah, we won't be overloading on lifetime dependencies. I think we do need to mangle all lifetime dependencies (result, inout parameters, self at least) because adding or changing them is abi breaking since we need the correct So, we are mangling to ensure we don't end up with the same symbol when lifetime dependencies change. |
I thought it would be ABI-compatible to remove lifetime dependencies, and that might even be a likely course of evolution: an API might initially not document its dependencies, and rely on the the inferred dependencies. Then later they realize that the inferred dependencies were too broad and document the narrower lifetime dependencies. We can cope with this via |
Okay - I thought we want to mangle all ABI breaking changes. |
When a function result is nonescapable, we always mangle at least one dependence. There could be more than one dependence, and the source of that dependence could generally be any argument, so the ABI is sensitive to those changes. Generally, we want any aspect of the ABI that is sensitive to source changes to be mangled simply to catch problems at link time rather than debugging miscompiles. If the client adds If the client removes |
@meg-gupta, just to be sure we're on the same page... For nonescapable results, lifetime dependence inference rules are independent of mangling. We always mangle whether it could be inferred or not. We could change/fix inferrence rules without risk of miscompile.
|
e0f7ddf
to
422ed2b
Compare
@swift-ci test |
Yes, we should mangle/serialize/ast print both inferred and explicit dependencies. |
|
@swift-ci test Windows Platform |
Extend support for lifetime dependence in parameter position:
https://github.com/swiftlang/swift-evolution/blob/e814e62c17741dfe82e2f55eb1d751157c77a853/proposals/NNNN-lifetime-dependency.md#dependent-parameters contains a detailed explanation