Skip to content

[concurrency] Make GlobalActorIsolatedTypesUsability an upcoming swift 6 feature and fix a region isolation issue that prevented us from enabling it #73605

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

Merged
merged 2 commits into from
May 14, 2024

Conversation

gottesmm
Copy link
Contributor

This PR contains two different commits:

  1. We allow non-Sendable types to be captured by Sendable Global Actor isolated closures. We consider them to be transferred into the global actor isolation domain and rely on the global actor isolation queue to ensure that we never run the Sendable actor in parallel. This sequential running of the non-Sendable closure ensures that at any one time the closure will only ever be run serially.
  2. I made GlobalActorIsolatedTypesUsability an upcoming swift 6 feature on top of the above change. This involved changing all instances of enable-experimental-feature GlobalActorIsolatedTypesUsability -> enable-upcoming-feature GlobalActorIsolatedTypesUsability and updating some tests.

rdar://118244451
rdar://125200006

gottesmm added 2 commits May 13, 2024 18:40
…to use transferred non-Sendable parameters.

This is safe since:

1. We transfer in the non-Sendable parameter into the global actor isolation
region so we know that we will not use the non-Sendable paramter again except on
that actor.

2. Since the closure is global actor isolated, we know that despite the fact
that it is Sendable, it will only ever be executed serially on said global actor
implying that we do not need to worry about different executions of the Sendable
closure running concurrently with each other.

rdar://125200006
@gottesmm gottesmm requested a review from ktoso as a code owner May 14, 2024 01:43
@gottesmm gottesmm requested a review from hborla May 14, 2024 01:44
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

Copy link
Member

@hborla hborla left a comment

Choose a reason for hiding this comment

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

Thank you!

@gottesmm gottesmm enabled auto-merge May 14, 2024 04:14
@gottesmm gottesmm merged commit 387580c into swiftlang:main May 14, 2024
@gottesmm gottesmm deleted the rdar118244451_125200006 branch May 14, 2024 13:08
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