mirror of
https://github.com/apple/swift-collections
synced 2026-11-26 04:47:48 +00:00
[BasicContainers] Make the hashed containers Sendable
RigidSet, UniqueSet, RigidDictionary and UniqueDictionary had no Sendable conformance, while the arrays and deques conform when their elements are Sendable. Add the same conditional conformances: unchecked for the rigid containers, which keep their elements behind unsafe pointers, and checked for the unique ones.
This commit is contained in:
8 files changed
+42
No files matched your search
@@ -80,6 +80,10 @@ public struct RigidDictionary<
|
||||
}
|
||||
}
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidDictionary: @unchecked Sendable
|
||||
where Key: Sendable & ~Copyable, Value: Sendable & ~Copyable {}
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidDictionary where Key: ~Copyable, Value: ~Copyable {
|
||||
@inlinable
|
||||
|
||||
@@ -78,6 +78,9 @@ public struct RigidSet<Element: Hashable & ~Copyable>: ~Copyable {
|
||||
}
|
||||
}
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidSet: @unchecked Sendable where Element: Sendable & ~Copyable {}
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidSet where Element: ~Copyable {
|
||||
@inlinable
|
||||
|
||||
@@ -41,6 +41,10 @@ public struct UniqueDictionary<
|
||||
}
|
||||
}
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueDictionary: Sendable
|
||||
where Key: Sendable & ~Copyable, Value: Sendable & ~Copyable {}
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueDictionary where Key: ~Copyable, Value: ~Copyable {
|
||||
@inlinable
|
||||
|
||||
@@ -40,6 +40,9 @@ public struct UniqueSet<Element: Hashable & ~Copyable>: ~Copyable {
|
||||
}
|
||||
}
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet: Sendable where Element: Sendable & ~Copyable {}
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet where Element: ~Copyable {
|
||||
@inlinable
|
||||
|
||||
Reference in new issue
Block a user