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

Fix sendability warnings in new Swift 6 toolchains #241

Merged

Conversation

hallee
Copy link
Contributor

@hallee hallee commented Jul 13, 2024

In Xcode 16 Beta 3 (and also the latest Swift 6 toolchain), there are new data race errors that cause this library to not compile with strict checking enabled:

 54 |         do {
 55 |           for try await element in sequence {
 56 |             continuation.yield(element)
    |                          |- error: sending 'element' risks causing data races
    |                          |- note: 'element' used after being passed as a 'sending' parameter; Later uses could race
    |                          `- note: access can happen concurrently
 57 |           }
 58 |           continuation.finish()

/Users/hal/Developer/swift-dependencies/Sources/Dependencies/Internal/Deprecations.swift:85:26: error: sending 'element' risks causing data races
 83 |         do {
 84 |           for try await element in sequence {
 85 |             continuation.yield(element)
    |                          |- error: sending 'element' risks causing data races
    |                          |- note: 'element' used after being passed as a 'sending' parameter; Later uses could race
    |                          `- note: access can happen concurrently
 86 |           }
 87 |           continuation.finish()

Adding a Sendable constraint for Element seems to silence the errors.

Copy link
Member

@mbrandonw mbrandonw left a comment

Choose a reason for hiding this comment

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

Thanks @hallee! We'll get a release out later today.

@mbrandonw mbrandonw merged commit 22235fe into pointfreeco:final-swift-6-changes Jul 15, 2024
@hallee hallee deleted the final-swift-6-changes branch July 15, 2024 21:01
stephencelis pushed a commit that referenced this pull request Jul 15, 2024
* A few more changes for Swift 6 mode.

* fix

* Fix sendability warnings in new Swift 6 toolchains (#241)

---------

Co-authored-by: Hal Lee <hal@lee.me>
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