Skip to content

Conversation

@jmschonfeld
Copy link
Contributor

@_nonSendable was designed as a detail for the compiler to use and was not intended to be written directly in source. As such, the compiler treats it slightly differently and has allowed us to commit some incorrect annotations, such as:

@_nonSendable
open class FileManager : @unchecked Sendable {

(a both non-sendable and unchecked-sendable class)

and

@_nonSendable
public struct KeyPathComparator<Compared>: SortComparator {

(a non-sendable struct that conforms to a Sendable protocol)

This PR replaces usages of @_nonSendable with the officially supported design (unavailable extensions). This has the drawbacks of needing to duplicate the type's availability and moving the non-sendable annotation away from the type itself, but it means that both of the errors above would be diagnosed as actual compilation errors rather than silently being accepted and potentially causing issues for clients.

@jmschonfeld
Copy link
Contributor Author

@swift-ci please test

@jmschonfeld jmschonfeld merged commit da80d51 into swiftlang:main Sep 3, 2024
@jmschonfeld jmschonfeld deleted the non-sendable-annotations branch September 3, 2024 17:47
cthielen pushed a commit to cthielen/swift-foundation that referenced this pull request Nov 8, 2024
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