Skip to content

Conversation

Xazax-hun
Copy link
Contributor

After #83289 and #82879 landed we should no longer get deserialization failures and this feature is no longer behind a flag. This patch also changes how we query if a function's return value depends on self. Previously, we queried the lifetime dependencies from the Swift declaration. Unfortunately, this is problematic as we might have not finished fully importing the types in the function signature just yet and the compiler might end up populating the conformance tables prematurely. To work this around, I store functions with self-dependent return values where lifetimes are computed in the importer for later use.

The PR also adds a test to make sure the addressable dependency feature will not result in deserialization errors.

rdar://155319311&154213694&112690482&128293252

@Xazax-hun Xazax-hun added the c++ interop Feature: Interoperability with C++ label Jul 28, 2025
@Xazax-hun Xazax-hun force-pushed the addressable-param-copy-reapply branch from 5603a98 to ab1c929 Compare July 28, 2025 12:52
After swiftlang#83289 and swiftlang#82879 landed we should no longer get deserialization
failures and this feature is no longer behind a flag. This patch also
changes how we query if a function's return value depends on self.
Previously, we queried the lifetime dependencies from the Swift
declaration. Unfortunately, this is problematic as we might have not
finished fully importing the types in the function signature just yet
and the compiler might end up populating the conformance tables
prematurely. To work this around, I store functions with self-dependent
return values where lifetimes are computed in the importer for later
use.

The PR also adds a test to make sure the addressable dependency feature
will not result in deserialization errors.

rdar://155319311&154213694&112690482&128293252
@Xazax-hun Xazax-hun force-pushed the addressable-param-copy-reapply branch from ab1c929 to 66d15a1 Compare August 18, 2025 10:43
@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Contributor

@egorzhdan egorzhdan left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines +4118 to +4120
if (enclosing->isInStdNamespace() &&
(enclosing->getName() == "unique_ptr" ||
enclosing->getName() == "shared_ptr") &&
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we could check for [[gsl::Pointer]] attribute here.
Doesn't have to be in this patch though!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I think we could use those annotations here.

@Xazax-hun Xazax-hun enabled auto-merge August 18, 2025 10:50
@Xazax-hun Xazax-hun merged commit d2691dc into swiftlang:main Aug 18, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants