mirror of
https://github.com/apple/swift-collections
synced 2026-11-27 04:54:21 +00:00
[BasicContainers] Finalize requirements for hashed containers
- UnstableNoncopyableKeys → UnstableHashedContainers
- Delete the GeneralizedEquatable and GeneralizedHashable protocols, replacing them with the standard generalizations in the 6.4 stdlib
- Require Swift 6.4 for {Rigid,Unique}{Set,Dictionary}.
This commit is contained in:
58 files changed
+137
-207
No files matched your search
@@ -14,7 +14,7 @@ import InternalCollectionsUtilities
|
||||
import ContainersPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_NONCOPYABLE_KEYS && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
|
||||
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_HASHED_CONTAINERS && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet: BorrowingSequence where Element: ~Copyable {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import ContainersPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_NONCOPYABLE_KEYS && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
|
||||
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_HASHED_CONTAINERS && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet where Element: ~Copyable {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_NONCOPYABLE_KEYS
|
||||
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_HASHED_CONTAINERS
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet where Element: ~Copyable {
|
||||
|
||||
@@ -15,7 +15,7 @@ import ContainersPreview
|
||||
#endif
|
||||
|
||||
|
||||
#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_NONCOPYABLE_KEYS
|
||||
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_HASHED_CONTAINERS
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet {
|
||||
@@ -27,7 +27,7 @@ extension UniqueSet {
|
||||
}
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet: GeneralizedEquatable { // Should be Equatable
|
||||
extension UniqueSet: Equatable {
|
||||
@inlinable
|
||||
@inline(__always)
|
||||
public static func ==(left: borrowing Self, right: borrowing Self) -> Bool {
|
||||
|
||||
@@ -14,10 +14,10 @@ import InternalCollectionsUtilities
|
||||
import ContainersPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_NONCOPYABLE_KEYS
|
||||
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_HASHED_CONTAINERS
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet: GeneralizedHashable { // Should be Hashable
|
||||
extension UniqueSet: Hashable {
|
||||
@inlinable
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
_storage.hash(into: &hasher)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import ContainersPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_NONCOPYABLE_KEYS
|
||||
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_HASHED_CONTAINERS
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet where Element: ~Copyable {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import ContainersPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_NONCOPYABLE_KEYS
|
||||
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_HASHED_CONTAINERS
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet where Element: ~Copyable {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import ContainersPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_NONCOPYABLE_KEYS
|
||||
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_HASHED_CONTAINERS
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet where Element: ~Copyable {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_NONCOPYABLE_KEYS
|
||||
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_HASHED_CONTAINERS
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet where Element: ~Copyable {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_NONCOPYABLE_KEYS
|
||||
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_HASHED_CONTAINERS
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet where Element: ~Copyable {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_NONCOPYABLE_KEYS
|
||||
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_HASHED_CONTAINERS
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet where Element: ~Copyable {
|
||||
|
||||
@@ -14,11 +14,17 @@ import InternalCollectionsUtilities
|
||||
import ContainersPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_NONCOPYABLE_KEYS
|
||||
|
||||
#if compiler(<6.4) || !COLLECTIONS_UNSTABLE_HASHED_CONTAINERS
|
||||
@available(*, unavailable, message: "RigidSet requires a Swift 6.4 toolchain")
|
||||
public struct UniqueSet<Element: Hashable>: ~Copyable {
|
||||
package init() {
|
||||
fatalError()
|
||||
}
|
||||
}
|
||||
#else
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
@frozen
|
||||
public struct UniqueSet<Element: GeneralizedHashable & ~Copyable>: ~Copyable {
|
||||
public struct UniqueSet<Element: Hashable & ~Copyable>: ~Copyable {
|
||||
@usableFromInline
|
||||
package typealias _Bucket = _HTable.Bucket
|
||||
|
||||
|
||||
Reference in new issue
Block a user