[BasicContainers] RigidArray,UniqueArray: Add Equatable conformance on Swift 6.4

This is currently conditional on the UnstableContainersPreview trait. (Swift 6.4 has not shipped yet, so we cannot unconditionally enable this without risking breakage.)
This commit is contained in:
Karoy Lorentey committed 2026-04-08 18:31:11 -07:00
1 parent 917eead3cb
commit a9b64d4f09
3 files changed
+48 -2

No files matched your search

@@ -24,8 +24,9 @@ extension UniqueArray where Element: ~Copyable {
}
}
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
extension UniqueArray /*: Equatable */ where Element: Equatable /* & ~Copyable */ {
extension UniqueArray: Equatable where Element: Equatable & ~Copyable {
@inlinable
public static func ==(
left: borrowing Self,
@@ -34,5 +35,17 @@ extension UniqueArray /*: Equatable */ where Element: Equatable /* & ~Copyable *
left.span._elementsEqual(to: right.span)
}
}
#else
@available(SwiftStdlib 5.0, *)
extension UniqueArray where Element: Equatable {
@inlinable
public static func ==(
left: borrowing Self,
right: borrowing Self
) -> Bool {
left.span._elementsEqual(to: right.span)
}
}
#endif
#endif