mirror of
https://github.com/apple/swift-collections
synced 2026-11-29 05:14:20 +00:00
[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:
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
|
||||
Reference in new issue
Block a user