diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Append.swift b/Sources/BasicContainers/RigidArray/RigidArray+Append.swift index c1b4445d..23e8e506 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Append.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Append.swift @@ -349,7 +349,7 @@ extension RigidArray { #if compiler(>=6.4) && UnstableContainersPreview @inlinable internal mutating func _append< - Source: BorrowingSequence_ & ~Copyable & ~Escapable + Source: Iterable_ & ~Copyable & ~Escapable >( copying newElements: borrowing Source ) { @@ -371,7 +371,7 @@ extension RigidArray { @_alwaysEmitIntoClient @inline(__always) public mutating func append< - Source: BorrowingSequence_ & ~Copyable & ~Escapable + Source: Iterable_ & ~Copyable & ~Escapable >( copying newElements: borrowing Source ) { @@ -413,7 +413,7 @@ extension RigidArray { @_alwaysEmitIntoClient @inline(__always) public mutating func append< - Source: BorrowingSequence_ & Sequence + Source: Iterable_ & Sequence >(copying newElements: Source) { _append(copying: newElements) } diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Container.swift b/Sources/BasicContainers/RigidArray/RigidArray+Container.swift index 0cbe300e..c883ce72 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Container.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Container.swift @@ -20,11 +20,11 @@ import ContainersPreview #if compiler(>=6.4) && UnstableContainersPreview @available(SwiftStdlib 5.0, *) -extension RigidArray: BorrowingSequence_ where Element: ~Copyable { - public typealias BorrowingIterator_ = SpanIterator +extension RigidArray: Iterable_ where Element: ~Copyable { + public typealias IterableIterator_ = SpanIterator @_alwaysEmitIntoClient @inline(__always) - public func makeBorrowingIterator_() -> BorrowingIterator_ { + public func makeIterableIterator_() -> IterableIterator_ { SpanIterator(self.span) } } diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Initializers.swift b/Sources/BasicContainers/RigidArray/RigidArray+Initializers.swift index b90db7b6..39666940 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Initializers.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Initializers.swift @@ -124,7 +124,7 @@ extension RigidArray /*where Element: Copyable*/ { /// The container must not contain more than `capacity` elements. @_alwaysEmitIntoClient @inline(__always) - public init & ~Copyable & ~Escapable>( + public init & ~Copyable & ~Escapable>( capacity: Int, copying contents: borrowing Source ) { @@ -145,7 +145,7 @@ extension RigidArray /*where Element: Copyable*/ { /// The container must not contain more than `capacity` elements. @_alwaysEmitIntoClient @inline(__always) - public init & Sequence>( + public init & Sequence>( capacity: Int, copying contents: Source ) { diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Insertions.swift b/Sources/BasicContainers/RigidArray/RigidArray+Insertions.swift index 99124370..82b7da61 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Insertions.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Insertions.swift @@ -415,7 +415,7 @@ extension RigidArray { copying items: borrowing C, newCount: Int ) { - var it = items.makeBorrowingIterator_() + var it = items.makeIterableIterator_() insert(addingCount: newCount, at: index) { target in while !target.isFull { let source = it.nextSpan_(maximumCount: target.freeCapacity) diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Replacements.swift b/Sources/BasicContainers/RigidArray/RigidArray+Replacements.swift index 2547d767..0d332c7a 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Replacements.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Replacements.swift @@ -591,7 +591,7 @@ extension RigidArray { copyingContainer items: borrowing C, newCount: Int ) { - var it = items.makeBorrowingIterator_() + var it = items.makeIterableIterator_() self.replace(removing: subrange, addingCount: newCount) { target in while !target.isFull { let source = it.nextSpan_(maximumCount: target.freeCapacity) diff --git a/Sources/BasicContainers/RigidDictionary/RigidDictionary+Indices.swift b/Sources/BasicContainers/RigidDictionary/RigidDictionary+Indices.swift index b5463eae..afdcceef 100644 --- a/Sources/BasicContainers/RigidDictionary/RigidDictionary+Indices.swift +++ b/Sources/BasicContainers/RigidDictionary/RigidDictionary+Indices.swift @@ -41,14 +41,14 @@ extension RigidDictionary where Key: ~Copyable, Value: ~Copyable { } @available(SwiftStdlib 6.2, *) -extension RigidDictionary.Indices: BorrowingSequence_ +extension RigidDictionary.Indices: Iterable_ where Key: ~Copyable, Value: ~Copyable { public typealias Element = RigidDictionary.Index public typealias Element_ = Element @frozen - public struct BorrowingIterator_: ~Escapable { + public struct IterableIterator_: ~Escapable { public typealias Element = RigidDictionary.Index @usableFromInline @@ -71,16 +71,16 @@ where Key: ~Copyable, Value: ~Copyable public var underestimatedCount_: Int { self._base.value.count } @_lifetime(borrow self) // FIXME: Should be @_lifetime(copy self) - public func makeBorrowingIterator_() -> BorrowingIterator_ { + public func makeIterableIterator_() -> IterableIterator_ { let bit = self._base.value.makeBucketIterator() // FIXME: This override really should not be necessary. Check if the real `struct Borrow` fixes it. let override = _overrideLifetime(bit, copying: self) - return BorrowingIterator_(_it: override) + return IterableIterator_(_it: override) } } @available(SwiftStdlib 6.2, *) -extension RigidDictionary.Indices.BorrowingIterator_: BorrowingIteratorProtocol_ +extension RigidDictionary.Indices.IterableIterator_: IterableIteratorProtocol_ where Key: ~Copyable, Value: ~Copyable { public typealias Element_ = Element diff --git a/Sources/BasicContainers/RigidSet/RigidSet+BorrowingSequence.swift b/Sources/BasicContainers/RigidSet/RigidSet+BorrowingSequence.swift index a1675ba2..555248de 100644 --- a/Sources/BasicContainers/RigidSet/RigidSet+BorrowingSequence.swift +++ b/Sources/BasicContainers/RigidSet/RigidSet+BorrowingSequence.swift @@ -18,7 +18,7 @@ import ContainersPreview #if compiler(>=6.4) && UnstableHashedContainers && UnstableContainersPreview @available(SwiftStdlib 5.0, *) -extension RigidSet: BorrowingSequence_ where Element: ~Copyable { +extension RigidSet: Iterable_ where Element: ~Copyable { public typealias Element_ = Element @inlinable @@ -33,13 +33,13 @@ extension RigidSet: BorrowingSequence_ where Element: ~Copyable { @inlinable @_lifetime(borrow self) - public borrowing func makeBorrowingIterator_() -> BorrowingIterator_ { - BorrowingIterator_(_set: self) + public borrowing func makeIterableIterator_() -> IterableIterator_ { + IterableIterator_(_set: self) } @frozen - public struct BorrowingIterator_: - BorrowingIteratorProtocol_, + public struct IterableIterator_: + IterableIteratorProtocol_, ~Copyable, ~Escapable { diff --git a/Sources/BasicContainers/RigidSet/RigidSet+Equatable.swift b/Sources/BasicContainers/RigidSet/RigidSet+Equatable.swift index 6c8e7957..d5796880 100644 --- a/Sources/BasicContainers/RigidSet/RigidSet+Equatable.swift +++ b/Sources/BasicContainers/RigidSet/RigidSet+Equatable.swift @@ -40,7 +40,7 @@ extension RigidSet { guard left.count == right.count else { return false } - var lit = left.makeBorrowingIterator_() + var lit = left.makeIterableIterator_() while true { let l = lit.nextSpan_() if l.isEmpty { break } diff --git a/Sources/BasicContainers/RigidSet/RigidSet+Hashable.swift b/Sources/BasicContainers/RigidSet/RigidSet+Hashable.swift index 3e2ff619..cc028880 100644 --- a/Sources/BasicContainers/RigidSet/RigidSet+Hashable.swift +++ b/Sources/BasicContainers/RigidSet/RigidSet+Hashable.swift @@ -37,7 +37,7 @@ extension RigidSet { public func _rawHashValue(seed: Int) -> Int { #if UnstableContainersPreview var hash = 0 - var it = self.makeBorrowingIterator_() + var it = self.makeIterableIterator_() while true { let next = it.nextSpan_() var i = 0 diff --git a/Sources/BasicContainers/RigidSet/RigidSet+Initializers.swift b/Sources/BasicContainers/RigidSet/RigidSet+Initializers.swift index 578acc38..d3e5a4a9 100644 --- a/Sources/BasicContainers/RigidSet/RigidSet+Initializers.swift +++ b/Sources/BasicContainers/RigidSet/RigidSet+Initializers.swift @@ -85,7 +85,7 @@ extension RigidSet /* where Element: Copyable */ { @_alwaysEmitIntoClient @inline(__always) public init< - S: BorrowingSequence_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >( capacity: Int, copying contents: borrowing S @@ -119,7 +119,7 @@ extension RigidSet /* where Element: Copyable */ { @_alwaysEmitIntoClient @inline(__always) public init< - S: BorrowingSequence_ & Sequence + S: Iterable_ & Sequence >( capacity: Int, copying contents: borrowing S @@ -131,7 +131,7 @@ extension RigidSet /* where Element: Copyable */ { @_alwaysEmitIntoClient @inline(__always) public init< - S: BorrowingSequence_ & Collection + S: Iterable_ & Collection >( capacity: Int? = nil, copying contents: S diff --git a/Sources/BasicContainers/RigidSet/RigidSet+Insertions.swift b/Sources/BasicContainers/RigidSet/RigidSet+Insertions.swift index 35e6c629..99d5cb2b 100644 --- a/Sources/BasicContainers/RigidSet/RigidSet+Insertions.swift +++ b/Sources/BasicContainers/RigidSet/RigidSet+Insertions.swift @@ -223,11 +223,11 @@ extension RigidSet /* where Element: Copyable */ { #if UnstableContainersPreview @_alwaysEmitIntoClient package mutating func _insert< - S: BorrowingSequence_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >( copying items: borrowing S ) { - var it = items.makeBorrowingIterator_() + var it = items.makeIterableIterator_() while true { let span = it.nextSpan_() guard !span.isEmpty else { break } @@ -240,7 +240,7 @@ extension RigidSet /* where Element: Copyable */ { @_alwaysEmitIntoClient @inline(__always) public mutating func insert< - S: BorrowingSequence_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >( copying items: borrowing S ) { @@ -261,7 +261,7 @@ extension RigidSet /* where Element: Copyable */ { @_alwaysEmitIntoClient @inline(__always) public mutating func insert< - S: BorrowingSequence_ & Sequence + S: Iterable_ & Sequence >( copying items: borrowing S ) { diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Append.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Append.swift index 7f2ace56..7a2f99bc 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Append.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Append.swift @@ -310,12 +310,12 @@ extension UniqueArray { #if compiler(>=6.4) && UnstableContainersPreview @inlinable internal mutating func _append< - Source: BorrowingSequence_ & ~Copyable & ~Escapable + Source: Iterable_ & ~Copyable & ~Escapable >( copying newElements: borrowing Source ) { _ensureFreeCapacity(newElements.underestimatedCount_) - var it = newElements.makeBorrowingIterator_() + var it = newElements.makeIterableIterator_() while true { let span = it.nextSpan_() if span.isEmpty { break } @@ -343,7 +343,7 @@ extension UniqueArray { @_alwaysEmitIntoClient @inline(__always) public mutating func append< - Source: BorrowingSequence_ & ~Copyable & ~Escapable + Source: Iterable_ & ~Copyable & ~Escapable >( copying newElements: borrowing Source ) { @@ -397,7 +397,7 @@ extension UniqueArray { @_alwaysEmitIntoClient @inline(__always) public mutating func append< - Source: BorrowingSequence_ & Sequence + Source: Iterable_ & Sequence >(copying newElements: Source) { self._append(copying: newElements) } diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Container.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Container.swift index cdd6b0b8..8b8fd3e9 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Container.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Container.swift @@ -20,16 +20,16 @@ import ContainersPreview #if compiler(>=6.4) && UnstableContainersPreview @available(SwiftStdlib 5.0, *) -extension UniqueArray: BorrowingSequence_ where Element: ~Copyable { - public typealias BorrowingIterator_ = RigidArray.BorrowingIterator_ +extension UniqueArray: Iterable_ where Element: ~Copyable { + public typealias IterableIterator_ = RigidArray.IterableIterator_ @inlinable public var underestimatedCount_: Int { count } @_alwaysEmitIntoClient @inline(__always) - public func makeBorrowingIterator_() -> BorrowingIterator_ { - self._storage.makeBorrowingIterator_() + public func makeIterableIterator_() -> IterableIterator_ { + self._storage.makeIterableIterator_() } } #endif diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Initializers.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Initializers.swift index fe89831e..26faa3a9 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Initializers.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Initializers.swift @@ -96,7 +96,7 @@ extension UniqueArray /*where Element: Copyable*/ { /// The sequence must not contain more than `capacity` elements. @_alwaysEmitIntoClient @inline(__always) - public init & ~Copyable & ~Escapable>( + public init & ~Copyable & ~Escapable>( capacity: Int? = nil, copying contents: borrowing Source ) { @@ -132,7 +132,7 @@ extension UniqueArray /*where Element: Copyable*/ { /// - contents: The container whose contents to copy into the new array. @_alwaysEmitIntoClient @inline(__always) - public init & Sequence>( + public init & Sequence>( capacity: Int? = nil, copying contents: Source ) { diff --git a/Sources/BasicContainers/UniqueSet/UniqueSet+BorrowingSequence.swift b/Sources/BasicContainers/UniqueSet/UniqueSet+BorrowingSequence.swift index 7f842356..549c415e 100644 --- a/Sources/BasicContainers/UniqueSet/UniqueSet+BorrowingSequence.swift +++ b/Sources/BasicContainers/UniqueSet/UniqueSet+BorrowingSequence.swift @@ -19,9 +19,9 @@ import ContainersPreview #if compiler(>=6.4) && UnstableHashedContainers && UnstableContainersPreview @available(SwiftStdlib 5.0, *) -extension UniqueSet: BorrowingSequence_ where Element: ~Copyable { +extension UniqueSet: Iterable_ where Element: ~Copyable { public typealias Element_ = Element - public typealias BorrowingIterator_ = RigidSet.BorrowingIterator_ + public typealias IterableIterator_ = RigidSet.IterableIterator_ @inlinable public var underestimatedCount_: Int { count } @@ -35,8 +35,8 @@ extension UniqueSet: BorrowingSequence_ where Element: ~Copyable { @inlinable @_lifetime(borrow self) - public borrowing func makeBorrowingIterator_() -> BorrowingIterator_ { - BorrowingIterator_(_set: _storage) + public borrowing func makeIterableIterator_() -> IterableIterator_ { + IterableIterator_(_set: _storage) } } #endif diff --git a/Sources/BasicContainers/UniqueSet/UniqueSet+Initializers.swift b/Sources/BasicContainers/UniqueSet/UniqueSet+Initializers.swift index 86c4b8f0..2b2639de 100644 --- a/Sources/BasicContainers/UniqueSet/UniqueSet+Initializers.swift +++ b/Sources/BasicContainers/UniqueSet/UniqueSet+Initializers.swift @@ -77,7 +77,7 @@ extension UniqueSet where Element: Copyable { #if UnstableContainersPreview @_alwaysEmitIntoClient public init< - S: BorrowingSequence_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >( copying items: borrowing S ) { @@ -95,7 +95,7 @@ extension UniqueSet where Element: Copyable { #if UnstableContainersPreview @_alwaysEmitIntoClient public init< - S: BorrowingSequence_ & Sequence + S: Iterable_ & Sequence >( copying items: borrowing S ) { diff --git a/Sources/BasicContainers/UniqueSet/UniqueSet+Insertions.swift b/Sources/BasicContainers/UniqueSet/UniqueSet+Insertions.swift index 60979e0e..8e1fbf13 100644 --- a/Sources/BasicContainers/UniqueSet/UniqueSet+Insertions.swift +++ b/Sources/BasicContainers/UniqueSet/UniqueSet+Insertions.swift @@ -132,12 +132,12 @@ extension UniqueSet /* where Element: Copyable */ { #if UnstableContainersPreview @_alwaysEmitIntoClient package mutating func _insert< - S: BorrowingSequence_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >( copying items: borrowing S ) { _ensureFreeCapacity(items.underestimatedCount_) - var it = items.makeBorrowingIterator_() + var it = items.makeIterableIterator_() while true { let span = it.nextSpan_() guard !span.isEmpty else { break } @@ -150,7 +150,7 @@ extension UniqueSet /* where Element: Copyable */ { @_alwaysEmitIntoClient @inline(__always) public mutating func insert< - S: BorrowingSequence_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >( copying items: borrowing S ) { @@ -172,7 +172,7 @@ extension UniqueSet /* where Element: Copyable */ { @_alwaysEmitIntoClient @inline(__always) public mutating func insert< - S: BorrowingSequence_ & Sequence + S: Iterable_ & Sequence >( copying items: borrowing S ) { diff --git a/Sources/ContainersPreview/Protocols/Container/Container+Filter.swift b/Sources/ContainersPreview/Protocols/Container/Container+Filter.swift index 0d5ced03..685160db 100644 --- a/Sources/ContainersPreview/Protocols/Container/Container+Filter.swift +++ b/Sources/ContainersPreview/Protocols/Container/Container+Filter.swift @@ -86,7 +86,7 @@ where Base.Element: ~Copyable // FIXME: Sendable @available(SwiftStdlib 5.0, *) -extension ContainerFilter: BorrowingIteratorProtocol_ where Element: ~Copyable { +extension ContainerFilter: IterableIteratorProtocol_ where Element: ~Copyable { public typealias Element_ = Base.Element @_lifetime(&self) // FIXME: This should be `@_lifetime(copy self)` diff --git a/Sources/ContainersPreview/Protocols/Container/Container.swift b/Sources/ContainersPreview/Protocols/Container/Container.swift index ae4443a1..0ec3829a 100644 --- a/Sources/ContainersPreview/Protocols/Container/Container.swift +++ b/Sources/ContainersPreview/Protocols/Container/Container.swift @@ -15,7 +15,7 @@ @available(SwiftStdlib 5.0, *) public protocol Container: - BorrowingSequence_, ~Copyable, ~Escapable + Iterable_, ~Copyable, ~Escapable where Element: ~Copyable, Element == Element_ { associatedtype Element: ~Copyable diff --git a/Sources/ContainersPreview/Protocols/Container/ContainerIterator.swift b/Sources/ContainersPreview/Protocols/Container/ContainerIterator.swift index 7e68abe0..41c4dc96 100644 --- a/Sources/ContainersPreview/Protocols/Container/ContainerIterator.swift +++ b/Sources/ContainersPreview/Protocols/Container/ContainerIterator.swift @@ -18,10 +18,10 @@ extension Container where Self: ~Copyable /*FIXME: & ~Escapable*/, Element: ~Copyable, - BorrowingIterator_ == ContainerIterator + IterableIterator_ == ContainerIterator { @_lifetime(borrow self) - public func makeBorrowingIterator_() -> BorrowingIterator_ { + public func makeIterableIterator_() -> IterableIterator_ { ContainerIterator(_borrowing: self, from: self.startIndex) } } @@ -45,7 +45,7 @@ where Base.Element: ~Copyable } @available(SwiftStdlib 5.0, *) -extension ContainerIterator: BorrowingIteratorProtocol_ +extension ContainerIterator: IterableIteratorProtocol_ where Base: ~Copyable /*FIXME: & ~Escapable*/, Base.Element: ~Copyable diff --git a/Sources/ContainersPreview/Protocols/Container/RangeReplaceableContainer.swift b/Sources/ContainersPreview/Protocols/Container/RangeReplaceableContainer.swift index 44c8045a..1dc54bbd 100644 --- a/Sources/ContainersPreview/Protocols/Container/RangeReplaceableContainer.swift +++ b/Sources/ContainersPreview/Protocols/Container/RangeReplaceableContainer.swift @@ -427,11 +427,11 @@ where @inlinable public mutating func append< - S: BorrowingSequence_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >( copying items: borrowing S ) { - var it = items.makeBorrowingIterator_() + var it = items.makeIterableIterator_() while true { let span = it.nextSpan_() guard !span.isEmpty else { break } diff --git a/Sources/ContainersPreview/Protocols/BorrowingSequence+Algorithms.swift b/Sources/ContainersPreview/Protocols/Iterable+Algorithms.swift similarity index 80% rename from Sources/ContainersPreview/Protocols/BorrowingSequence+Algorithms.swift rename to Sources/ContainersPreview/Protocols/Iterable+Algorithms.swift index 37af4bec..1e407ac8 100644 --- a/Sources/ContainersPreview/Protocols/BorrowingSequence+Algorithms.swift +++ b/Sources/ContainersPreview/Protocols/Iterable+Algorithms.swift @@ -14,7 +14,7 @@ #if compiler(>=6.4) && UnstableContainersPreview @available(SwiftStdlib 5.0, *) -extension BorrowingSequence_ +extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable { @inlinable @@ -23,7 +23,7 @@ extension BorrowingSequence_ _ nextPartialResult: (_ partialResult: consuming Result, borrowing Element_) throws -> Result ) rethrows -> Result { - try makeBorrowingIterator_().reduce(initialResult, nextPartialResult) + try makeIterableIterator_().reduce(initialResult, nextPartialResult) } @inlinable @@ -32,19 +32,19 @@ extension BorrowingSequence_ _ updateAccumulatingResult: (_ partialResult: inout Result, borrowing Element_) throws -> () ) rethrows -> Result { - try makeBorrowingIterator_().reduce(into: initialResult, updateAccumulatingResult) + try makeIterableIterator_().reduce(into: initialResult, updateAccumulatingResult) } } // Ambiguity breakers @available(SwiftStdlib 5.0, *) -extension Sequence where Self: BorrowingSequence_ { +extension Sequence where Self: Iterable_ { public func reduce( _ initialResult: consuming Result, _ nextPartialResult: (_ partialResult: consuming Result, borrowing Element_) throws -> Result ) rethrows -> Result { - try makeBorrowingIterator_().reduce(initialResult, nextPartialResult) + try makeIterableIterator_().reduce(initialResult, nextPartialResult) } @inlinable @@ -53,24 +53,24 @@ extension Sequence where Self: BorrowingSequence_ { _ updateAccumulatingResult: (_ partialResult: inout Result, borrowing Element_) throws -> () ) rethrows -> Result { - try makeBorrowingIterator_().reduce(into: initialResult, updateAccumulatingResult) + try makeIterableIterator_().reduce(into: initialResult, updateAccumulatingResult) } } @available(SwiftStdlib 5.0, *) -extension BorrowingSequence_ +extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable { @inlinable - public func elementsEqual( + public func elementsEqual( _ other: borrowing OtherSequence, by areEquivalent: (borrowing Element_, borrowing OtherSequence.Element_) throws -> Bool ) rethrows -> Bool where OtherSequence: ~Copyable & ~Escapable, OtherSequence.Element_: ~Copyable { // FIXME: Forward to the iterator's implementation of same - var iter1 = makeBorrowingIterator_() - var iter2 = other.makeBorrowingIterator_() + var iter1 = makeIterableIterator_() + var iter2 = other.makeIterableIterator_() while true { var el1 = iter1.nextSpan_() @@ -93,10 +93,10 @@ extension BorrowingSequence_ } @available(SwiftStdlib 5.0, *) -extension BorrowingSequence_ +extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable & Equatable { @inlinable - public func elementsEqual>( + public func elementsEqual>( _ other: borrowing OtherSequence ) -> Bool where diff --git a/Sources/ContainersPreview/Protocols/BorrowingSequence+Standard Conformances.swift b/Sources/ContainersPreview/Protocols/Iterable+Standard Conformances.swift similarity index 75% rename from Sources/ContainersPreview/Protocols/BorrowingSequence+Standard Conformances.swift rename to Sources/ContainersPreview/Protocols/Iterable+Standard Conformances.swift index c0ed1d80..d835a892 100644 --- a/Sources/ContainersPreview/Protocols/BorrowingSequence+Standard Conformances.swift +++ b/Sources/ContainersPreview/Protocols/Iterable+Standard Conformances.swift @@ -14,8 +14,8 @@ #if compiler(>=6.4) && UnstableContainersPreview @available(SwiftStdlib 5.0, *) -extension Span: BorrowingSequence_ where Element: ~Copyable { - public typealias BorrowingIterator_ = SpanIterator +extension Span: Iterable_ where Element: ~Copyable { + public typealias IterableIterator_ = SpanIterator public typealias Element_ = Element @inlinable @@ -23,21 +23,21 @@ extension Span: BorrowingSequence_ where Element: ~Copyable { @_lifetime(borrow self) @inlinable - public func makeBorrowingIterator_() -> SpanIterator { + public func makeIterableIterator_() -> SpanIterator { SpanIterator(self) } } @available(SwiftStdlib 5.0, *) -extension MutableSpan: BorrowingSequence_ where Element: ~Copyable { - public typealias BorrowingIterator_ = SpanIterator +extension MutableSpan: Iterable_ where Element: ~Copyable { + public typealias IterableIterator_ = SpanIterator @inlinable public var underestimatedCount_: Int { count } @_lifetime(borrow self) @inlinable - public func makeBorrowingIterator_() -> SpanIterator { + public func makeIterableIterator_() -> SpanIterator { // FIXME: This should be declared to return BorrowingIterator, but it // clashes with the stdlib's alternate definition: // error: 'BorrowingIterator' is ambiguous for type lookup in this context @@ -47,57 +47,57 @@ extension MutableSpan: BorrowingSequence_ where Element: ~Copyable { } @available(SwiftStdlib 5.0, *) -extension OutputSpan: BorrowingSequence_ where Element: ~Copyable { - public typealias BorrowingIterator_ = SpanIterator +extension OutputSpan: Iterable_ where Element: ~Copyable { + public typealias IterableIterator_ = SpanIterator @inlinable public var underestimatedCount_: Int { count } @_lifetime(borrow self) @inlinable - public func makeBorrowingIterator_() -> BorrowingIterator_ { + public func makeIterableIterator_() -> IterableIterator_ { SpanIterator(self.span) } } @available(SwiftStdlib 5.0, *) -extension InputSpan: BorrowingSequence_ where Element: ~Copyable { - public typealias BorrowingIterator_ = SpanIterator +extension InputSpan: Iterable_ where Element: ~Copyable { + public typealias IterableIterator_ = SpanIterator @inlinable public var underestimatedCount_: Int { count } @_lifetime(borrow self) @inlinable - public func makeBorrowingIterator_() -> BorrowingIterator_ { + public func makeIterableIterator_() -> IterableIterator_ { SpanIterator(self.span) } } @available(SwiftStdlib 6.2, *) -extension Array: BorrowingSequence_ { - public typealias BorrowingIterator_ = SpanIterator +extension Array: Iterable_ { + public typealias IterableIterator_ = SpanIterator @inlinable public var underestimatedCount_: Int { count } @_lifetime(borrow self) @inlinable - public func makeBorrowingIterator_() -> BorrowingIterator_ { + public func makeIterableIterator_() -> IterableIterator_ { SpanIterator(self.span) } } @available(SwiftStdlib 6.2, *) -extension InlineArray: BorrowingSequence_ where Element: ~Copyable { - public typealias BorrowingIterator_ = SpanIterator +extension InlineArray: Iterable_ where Element: ~Copyable { + public typealias IterableIterator_ = SpanIterator @inlinable public var underestimatedCount_: Int { count } @_lifetime(borrow self) @inlinable - public func makeBorrowingIterator_() -> SpanIterator { + public func makeIterableIterator_() -> SpanIterator { // FIXME: This should be declared to return BorrowingIterator, but it // clashes with the stdlib's alternate definition: // error: 'BorrowingIterator' is ambiguous for type lookup in this context @@ -107,13 +107,13 @@ extension InlineArray: BorrowingSequence_ where Element: ~Copyable { } @available(SwiftStdlib 6.2, *) -extension Range: BorrowingSequence_ +extension Range: Iterable_ where Bound: Strideable, Bound.Stride: SignedInteger { public typealias Element = Bound @frozen - public struct BorrowingIterator_: BorrowingIteratorProtocol_, ~Copyable { + public struct IterableIterator_: IterableIteratorProtocol_, ~Copyable { @usableFromInline internal var _current: InlineArray<1, Bound> @@ -157,19 +157,19 @@ where Bound: Strideable, Bound.Stride: SignedInteger public var underestimatedCount_: Int { _borrowingUnderestimatedCount } @inlinable - public func makeBorrowingIterator_() -> BorrowingIterator_ { - BorrowingIterator_(self) + public func makeIterableIterator_() -> IterableIterator_ { + IterableIterator_(self) } } @available(SwiftStdlib 6.2, *) -extension ClosedRange: BorrowingSequence_ +extension ClosedRange: Iterable_ where Bound: Strideable, Bound.Stride: SignedInteger { public typealias Element = Bound @frozen - public struct BorrowingIterator_: BorrowingIteratorProtocol_, ~Copyable { + public struct IterableIterator_: IterableIteratorProtocol_, ~Copyable { @usableFromInline internal var _current: InlineArray<1, Bound> @@ -214,8 +214,8 @@ where Bound: Strideable, Bound.Stride: SignedInteger public var underestimatedCount_: Int { _borrowingUnderestimatedCount } @inlinable - public func makeBorrowingIterator_() -> BorrowingIterator_ { - BorrowingIterator_(self) + public func makeIterableIterator_() -> IterableIterator_ { + IterableIterator_(self) } } diff --git a/Sources/ContainersPreview/Protocols/BorrowingSequence+Utilities.swift b/Sources/ContainersPreview/Protocols/Iterable+Utilities.swift similarity index 90% rename from Sources/ContainersPreview/Protocols/BorrowingSequence+Utilities.swift rename to Sources/ContainersPreview/Protocols/Iterable+Utilities.swift index 39357237..995c3cbf 100644 --- a/Sources/ContainersPreview/Protocols/BorrowingSequence+Utilities.swift +++ b/Sources/ContainersPreview/Protocols/Iterable+Utilities.swift @@ -18,13 +18,13 @@ import InternalCollectionsUtilities #if compiler(>=6.4) && UnstableContainersPreview @available(SwiftStdlib 5.0, *) -extension BorrowingSequence_ where Self: ~Copyable & ~Escapable, Element_: Copyable { +extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: Copyable { @inlinable package func _copyContents( intoPrefixOf buffer: UnsafeMutableBufferPointer ) -> Int { var target = buffer - var it = self.makeBorrowingIterator_() + var it = self.makeIterableIterator_() while target.count != 0 { let span = it.nextSpan_(maximumCount: target.count) if span.isEmpty { diff --git a/Sources/ContainersPreview/Protocols/BorrowingSequence.swift b/Sources/ContainersPreview/Protocols/Iterable.swift similarity index 81% rename from Sources/ContainersPreview/Protocols/BorrowingSequence.swift rename to Sources/ContainersPreview/Protocols/Iterable.swift index 6c961716..735123bd 100644 --- a/Sources/ContainersPreview/Protocols/BorrowingSequence.swift +++ b/Sources/ContainersPreview/Protocols/Iterable.swift @@ -14,14 +14,14 @@ #if compiler(>=6.4) && UnstableContainersPreview @available(SwiftStdlib 5.0, *) -public protocol BorrowingSequence_: ~Copyable, ~Escapable { +public protocol Iterable_: ~Copyable, ~Escapable { associatedtype Element_: ~Copyable - associatedtype BorrowingIterator_: BorrowingIteratorProtocol_ & ~Copyable & ~Escapable + associatedtype IterableIterator_: IterableIteratorProtocol_ & ~Copyable & ~Escapable var underestimatedCount_: Int { get } @_lifetime(borrow self) - borrowing func makeBorrowingIterator_() -> BorrowingIterator_ + borrowing func makeIterableIterator_() -> IterableIterator_ func _customContainsEquatableElement_( _ element: borrowing Element_ @@ -29,7 +29,7 @@ public protocol BorrowingSequence_: ~Copyable, ~Escapable { } @available(SwiftStdlib 5.0, *) -extension BorrowingSequence_ +extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable { @@ -43,7 +43,7 @@ where } @available(SwiftStdlib 5.0, *) -extension BorrowingSequence_ where Self: Sequence { +extension Iterable_ where Self: Sequence { @inlinable public func _customContainsEquatableElement_(_ element: borrowing Element) -> Bool? { nil @@ -51,7 +51,7 @@ extension BorrowingSequence_ where Self: Sequence { } @available(SwiftStdlib 5.0, *) -extension BorrowingSequence_ +extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable @@ -61,7 +61,7 @@ where public func _borrowingForEach( _ body: (borrowing Element_) throws(E) -> Void ) throws(E) -> Void { - var it = makeBorrowingIterator_() + var it = makeIterableIterator_() while true { let span = it.nextSpan_() if span.isEmpty { break } diff --git a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Copy.swift b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Copy.swift similarity index 98% rename from Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Copy.swift rename to Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Copy.swift index ed3adc60..fc95808f 100644 --- a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Copy.swift +++ b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Copy.swift @@ -14,7 +14,7 @@ #if compiler(>=6.4) && UnstableContainersPreview @available(SwiftStdlib 5.0, *) -extension BorrowingIteratorProtocol_ +extension IterableIteratorProtocol_ where Self: ~Copyable & ~Escapable, Element_: Copyable diff --git a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+ElementsEqual.swift b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+ElementsEqual.swift similarity index 89% rename from Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+ElementsEqual.swift rename to Sources/ContainersPreview/Protocols/IterableIteratorProtocol+ElementsEqual.swift index d9de4204..08a67ea5 100644 --- a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+ElementsEqual.swift +++ b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+ElementsEqual.swift @@ -18,27 +18,27 @@ import InternalCollectionsUtilities #if compiler(>=6.4) && UnstableContainersPreview @available(SwiftStdlib 5.0, *) -extension BorrowingSequence_ +extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: Equatable, Element_: ~Copyable { @inlinable package func _elementsEqual< - Other: BorrowingSequence_ & ~Copyable & ~Escapable + Other: Iterable_ & ~Copyable & ~Escapable >( _ other: borrowing Other, ) -> Bool where Other.Element_: ~Copyable { - let it1 = self.makeBorrowingIterator_() - let it2 = other.makeBorrowingIterator_() + let it1 = self.makeIterableIterator_() + let it2 = other.makeIterableIterator_() return it1.elementsEqual(it2) } } @available(SwiftStdlib 5.0, *) -extension BorrowingSequence_ +extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable @@ -67,28 +67,28 @@ where @inlinable package func _elementsEqual< E: Error, - Other: BorrowingSequence_ & ~Copyable & ~Escapable + Other: Iterable_ & ~Copyable & ~Escapable >( _ other: borrowing Other, by areEquivalent: (borrowing Element_, borrowing Other.Element_) throws(E) -> Bool ) throws(E) -> Bool where Other.Element_: ~Copyable { - let it1 = self.makeBorrowingIterator_() - let it2 = other.makeBorrowingIterator_() + let it1 = self.makeIterableIterator_() + let it2 = other.makeIterableIterator_() return try it1.elementsEqual(it2, by: areEquivalent) } } @available(SwiftStdlib 5.0, *) -extension BorrowingIteratorProtocol_ +extension IterableIteratorProtocol_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable & Equatable { @inlinable package consuming func elementsEqual< - Other: BorrowingIteratorProtocol_ & ~Copyable & ~Escapable + Other: IterableIteratorProtocol_ & ~Copyable & ~Escapable >( _ other: consuming Other, ) -> Bool @@ -114,7 +114,7 @@ where @inlinable package consuming func _directElementsEqual< - Other: BorrowingIteratorProtocol_ & ~Copyable & ~Escapable + Other: IterableIteratorProtocol_ & ~Copyable & ~Escapable >( _ other: consuming Other, ) -> Bool @@ -175,7 +175,7 @@ where } @available(SwiftStdlib 5.0, *) -extension BorrowingIteratorProtocol_ +extension IterableIteratorProtocol_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable @@ -183,7 +183,7 @@ where @inlinable package consuming func elementsEqual< E: Error, - Other: BorrowingIteratorProtocol_ & ~Copyable & ~Escapable + Other: IterableIteratorProtocol_ & ~Copyable & ~Escapable >( _ other: consuming Other, by areEquivalent: (borrowing Element_, borrowing Other.Element_) throws(E) -> Bool diff --git a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Filter.swift b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Filter.swift similarity index 92% rename from Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Filter.swift rename to Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Filter.swift index fad81bc8..293f8be7 100644 --- a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Filter.swift +++ b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Filter.swift @@ -14,7 +14,7 @@ #if compiler(>=6.4) && UnstableContainersPreview @available(SwiftStdlib 5.0, *) -extension BorrowingIteratorProtocol_ +extension IterableIteratorProtocol_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable @@ -30,7 +30,7 @@ where @available(SwiftStdlib 5.0, *) public struct BorrowingFilter< - Base: BorrowingIteratorProtocol_ & ~Copyable & ~Escapable + Base: IterableIteratorProtocol_ & ~Copyable & ~Escapable >: ~Copyable, ~Escapable where Base.Element_: ~Copyable { public typealias Element_ = Base.Element_ @@ -55,7 +55,7 @@ where Base.Element_: ~Copyable { // FIXME: Sendable @available(SwiftStdlib 5.0, *) -extension BorrowingFilter: BorrowingIteratorProtocol_ +extension BorrowingFilter: IterableIteratorProtocol_ where Base: ~Copyable & ~Escapable, Base.Element_: ~Copyable { @_lifetime(&self) public mutating func nextSpan_(maximumCount: Int) -> Span { diff --git a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Map.swift b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Map.swift similarity index 96% rename from Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Map.swift rename to Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Map.swift index 342a5972..ccfdd7f0 100644 --- a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Map.swift +++ b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Map.swift @@ -14,7 +14,7 @@ #if compiler(>=6.4) && UnstableContainersPreview @available(SwiftStdlib 5.0, *) -extension BorrowingIteratorProtocol_ +extension IterableIteratorProtocol_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable @@ -30,7 +30,7 @@ where @available(SwiftStdlib 5.0, *) public struct BorrowingMapProducer< - Base: BorrowingIteratorProtocol_ & ~Copyable & ~Escapable, + Base: IterableIteratorProtocol_ & ~Copyable & ~Escapable, Element: ~Copyable, Error: Swift.Error >: ~Copyable, ~Escapable { diff --git a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Reduce.swift b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Reduce.swift similarity index 97% rename from Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Reduce.swift rename to Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Reduce.swift index 9e78630b..20cc9b22 100644 --- a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Reduce.swift +++ b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+Reduce.swift @@ -14,7 +14,7 @@ #if compiler(>=6.4) && UnstableContainersPreview @available(SwiftStdlib 5.0, *) -extension BorrowingIteratorProtocol_ +extension IterableIteratorProtocol_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable diff --git a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+SpanwiseZip.swift b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+SpanwiseZip.swift similarity index 96% rename from Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+SpanwiseZip.swift rename to Sources/ContainersPreview/Protocols/IterableIteratorProtocol+SpanwiseZip.swift index 05c57b92..0fe44983 100644 --- a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+SpanwiseZip.swift +++ b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol+SpanwiseZip.swift @@ -18,14 +18,14 @@ import InternalCollectionsUtilities #if compiler(>=6.4) && UnstableContainersPreview @available(SwiftStdlib 5.0, *) -extension BorrowingIteratorProtocol_ +extension IterableIteratorProtocol_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable { @inlinable internal consuming func _spanwiseZip< - Other: BorrowingIteratorProtocol_ & ~Copyable & ~Escapable, + Other: IterableIteratorProtocol_ & ~Copyable & ~Escapable, State: ~Copyable, E: Error >( state: inout State, diff --git a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol.swift b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol.swift similarity index 95% rename from Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol.swift rename to Sources/ContainersPreview/Protocols/IterableIteratorProtocol.swift index 7fdf6b38..409e18c7 100644 --- a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol.swift +++ b/Sources/ContainersPreview/Protocols/IterableIteratorProtocol.swift @@ -18,7 +18,7 @@ import InternalCollectionsUtilities #endif @available(SwiftStdlib 5.0, *) -public protocol BorrowingIteratorProtocol_: ~Copyable, ~Escapable { +public protocol IterableIteratorProtocol_: ~Copyable, ~Escapable { associatedtype Element_: ~Copyable /// Advance the iterator, returning an ephemeral span over the elements @@ -85,7 +85,7 @@ public protocol BorrowingIteratorProtocol_: ~Copyable, ~Escapable { } @available(SwiftStdlib 5.0, *) -extension BorrowingIteratorProtocol_ +extension IterableIteratorProtocol_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable { @_lifetime(&self) @_lifetime(self: copy self) @@ -96,7 +96,7 @@ where Self: ~Copyable & ~Escapable, Element_: ~Copyable { } @available(SwiftStdlib 5.0, *) -extension BorrowingIteratorProtocol_ +extension IterableIteratorProtocol_ where Self: ~Copyable & ~Escapable, Element_: ~Copyable { @_lifetime(self: copy self) @inlinable @@ -112,7 +112,7 @@ where Self: ~Copyable & ~Escapable, Element_: ~Copyable { } @available(SwiftStdlib 5.0, *) -extension BorrowingIteratorProtocol_ where Self: ~Copyable & ~Escapable { +extension IterableIteratorProtocol_ where Self: ~Copyable & ~Escapable { #if false // FIXME: This doesn't work, but it should? @_lifetime(&self) @_lifetime(self: copy self) @@ -125,7 +125,7 @@ extension BorrowingIteratorProtocol_ where Self: ~Copyable & ~Escapable { } @available(SwiftStdlib 5.0, *) -extension BorrowingIteratorProtocol_ +extension IterableIteratorProtocol_ where Self: ~Copyable & ~Escapable, Element_: Copyable { @_lifetime(self: copy self) diff --git a/Sources/ContainersPreview/Types/SpanIterator.swift b/Sources/ContainersPreview/Types/SpanIterator.swift index a5513c27..0eb1867e 100644 --- a/Sources/ContainersPreview/Types/SpanIterator.swift +++ b/Sources/ContainersPreview/Types/SpanIterator.swift @@ -16,7 +16,7 @@ /// A borrowing iterator that provides access to the elements of a single /// span through a `BorrowingIteratorProtocol` interface. @available(SwiftStdlib 5.0, *) -public struct SpanIterator: BorrowingIteratorProtocol_, ~Copyable, ~Escapable +public struct SpanIterator: IterableIteratorProtocol_, ~Copyable, ~Escapable where Element_: ~Copyable { @usableFromInline diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Append.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Append.swift index c8916110..ee169e94 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Append.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Append.swift @@ -313,9 +313,9 @@ extension RigidDeque /*where Element: Copyable*/ { #if compiler(>=6.4) && UnstableContainersPreview @_alwaysEmitIntoClient internal mutating func _append< - S: BorrowingSequence_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >(copying items: borrowing S) { - var it = items.makeBorrowingIterator_() + var it = items.makeIterableIterator_() while true { let span = it.nextSpan_() if span.isEmpty { break } @@ -334,7 +334,7 @@ extension RigidDeque /*where Element: Copyable*/ { /// /// - Complexity: O(*m*), where *m* is the length of `newElements`. @_alwaysEmitIntoClient - public mutating func append & ~Copyable & ~Escapable>( + public mutating func append & ~Copyable & ~Escapable>( copying newElements: borrowing S ) { self._append(copying: newElements) @@ -375,7 +375,7 @@ extension RigidDeque /*where Element: Copyable*/ { /// - Complexity: O(*m*), where *m* is the length of `items`. @available(SwiftStdlib 5.0, *) @_alwaysEmitIntoClient public mutating func append< - S: BorrowingSequence_ & Sequence + S: Iterable_ & Sequence >( copying items: S ) { diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Container.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Container.swift index d729769c..f6222044 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Container.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Container.swift @@ -23,7 +23,7 @@ import ContainersPreview extension RigidDeque where Element: ~Copyable { #if compiler(>=6.4) && UnstableContainersPreview @frozen - public struct BorrowingIterator: ~Escapable, BorrowingIteratorProtocol_ { + public struct BorrowingIterator: ~Escapable, IterableIteratorProtocol_ { public typealias Element_ = Element @usableFromInline @@ -60,7 +60,7 @@ extension RigidDeque where Element: ~Copyable { @_alwaysEmitIntoClient @_lifetime(borrow self) - public borrowing func makeBorrowingIterator_() -> BorrowingIterator { + public borrowing func makeIterableIterator_() -> BorrowingIterator { BorrowingIterator(_deque: self) } #endif diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Initializers.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Initializers.swift index ef924870..79bedde8 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Initializers.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Initializers.swift @@ -132,7 +132,7 @@ extension RigidDeque /*where Element: Copyable*/ { @_alwaysEmitIntoClient @inline(__always) public init< - S: BorrowingSequence_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >( capacity: Int, copying contents: borrowing S @@ -187,7 +187,7 @@ extension RigidDeque /*where Element: Copyable*/ { @_alwaysEmitIntoClient @inline(__always) public init< - S: BorrowingSequence_ & Sequence + S: Iterable_ & Sequence >( capacity: Int, copying contents: borrowing S @@ -208,7 +208,7 @@ extension RigidDeque /*where Element: Copyable*/ { @_alwaysEmitIntoClient @inline(__always) public init< - S: BorrowingSequence_ & Collection + S: Iterable_ & Collection >( capacity: Int? = nil, copying contents: S diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Insertions.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Insertions.swift index 19a07eb8..046e1766 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Insertions.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Insertions.swift @@ -365,7 +365,7 @@ extension RigidDeque /* where Element: Copyable */ { newCount: Int ) { let expectedCount = self.count + newCount - var it = items.makeBorrowingIterator_() + var it = items.makeIterableIterator_() insert(addingCount: newCount, at: index) { target in it._copyContents_(into: &target) } diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift index 171e8c94..45c1556e 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift @@ -290,13 +290,13 @@ extension RigidDeque /*where Element: Copyable*/ { #if compiler(>=6.4) && UnstableContainersPreview @inlinable internal mutating func _prepend< - S: BorrowingSequence_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >(copying items: borrowing S) { // We don't know the exact count of new elements, so we cannot initialize // them in place. Append them to the end of the deque first, then rotate // them to their correct location. // - // FIXME: If we get a BorrowingSequence_.estimatedCount with an exact case, + // FIXME: If we get a Iterable_.estimatedCount with an exact case, // then we should use that when possible to copy items to their final // location in a single pass. let oldCount = self.count @@ -306,12 +306,12 @@ extension RigidDeque /*where Element: Copyable*/ { @inlinable internal mutating func _prepend< - S: BorrowingSequence_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >( copying items: borrowing S, exactCount: Int ) { - var it = items.makeBorrowingIterator_() + var it = items.makeIterableIterator_() self.prepend(addingCount: exactCount) { target in let span = it.nextSpan_(maximumCount: target.freeCapacity) target._append(copying: span) @@ -333,7 +333,7 @@ extension RigidDeque /*where Element: Copyable*/ { /// /// - Complexity: O(*m*), where *m* is the length of `items`. @_alwaysEmitIntoClient - public mutating func prepend & ~Copyable & ~Escapable>( + public mutating func prepend & ~Copyable & ~Escapable>( copying items: borrowing S ) { self._prepend(copying: items) @@ -437,7 +437,7 @@ extension RigidDeque /*where Element: Copyable*/ { /// /// - Complexity: O(*m*), where *m* is the length of `items`. @_alwaysEmitIntoClient - public mutating func prepend & Sequence>( + public mutating func prepend & Sequence>( copying items: borrowing S ) { self._prepend(copying: items) @@ -453,7 +453,7 @@ extension RigidDeque /*where Element: Copyable*/ { /// /// - Complexity: O(*m*), where *m* is the length of `items`. @_alwaysEmitIntoClient - public mutating func prepend & Collection>( + public mutating func prepend & Collection>( copying items: borrowing S ) { self._prepend(copying: items, exactCount: items.count) diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Replacements.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Replacements.swift index 19e96708..e9d592a4 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Replacements.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Replacements.swift @@ -466,7 +466,7 @@ extension RigidDeque /* where Element: Copyable */ { ) { let expectedCount = self.count - subrange.count + newCount - var it = items.makeBorrowingIterator_() + var it = items.makeIterableIterator_() self.replace(removing: subrange, addingCount: newCount) { target in it._copyContents_(into: &target) } diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Append.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Append.swift index 59e86a97..f598555f 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Append.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Append.swift @@ -300,9 +300,9 @@ extension UniqueDeque /*where Element: Copyable*/ { #if compiler(>=6.4) && UnstableContainersPreview @_alwaysEmitIntoClient internal mutating func _append< - S: BorrowingSequence_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >(copying items: borrowing S) { - var it = items.makeBorrowingIterator_() + var it = items.makeIterableIterator_() while true { let span = it.nextSpan_() if span.isEmpty { break } @@ -323,7 +323,7 @@ extension UniqueDeque /*where Element: Copyable*/ { /// - Complexity: O(*m*), where *m* is the length of `items`, when amortized /// over many similar invocations on the same deque @_alwaysEmitIntoClient - public mutating func append & ~Copyable & ~Escapable>( + public mutating func append & ~Copyable & ~Escapable>( copying items: borrowing S ) { self._append(copying: items) @@ -374,7 +374,7 @@ extension UniqueDeque /*where Element: Copyable*/ { /// amortized over many similar invocations over the same deque. @_alwaysEmitIntoClient public mutating func append< - S: BorrowingSequence_ & Sequence + S: Iterable_ & Sequence >( copying items: S ) { diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Container.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Container.swift index fcdae58a..4367227f 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Container.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Container.swift @@ -26,7 +26,7 @@ extension UniqueDeque where Element: ~Copyable { @_alwaysEmitIntoClient @_lifetime(borrow self) - public borrowing func makeBorrowingIterator_() -> BorrowingIterator { + public borrowing func makeIterableIterator_() -> BorrowingIterator { BorrowingIterator(_deque: self._storage) } #endif diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Initializers.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Initializers.swift index fc776edf..4045ef9f 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Initializers.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Initializers.swift @@ -145,7 +145,7 @@ extension UniqueDeque /*where Element: Copyable*/ { @_alwaysEmitIntoClient @inline(__always) public init< - S: BorrowingSequence_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >( capacity: Int? = nil, copying contents: borrowing S @@ -184,7 +184,7 @@ extension UniqueDeque /*where Element: Copyable*/ { @_alwaysEmitIntoClient @inline(__always) public init< - S: BorrowingSequence_ & Sequence + S: Iterable_ & Sequence >( capacity: Int? = nil, copying contents: S @@ -203,7 +203,7 @@ extension UniqueDeque /*where Element: Copyable*/ { @_alwaysEmitIntoClient @inline(__always) public init< - S: BorrowingSequence_ & Collection + S: Iterable_ & Collection >( capacity: Int? = nil, copying contents: S diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Insertions.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Insertions.swift index 433f4149..f7785077 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Insertions.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Insertions.swift @@ -383,7 +383,7 @@ extension UniqueDeque /* where Element: Copyable */ { newCount: Int ) { let expectedCount = self.count + newCount - var it = items.makeBorrowingIterator_() + var it = items.makeIterableIterator_() insert(addingCount: newCount, at: index) { target in it._copyContents_(into: &target) } diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift index 598f0f0d..c59fa248 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift @@ -322,7 +322,7 @@ extension UniqueDeque /*where Element: Copyable*/ { #if compiler(>=6.4) && UnstableContainersPreview @inlinable internal mutating func _prepend< - S: BorrowingSequence_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >(copying items: borrowing S) { // We don't know the exact count of new elements, so we cannot initialize // them in place. Append them to the end of the deque first, then rotate @@ -338,12 +338,12 @@ extension UniqueDeque /*where Element: Copyable*/ { @inlinable internal mutating func _prepend< - S: BorrowingSequence_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >( copying items: borrowing S, exactCount: Int ) { - var it = items.makeBorrowingIterator_() + var it = items.makeIterableIterator_() self.prepend(addingCount: exactCount) { target in let span = it.nextSpan_(maximumCount: target.freeCapacity) target._append(copying: span) @@ -367,7 +367,7 @@ extension UniqueDeque /*where Element: Copyable*/ { /// over many similar invocations on the same deque. @_alwaysEmitIntoClient public mutating func prepend< - S: BorrowingSequence_ & ~Copyable & ~Escapable + S: Iterable_ & ~Copyable & ~Escapable >( copying items: borrowing S ) { @@ -479,7 +479,7 @@ extension UniqueDeque /*where Element: Copyable*/ { /// over many similar invocations on the same deque. @_alwaysEmitIntoClient public mutating func prepend< - S: BorrowingSequence_ & Sequence + S: Iterable_ & Sequence >( copying items: borrowing S ) { @@ -498,7 +498,7 @@ extension UniqueDeque /*where Element: Copyable*/ { /// over many similar invocations on the same deque. @_alwaysEmitIntoClient public mutating func prepend< - S: BorrowingSequence_ & Collection + S: Iterable_ & Collection >( copying items: borrowing S ) { diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Replacements.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Replacements.swift index 191e12cb..3546a7df 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Replacements.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Replacements.swift @@ -475,7 +475,7 @@ extension UniqueDeque /* where Element: Copyable */ { ) { let expectedCount = self.count - subrange.count + newCount - var it = items.makeBorrowingIterator_() + var it = items.makeIterableIterator_() self.replace(removing: subrange, addingCount: newCount) { target in it._copyContents_(into: &target) } diff --git a/Tests/BasicContainersTests/RigidArrayTests.swift b/Tests/BasicContainersTests/RigidArrayTests.swift index fb0983a9..1fb89155 100644 --- a/Tests/BasicContainersTests/RigidArrayTests.swift +++ b/Tests/BasicContainersTests/RigidArrayTests.swift @@ -1472,7 +1472,7 @@ class RigidArrayTests: CollectionTestCase { func test_borrowing_map() { let c = 100 let items = RigidArray(capacity: c, copying: 0 ..< c) - let transformed = items.makeBorrowingIterator_() + let transformed = items.makeIterableIterator_() .map { 2 * $0 } .collect(into: UniqueArray.self) expectEqual(transformed.count, c) @@ -1485,7 +1485,7 @@ class RigidArrayTests: CollectionTestCase { func test_borrowing_filter() { let c = 100 let items = RigidArray(capacity: c, copying: 0 ..< c) - let transformed = items.makeBorrowingIterator_() + let transformed = items.makeIterableIterator_() .filter { !$0.isMultiple(of: 6) } .copy() .collect(into: UniqueArray.self) diff --git a/Tests/BasicContainersTests/RigidDictionaryTests.swift b/Tests/BasicContainersTests/RigidDictionaryTests.swift index 3785a138..8fd56b54 100644 --- a/Tests/BasicContainersTests/RigidDictionaryTests.swift +++ b/Tests/BasicContainersTests/RigidDictionaryTests.swift @@ -258,7 +258,7 @@ class RigidDictionaryTests: CollectionTestCase { expectEqual(keys.count, i + 1) expectEqual(keys.capacity, capacity) #if compiler(>=6.4) && UnstableContainersPreview - var it = keys.makeBorrowingIterator_() + var it = keys.makeIterableIterator_() var actual: Set = [] while true { let next = it.nextSpan_() @@ -323,7 +323,7 @@ class RigidDictionaryTests: CollectionTestCase { var seen: Set = [] let indices = d.indices - var it = indices.makeBorrowingIterator_() + var it = indices.makeIterableIterator_() while true { let next = it.nextSpan_() if next.isEmpty { break } diff --git a/Tests/BasicContainersTests/RigidSetTests.swift b/Tests/BasicContainersTests/RigidSetTests.swift index c040ad6c..566cf684 100644 --- a/Tests/BasicContainersTests/RigidSetTests.swift +++ b/Tests/BasicContainersTests/RigidSetTests.swift @@ -301,7 +301,7 @@ class RigidSetTests: CollectionTestCase { s.insert(tracker.instance(for: i)) var expected = Set(0 ... i) - var it = s.makeBorrowingIterator_() + var it = s.makeIterableIterator_() while true { let next = it.nextSpan_(maximumCount: maximumCount) guard !next.isEmpty else { break } diff --git a/Tests/BasicContainersTests/UniqueDictionaryTests.swift b/Tests/BasicContainersTests/UniqueDictionaryTests.swift index f9d0f464..e8203c63 100644 --- a/Tests/BasicContainersTests/UniqueDictionaryTests.swift +++ b/Tests/BasicContainersTests/UniqueDictionaryTests.swift @@ -146,7 +146,7 @@ class UniqueDictionaryTests: CollectionTestCase { expectEqual(keys.count, i + 1) expectEqual(keys.capacity, capacity) #if compiler(>=6.4) && UnstableContainersPreview - var it = keys.makeBorrowingIterator_() + var it = keys.makeIterableIterator_() var actual: Set = [] while true { let next = it.nextSpan_() @@ -210,7 +210,7 @@ class UniqueDictionaryTests: CollectionTestCase { var seen: Set = [] let indices = d.indices - var it = indices.makeBorrowingIterator_() + var it = indices.makeIterableIterator_() while true { let next = it.nextSpan_() if next.isEmpty { break } diff --git a/Tests/ContainersTests/BorrowingSequenceTests.swift b/Tests/ContainersTests/BorrowingSequenceTests.swift index 781d5211..be1f647c 100644 --- a/Tests/ContainersTests/BorrowingSequenceTests.swift +++ b/Tests/ContainersTests/BorrowingSequenceTests.swift @@ -64,9 +64,9 @@ final class BorrowingSequenceTests: XCTestCase { } @available(SwiftStdlib 5.0, *) -extension BorrowingSequence_ where Self: ~Copyable & ~Escapable, Element_: Copyable { +extension Iterable_ where Self: ~Copyable & ~Escapable, Element_: Copyable { func collectViaBorrowing() -> [Element_] { - var borrowIterator = makeBorrowingIterator_() + var borrowIterator = makeIterableIterator_() var result: [Element_] = [] while true { let span = borrowIterator.nextSpan_(maximumCount: .max) diff --git a/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift b/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift index 397f4bbc..4b6577f0 100644 --- a/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift +++ b/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift @@ -127,7 +127,7 @@ public func expectIterableContents< @available(SwiftStdlib 5.0, *) public func expectIterablePayloads< Payload: Equatable, - E1: BorrowingSequence_> & ~Copyable & ~Escapable, + E1: Iterable_> & ~Copyable & ~Escapable, C2: Collection, >( _ left: borrowing E1, @@ -137,7 +137,7 @@ public func expectIterablePayloads< file: StaticString = #filePath, line: UInt = #line ) where E1.Element_: ~Copyable { - var it1 = left.makeBorrowingIterator_() + var it1 = left.makeIterableIterator_() var it2 = right.makeIterator() var i = 0 while true { @@ -174,7 +174,7 @@ public func expectIterablePayloads< @available(SwiftStdlib 5.0, *) public func expectIterablePayloads< Payload: Equatable, - E1: BorrowingSequence_> & ~Copyable & ~Escapable, + E1: Iterable_> & ~Copyable & ~Escapable, C2: Collection, >( _ left: borrowing E1, @@ -184,7 +184,7 @@ public func expectIterablePayloads< file: StaticString = #filePath, line: UInt = #line ) { - var it1 = left.makeBorrowingIterator_() + var it1 = left.makeIterableIterator_() var it2 = right.makeIterator() var i = 0 while true { @@ -220,8 +220,8 @@ public func expectIterablePayloads< #if compiler(>=6.4) && UnstableContainersPreview @available(SwiftStdlib 5.0, *) public func expectIterablesWithEquivalentElements< - S1: BorrowingSequence_ & ~Copyable & ~Escapable, - S2: BorrowingSequence_ & ~Copyable & ~Escapable + S1: Iterable_ & ~Copyable & ~Escapable, + S2: Iterable_ & ~Copyable & ~Escapable >( _ left: borrowing S1, _ right: borrowing S2, @@ -245,8 +245,8 @@ where @available(SwiftStdlib 5.0, *) public func expectIterablesWithEqualElements< Element: Equatable, - S1: BorrowingSequence_ & ~Copyable & ~Escapable, - S2: BorrowingSequence_ & ~Copyable & ~Escapable, + S1: Iterable_ & ~Copyable & ~Escapable, + S2: Iterable_ & ~Copyable & ~Escapable, >( _ left: borrowing S1, _ right: borrowing S2, @@ -269,7 +269,7 @@ where @available(SwiftStdlib 5.0, *) public func expectIterableContents< Element: Equatable, - S1: BorrowingSequence_ & ~Copyable & ~Escapable, + S1: Iterable_ & ~Copyable & ~Escapable, C2: Collection, >( _ left: borrowing S1, @@ -279,7 +279,7 @@ public func expectIterableContents< file: StaticString = #filePath, line: UInt = #line ) { - var it1 = left.makeBorrowingIterator_() + var it1 = left.makeIterableIterator_() var it2 = right.makeIterator() while true { let span = it1.nextSpan_() @@ -310,7 +310,7 @@ public func expectIterableContents< /// Check if `left` and `right` contain equal elements in the same order. @available(SwiftStdlib 5.0, *) public func expectIterableContents< - S1: BorrowingSequence_ & ~Copyable & ~Escapable, + S1: Iterable_ & ~Copyable & ~Escapable, C2: Collection, >( _ left: borrowing S1, @@ -322,7 +322,7 @@ public func expectIterableContents< file: StaticString = #filePath, line: UInt = #line ) where S1.Element_: ~Copyable { - var it1 = left.makeBorrowingIterator_() + var it1 = left.makeIterableIterator_() var it2 = right.makeIterator() var offset = 0 while true { diff --git a/Tests/_CollectionsTestSupport/ConformanceCheckers/CheckContainer.swift b/Tests/_CollectionsTestSupport/ConformanceCheckers/CheckContainer.swift index 9b6c4099..7bc473b5 100644 --- a/Tests/_CollectionsTestSupport/ConformanceCheckers/CheckContainer.swift +++ b/Tests/_CollectionsTestSupport/ConformanceCheckers/CheckContainer.swift @@ -22,7 +22,7 @@ import ContainersPreview @available(SwiftStdlib 5.0, *) @inlinable public func checkIterable< - S: BorrowingSequence_ & ~Copyable & ~Escapable, + S: Iterable_ & ~Copyable & ~Escapable, Expected: Sequence >( _ iterable: borrowing S, @@ -40,7 +40,7 @@ public func checkIterable< @available(SwiftStdlib 5.0, *) @inlinable public func checkIterable< - S: BorrowingSequence_ & ~Copyable & ~Escapable, + S: Iterable_ & ~Copyable & ~Escapable, Expected: Sequence >( _ iterable: borrowing S, @@ -60,7 +60,7 @@ public func checkIterable< let spanShapes: [Range] = { var r: [Range] = [] var pos = 0 - var it = iterable.makeBorrowingIterator_() + var it = iterable.makeIterableIterator_() while true { let origPos = pos let span = it.nextSpan_() @@ -79,7 +79,7 @@ public func checkIterable< // Check that the spans have stable sizes and the expected contents. do { var pos = 0 - var it = iterable.makeBorrowingIterator_() + var it = iterable.makeIterableIterator_() var spanIndex = 0 while true { let span = it.nextSpan_() @@ -100,7 +100,7 @@ public func checkIterable< // Check that we can iterate one by one. do { var pos = 0 - var it = iterable.makeBorrowingIterator_() + var it = iterable.makeIterableIterator_() while true { let span = it.nextSpan_(maximumCount: 1) if span.isEmpty { break } @@ -116,7 +116,7 @@ public func checkIterable< // Check that we can iterate with huge maximum counts do { var pos = 0 - var it = iterable.makeBorrowingIterator_() + var it = iterable.makeIterableIterator_() var spanIndex = 0 while true { let span = it.nextSpan_(maximumCount: Int.max) diff --git a/Tests/_CollectionsTestSupport/MinimalTypes/StaccatoContainer.swift b/Tests/_CollectionsTestSupport/MinimalTypes/StaccatoContainer.swift index 1e7646db..0c891573 100644 --- a/Tests/_CollectionsTestSupport/MinimalTypes/StaccatoContainer.swift +++ b/Tests/_CollectionsTestSupport/MinimalTypes/StaccatoContainer.swift @@ -76,7 +76,7 @@ package struct _StaccatoParameters { } @available(SwiftStdlib 5.0, *) -public struct _StaccatoBorrowingIterator: BorrowingIteratorProtocol_, ~Escapable { +public struct _StaccatoBorrowingIterator: IterableIteratorProtocol_, ~Escapable { public typealias Element_ = Element internal let _contents: Span @@ -116,13 +116,13 @@ public struct _StaccatoIndex: Comparable { } @available(SwiftStdlib 5.0, *) -extension StaccatoContainer: BorrowingSequence_ where Element: ~Copyable { - public typealias BorrowingIterator_ = _StaccatoBorrowingIterator // FIXME rdar://150240032 +extension StaccatoContainer: Iterable_ where Element: ~Copyable { + public typealias IterableIterator_ = _StaccatoBorrowingIterator // FIXME rdar://150240032 public var underestimatedCount_: Int { count } - public func makeBorrowingIterator_() -> BorrowingIterator_ { - BorrowingIterator_(contents: _contents.span, params: _params) + public func makeIterableIterator_() -> IterableIterator_ { + IterableIterator_(contents: _contents.span, params: _params) } }