[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:
Tolga Unal committed 2026-11-16 11:38:37 -05:00
1 parent 88754449ab
commit c211bc56af
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