mirror of
https://github.com/apple/swift-collections
synced 2026-11-27 04:54:21 +00:00
Fix {Rigid,Unique}{Set,Dictionary}
This commit is contained in:
14 files changed
+67
-52
No files matched your search
@@ -20,11 +20,12 @@ import ContainersPreview
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet: BorrowingSequence_ where Element: ~Copyable {
|
||||
public typealias BorrowingIterator = RigidSet<Element>.BorrowingIterator
|
||||
|
||||
public typealias Element_ = Element
|
||||
public typealias BorrowingIterator_ = RigidSet<Element>.BorrowingIterator_
|
||||
|
||||
@inlinable
|
||||
public var underestimatedCount: Int { count }
|
||||
|
||||
public var underestimatedCount_: Int { count }
|
||||
|
||||
@inlinable
|
||||
public func _customContainsEquatableElement_(
|
||||
_ element: borrowing Element
|
||||
@@ -34,8 +35,8 @@ extension UniqueSet: BorrowingSequence_ where Element: ~Copyable {
|
||||
|
||||
@inlinable
|
||||
@_lifetime(borrow self)
|
||||
public borrowing func makeBorrowingIterator() -> BorrowingIterator {
|
||||
BorrowingIterator(_set: _storage)
|
||||
public borrowing func makeBorrowingIterator_() -> BorrowingIterator_ {
|
||||
BorrowingIterator_(_set: _storage)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -29,6 +29,9 @@ extension UniqueSet {
|
||||
}
|
||||
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
extension UniqueSet: Equatable {}
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet: Equatable {
|
||||
@inlinable
|
||||
@inline(__always)
|
||||
|
||||
@@ -19,7 +19,10 @@ import ContainersPreview
|
||||
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_HASHED_CONTAINERS && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
|
||||
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
extension UniqueSet: Hashable {
|
||||
extension UniqueSet: Hashable {}
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueSet {
|
||||
@inlinable
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
_storage.hash(into: &hasher)
|
||||
|
||||
@@ -75,7 +75,6 @@ extension UniqueSet where Element: ~Copyable {
|
||||
extension UniqueSet where Element: Copyable {
|
||||
|
||||
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@_alwaysEmitIntoClient
|
||||
public init<
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
@@ -94,7 +93,6 @@ extension UniqueSet where Element: Copyable {
|
||||
}
|
||||
|
||||
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@_alwaysEmitIntoClient
|
||||
public init<
|
||||
S: BorrowingSequence_<Element> & Sequence<Element>
|
||||
|
||||
@@ -130,17 +130,16 @@ extension UniqueSet /* where Element: Copyable */ {
|
||||
}
|
||||
|
||||
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@_alwaysEmitIntoClient
|
||||
package mutating func _insert<
|
||||
S: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying items: borrowing S
|
||||
) {
|
||||
_ensureFreeCapacity(items.underestimatedCount)
|
||||
var it = items.makeBorrowingIterator()
|
||||
_ensureFreeCapacity(items.underestimatedCount_)
|
||||
var it = items.makeBorrowingIterator_()
|
||||
while true {
|
||||
let span = it.nextSpan()
|
||||
let span = it.nextSpan_()
|
||||
guard !span.isEmpty else { break }
|
||||
self.insert(copying: span)
|
||||
}
|
||||
@@ -148,7 +147,6 @@ extension UniqueSet /* where Element: Copyable */ {
|
||||
#endif
|
||||
|
||||
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func insert<
|
||||
@@ -171,7 +169,6 @@ extension UniqueSet /* where Element: Copyable */ {
|
||||
}
|
||||
|
||||
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func insert<
|
||||
|
||||
Reference in new issue
Block a user