mirror of
https://github.com/apple/swift-collections
synced 2026-11-29 05:14:20 +00:00
Disambiguate ContainersPreview and stdlib
Adds trailing underscores to the BorrowingSequence protocols and requirements, in order to allow both parallel conformances and the ability to evolve the requirements in this package.
This commit is contained in:
1 parent
4c04822689
commit
a99a015934
49 files changed
+350
-363
No files matched your search
@@ -350,7 +350,7 @@ extension RigidArray {
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@inlinable
|
||||
internal mutating func _append<
|
||||
Source: BorrowingSequence<Element> & ~Copyable & ~Escapable
|
||||
Source: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying newElements: borrowing Source
|
||||
) {
|
||||
@@ -373,7 +373,7 @@ extension RigidArray {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func append<
|
||||
Source: BorrowingSequence<Element> & ~Copyable & ~Escapable
|
||||
Source: BorrowingSequence_<Element> & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying newElements: borrowing Source
|
||||
) {
|
||||
@@ -416,7 +416,7 @@ extension RigidArray {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func append<
|
||||
Source: BorrowingSequence<Element> & Sequence<Element>
|
||||
Source: BorrowingSequence_<Element> & Sequence<Element>
|
||||
>(copying newElements: Source) {
|
||||
_append(copying: newElements)
|
||||
}
|
||||
|
||||
@@ -20,11 +20,11 @@ import ContainersPreview
|
||||
|
||||
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
extension RigidArray: BorrowingSequence where Element: ~Copyable {
|
||||
public typealias BorrowingIterator = SpanIterator<Element>
|
||||
extension RigidArray: BorrowingSequence_ where Element: ~Copyable {
|
||||
public typealias BorrowingIterator_ = SpanIterator<Element>
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public func makeBorrowingIterator() -> BorrowingIterator {
|
||||
public func makeBorrowingIterator_() -> BorrowingIterator_ {
|
||||
SpanIterator(self.span)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ extension RigidArray /*where Element: Copyable*/ {
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<Source: BorrowingSequence<Element> & ~Copyable & ~Escapable>(
|
||||
public init<Source: BorrowingSequence_<Element> & ~Copyable & ~Escapable>(
|
||||
capacity: Int,
|
||||
copying contents: borrowing Source
|
||||
) {
|
||||
@@ -147,7 +147,7 @@ extension RigidArray /*where Element: Copyable*/ {
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<Source: BorrowingSequence<Element> & Sequence<Element>>(
|
||||
public init<Source: BorrowingSequence_<Element> & Sequence<Element>>(
|
||||
capacity: Int,
|
||||
copying contents: Source
|
||||
) {
|
||||
|
||||
@@ -416,15 +416,15 @@ extension RigidArray {
|
||||
copying items: borrowing C,
|
||||
newCount: Int
|
||||
) {
|
||||
var it = items.makeBorrowingIterator()
|
||||
var it = items.makeBorrowingIterator_()
|
||||
insert(addingCount: newCount, at: index) { target in
|
||||
while !target.isFull {
|
||||
let source = it.nextSpan(maximumCount: target.freeCapacity)
|
||||
let source = it.nextSpan_(maximumCount: target.freeCapacity)
|
||||
precondition(!source.isEmpty, "Broken container: mismatching count")
|
||||
target._append(copying: source)
|
||||
}
|
||||
}
|
||||
precondition(it.nextSpan().isEmpty, "Broken container: mismatching count")
|
||||
precondition(it.nextSpan_().isEmpty, "Broken container: mismatching count")
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -591,17 +591,17 @@ extension RigidArray {
|
||||
copyingContainer items: borrowing C,
|
||||
newCount: Int
|
||||
) {
|
||||
var it = items.makeBorrowingIterator()
|
||||
var it = items.makeBorrowingIterator_()
|
||||
self.replace(removing: subrange, addingCount: newCount) { target in
|
||||
while !target.isFull {
|
||||
let source = it.nextSpan(maximumCount: target.freeCapacity)
|
||||
let source = it.nextSpan_(maximumCount: target.freeCapacity)
|
||||
precondition(
|
||||
!source.isEmpty,
|
||||
"Broken Container: count doesn't match contents")
|
||||
target._append(copying: source)
|
||||
}
|
||||
precondition(
|
||||
it.nextSpan().isEmpty,
|
||||
it.nextSpan_().isEmpty,
|
||||
"Broken Container: count doesn't match contents")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user