swiftlang / swift-corelibs-libdispatch

The libdispatch Project, (a.k.a. Grand Central Dispatch), for concurrency on multicore hardware
swift.org
Apache License 2.0
2.47k stars 460 forks source link

bug: `DispatchSpecificKey` missing conditional `Sendable` annotation #845

Open mman opened 1 month ago

mman commented 1 month ago

On macOS, DispatchSpecificKey is defined like this:

final public class DispatchSpecificKey<T> {

    public init()
}

extension DispatchSpecificKey : Sendable where T : Sendable {
}

on Linux the conditional conformance to Sendable is missing.

https://github.com/apple/swift-corelibs-libdispatch/blob/e85f6a0d5c9ea1f32f5013c3fa34e4fc146cd0eb/src/swift/Queue.swift#L18

The end result is that code with strict concurrency checking that does compile under macOS with Swift 6 does not compile under Linux.

See the associated post here: https://forums.swift.org/t/dispatchqueue-setspecific-swift-6-concurrency-linux/74653