[BasicContainers, DequeModule] Clean up Equatable/Hashable conformances

Make sure all types conditionally conform to Equatable/Hashable, even if their contents happen to be noncopyable.
This commit is contained in:
Karoy Lorentey committed 2026-06-18 12:56:23 -07:00
1 parent f5b320c29f
commit 73ec3d3416
14 files changed
+95 -38

No files matched your search

@@ -13,16 +13,30 @@
#if compiler(>=6.2)
@available(SwiftStdlib 5.0, *)
extension UniqueArray /*: Hashable */ where Element: Hashable /* & ~Copyable */ {
@inlinable
public func hash(into hasher: inout Hasher) {
hasher.combine(self.count)
let span = self.span
for i in 0 ..< count {
hasher.combine(span[unchecked: i])
}
}
#if !COLLECTIONS_SINGLE_MODULE
import InternalCollectionsUtilities
#endif
#if compiler(>=6.4)
@available(SwiftStdlib 6.4, *)
extension UniqueArray: Hashable where Element: Hashable & ~Copyable {
}
@available(SwiftStdlib 5.0, *)
extension UniqueArray where Element: Hashable & ~Copyable {
@inlinable
public func hash(into hasher: inout Hasher) {
self._storage.hash(into: &hasher)
}
}
#else
@available(SwiftStdlib 5.0, *)
extension UniqueArray where Element: Hashable {
@inlinable
public func hash(into hasher: inout Hasher) {
self._storage.hash(into: &hasher)
}
}
#endif
#endif