Skip to content

[Concurrency] Remove the global actor check when allowing 'nonisolated' on mutable Sendable storage. #75084

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 1 commit into from
Jul 9, 2024

Conversation

simanerush
Copy link
Member

@simanerush simanerush commented Jul 8, 2024

The global actor check was redundant, so remove it. Added more tests to the testing suite to verify that nonisolated is allowed on implicitly Sendable structs.

Also make sure that on non-Sendable structs, nonisolated is still not allowed on any mutable storage

Resolves rdar://131339439.

@simanerush simanerush requested a review from hborla July 8, 2024 23:09
@simanerush
Copy link
Member Author

@swift-ci please smoke test

@simanerush
Copy link
Member Author

@swift-ci please smoke test

@simanerush
Copy link
Member Author

@swift-ci please 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!

@simanerush simanerush merged commit 2744413 into swiftlang:main Jul 9, 2024
3 checks passed
@simanerush simanerush deleted the sima/131339439 branch July 9, 2024 23:57
Comment on lines -7011 to +7014
if (dc->isTypeContext()) {
if (auto nominal = dc->getSelfStructDecl()) {
if (!var->isStatic() && type->isSendableType() &&
getActorIsolation(nominal).isGlobalActor()) {
canBeNonisolated = true;
}
if (auto nominal = dc->getSelfStructDecl()) {
if (nominal->getDeclaredTypeInContext()->isSendableType() &&
!var->isStatic() && type->isSendableType()) {
canBeNonisolated = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why was the global actor check redundant? It is not so according to the proposal.

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.

4 participants