Skip to content
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

[Concurrency] Diagnose non-sendable 'self' arguments crossing isolation boundaries. #67730

Merged
merged 1 commit into from
Aug 4, 2023

Conversation

hborla
Copy link
Member

@hborla hborla commented Aug 4, 2023

Otherwise, the following code can reference the state of a non-Sendable class across different actor isolation domains:

final class NonSendable {
  var value = ""

  @MainActor
  func update() {
    value = "update"
  }
}

func test() async {
  let t = NonSendable()
  await t.update() // Sending an instance of 'NonSendable' to the MainActor here!
}

Resolves rdar://111470341

@hborla
Copy link
Member Author

hborla commented Aug 4, 2023

@swift-ci please smoke test

Copy link
Contributor

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

Great catch, I think that's the right thing to do 👍

@hborla
Copy link
Member Author

hborla commented Aug 4, 2023

@swift-ci please smoke test

@hborla
Copy link
Member Author

hborla commented Aug 4, 2023

@swift-ci please smoke test macOS

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.

None yet

2 participants