[ContainersPreview] Exhibit A in the case against prototyping things in the stdlib 😞

This commit is contained in:
Karoy Lorentey committed 2026-03-26 17:14:45 -07:00
1 parent 3e380cb358
commit 419e2f7df2
56 files changed
+200 -98

No files matched your search

+3 -1
View File
@@ -55,9 +55,10 @@ set(collections_swift_flags
"-enable-experimental-feature BuiltinModule"
"-enable-experimental-feature Lifetimes"
"-enable-experimental-feature InoutLifetimeDependence"
"-enable-experimental-feature SuppressedAssociatedTypesWithDefaults"
"-enable-experimental-feature AddressableParameters"
"-enable-experimental-feature AddressableTypes"
"-enable-experimental-feature SuppressedAssociatedTypesWithDefaults"
"-enable-experimental-feature BorrowingSequence"
)
foreach(flag ${collections_swift_flags})
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:${flag}>")
@@ -77,6 +78,7 @@ set(availability_defs
"SwiftStdlib 6.1: macOS 15.4, iOS 18.4, watchOS 11.4, tvOS 18.4, visionOS 2.4"
"SwiftStdlib 6.2: macOS 26.0, iOS 26.0, watchOS 26.0, tvOS 26.0, visionOS 26.0"
"SwiftStdlib 6.3: macOS 26.4, iOS 26.4, watchOS 26.4, tvOS 26.4, visionOS 26.4"
"SwiftStdlib 6.4: macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999"
)
foreach(def ${availability_defs})
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature \"AvailabilityMacro=${def}\">")
+3 -1
View File
@@ -110,6 +110,7 @@ let availabilityMacros: KeyValuePairs<String, String> = [
"SwiftStdlib 6.1": "macOS 15.4, iOS 18.4, watchOS 11.4, tvOS 18.4, visionOS 2.4",
"SwiftStdlib 6.2": "macOS 26.0, iOS 26.0, watchOS 26.0, tvOS 26.0, visionOS 26.0",
"SwiftStdlib 6.3": "macOS 26.4, iOS 26.4, watchOS 26.4, tvOS 26.4, visionOS 26.4",
"SwiftStdlib 6.4": "macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999",
// Note: if you touch these, please make sure to also update the similar lists in
// CMakeLists.txt and Xcode/Shared.xcconfig.
]
@@ -120,9 +121,10 @@ let extraSettings: [SwiftSetting] = [
.enableExperimentalFeature("BuiltinModule"),
.enableExperimentalFeature("Lifetimes"),
.enableExperimentalFeature("InoutLifetimeDependence"),
.enableExperimentalFeature("SuppressedAssociatedTypesWithDefaults"), // Requires Swift 6.4
.enableExperimentalFeature("AddressableParameters"),
.enableExperimentalFeature("AddressableTypes"),
.enableExperimentalFeature("SuppressedAssociatedTypesWithDefaults"), // Requires Swift 6.4
.enableExperimentalFeature("BorrowingSequence"), // Requires Swift 6.4
// Note: if you touch these, please make sure to also update the similar lists in
// CMakeLists.txt and Xcode/Shared.xcconfig.
@@ -343,6 +343,7 @@ extension RigidArray {
}
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@inlinable
internal mutating func _append<
Source: BorrowingSequence<Element> & ~Copyable & ~Escapable
@@ -364,6 +365,7 @@ extension RigidArray {
/// - newElements: A container whose contents to copy into the array.
///
/// - Complexity: O(`newElements.count`)
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public mutating func append<
@@ -406,6 +408,7 @@ extension RigidArray {
/// - newElements: The new elements to copy into the array.
///
/// - Complexity: O(*m*), where *m* is the length of `newElements`.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public mutating func append<
@@ -19,13 +19,9 @@ import ContainersPreview
#if compiler(>=6.2)
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension RigidArray: BorrowingSequence where Element: ~Copyable {
public typealias BorrowingIterator = SpanIterator<Element>
@inlinable
public var underestimatedCount: Int { count }
@_alwaysEmitIntoClient
@inline(__always)
public func makeBorrowingIterator() -> BorrowingIterator {
@@ -55,6 +51,9 @@ extension RigidArray: RangeReplaceableContainer where Element: ~Copyable {}
@available(SwiftStdlib 5.0, *)
extension RigidArray where Element: ~Copyable {
@inlinable
public var underestimatedCount: Int { count }
/// A Boolean value indicating whether this array contains no elements.
///
/// - Complexity: O(1)
@@ -122,6 +122,7 @@ extension RigidArray /*where Element: Copyable*/ {
/// just enough capacity to store the contents.
/// - contents: The container whose contents to copy into the new array.
/// The container must not contain more than `capacity` elements.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public init<Source: BorrowingSequence<Element> & ~Copyable & ~Escapable>(
@@ -143,6 +144,7 @@ extension RigidArray /*where Element: Copyable*/ {
/// just enough capacity to store the contents.
/// - contents: The container whose contents to copy into the new array.
/// The container must not contain more than `capacity` elements.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public init<Source: BorrowingSequence<Element> & Sequence<Element>>(
@@ -405,6 +405,7 @@ extension RigidArray {
}
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
internal mutating func _insertContainer<
C: Container<Element> & ~Copyable & ~Escapable
@@ -471,6 +472,7 @@ extension RigidArray {
/// a valid index of the array.
///
/// - Complexity: O(`self.count` + `newElements.count`).
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public mutating func insert<
@@ -531,6 +533,7 @@ extension RigidArray {
/// a valid index of the array.
///
/// - Complexity: O(`self.count` + `newElements.count`)
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public mutating func insert<
@@ -580,6 +580,7 @@ extension RigidArray {
}
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@inlinable
internal mutating func _replace<
C: Container<Element> & ~Copyable & ~Escapable
@@ -658,6 +659,7 @@ extension RigidArray {
/// - newElements: The new elements to copy into the collection.
///
/// - Complexity: O(`self.count` + `newElements.count`)
@available(SwiftStdlib 6.4, *)
@inlinable
@inline(__always)
public mutating func replace<
@@ -739,6 +741,7 @@ extension RigidArray {
///
/// - Complexity: O(*n* + *m*), where *n* is count of this array and
/// *m* is the count of `newElements`.
@available(SwiftStdlib 6.4, *)
@inlinable
@inline(__always)
public mutating func replace<
@@ -29,7 +29,7 @@ extension RigidSet {
}
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension RigidSet: Equatable {
@inlinable
public static func ==(left: borrowing Self, right: borrowing Self) -> Bool {
@@ -18,7 +18,7 @@ import ContainersPreview
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_HASHED_CONTAINERS && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension RigidSet: Hashable {
@inlinable
public func hash(into hasher: inout Hasher) {
@@ -80,6 +80,7 @@ extension RigidSet where Element: ~Copyable {
@available(SwiftStdlib 5.0, *)
extension RigidSet /* where Element: Copyable */ {
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public init<
@@ -114,6 +115,7 @@ extension RigidSet /* where Element: Copyable */ {
}
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public init<
@@ -126,6 +128,7 @@ extension RigidSet /* where Element: Copyable */ {
self._insert(copying: contents)
}
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public init<
@@ -219,6 +219,7 @@ extension RigidSet /* where Element: Copyable */ {
}
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
package mutating func _insert<
S: BorrowingSequence<Element> & ~Copyable & ~Escapable
@@ -235,6 +236,7 @@ extension RigidSet /* where Element: Copyable */ {
#endif
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public mutating func insert<
@@ -256,6 +258,7 @@ extension RigidSet /* where Element: Copyable */ {
}
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public mutating func insert<
@@ -304,6 +304,7 @@ extension UniqueArray {
}
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@inlinable
internal mutating func _append<
Source: BorrowingSequence<Element> & ~Copyable & ~Escapable
@@ -336,6 +337,7 @@ extension UniqueArray {
///
/// - Complexity: O(`newElements.count`), when amortized over many invocations
/// over the same array.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public mutating func append<
@@ -390,6 +392,7 @@ extension UniqueArray {
///
/// - Complexity: O(`newElements.count`), when amortized over many invocations
/// over the same array.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public mutating func append<
@@ -19,7 +19,7 @@ import ContainersPreview
#if compiler(>=6.2)
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension UniqueArray: BorrowingSequence where Element: ~Copyable {
public typealias BorrowingIterator = RigidArray<Element>.BorrowingIterator
@@ -35,23 +35,23 @@ extension UniqueArray: BorrowingSequence where Element: ~Copyable {
#endif
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension UniqueArray: Container where Element: ~Copyable {}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension UniqueArray: BidirectionalContainer where Element: ~Copyable {}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension UniqueArray: RandomAccessContainer where Element: ~Copyable {}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension UniqueArray: MutableContainer where Element: ~Copyable {}
#if compiler(>=6.3)
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension UniqueArray: RangeReplaceableContainer where Element: ~Copyable {}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension UniqueArray: DynamicContainer where Element: ~Copyable {}
#endif
#endif
@@ -102,6 +102,7 @@ extension UniqueArray /*where Element: Copyable*/ {
/// just enough capacity to store the contents.
/// - contents: A sequence whose contents to copy into the new array.
/// The sequence must not contain more than `capacity` elements.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public init<Source: BorrowingSequence<Element> & ~Copyable & ~Escapable>(
@@ -138,6 +139,7 @@ extension UniqueArray /*where Element: Copyable*/ {
/// - capacity: The storage capacity of the new array, or nil to allocate
/// just enough capacity to store the contents.
/// - contents: The container whose contents to copy into the new array.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public init<Source: BorrowingSequence<Element> & Sequence<Element>>(
@@ -388,6 +388,7 @@ extension UniqueArray {
///
/// - Complexity: O(*n* + *m*), where *n* is count of this array and
/// *m* is the count of `newElements`.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public mutating func insert<
@@ -455,6 +456,7 @@ extension UniqueArray {
///
/// - Complexity: O(*n* + *m*), where *n* is count of this array and
/// *m* is the count of `newElements`.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public mutating func insert<
@@ -549,6 +549,7 @@ extension UniqueArray {
///
/// - Complexity: O(*n* + *m*), where *n* is count of this array and
/// *m* is the count of `newElements`.
@available(SwiftStdlib 6.4, *)
@inlinable
@inline(__always)
public mutating func replace<
@@ -639,6 +640,7 @@ extension UniqueArray {
///
/// - Complexity: O(*n* + *m*), where *n* is count of this array and
/// *m* is the count of `newElements`.
@available(SwiftStdlib 6.4, *)
@inlinable
@inline(__always)
public mutating func replace<
@@ -18,7 +18,7 @@ import ContainersPreview
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_HASHED_CONTAINERS && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension UniqueSet: Hashable {
@inlinable
public func hash(into hasher: inout Hasher) {
@@ -73,6 +73,7 @@ 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
@@ -91,6 +92,7 @@ extension UniqueSet where Element: Copyable {
}
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
public init<
S: BorrowingSequence<Element> & Sequence<Element>
@@ -128,6 +128,7 @@ extension UniqueSet /* where Element: Copyable */ {
}
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
package mutating func _insert<
S: BorrowingSequence<Element> & ~Copyable & ~Escapable
@@ -145,6 +146,7 @@ extension UniqueSet /* where Element: Copyable */ {
#endif
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public mutating func insert<
@@ -167,6 +169,7 @@ extension UniqueSet /* where Element: Copyable */ {
}
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public mutating func insert<
@@ -13,7 +13,7 @@
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension BorrowingIteratorProtocol
where
Self: ~Copyable & ~Escapable,
@@ -17,7 +17,7 @@ import InternalCollectionsUtilities
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension BorrowingSequence
where
Self: ~Copyable & ~Escapable, Element: Equatable,
@@ -35,7 +35,7 @@ where
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension BorrowingSequence
where
Self: ~Copyable & ~Escapable,
@@ -76,7 +76,7 @@ where
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension BorrowingIteratorProtocol
where
Self: ~Copyable & ~Escapable,
@@ -166,7 +166,7 @@ where
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension BorrowingIteratorProtocol
where
Self: ~Copyable & ~Escapable,
@@ -13,7 +13,7 @@
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension BorrowingIteratorProtocol
where
Self: ~Copyable & ~Escapable,
@@ -28,7 +28,7 @@ where
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
public struct BorrowingFilter<
Base: BorrowingIteratorProtocol & ~Copyable & ~Escapable
>: ~Copyable, ~Escapable
@@ -54,7 +54,7 @@ where Base.Element: ~Copyable {
// FIXME: Sendable
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension BorrowingFilter: BorrowingIteratorProtocol
where Base: ~Copyable & ~Escapable, Base.Element: ~Copyable {
@_lifetime(&self)
@@ -13,7 +13,7 @@
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension BorrowingIteratorProtocol
where
Self: ~Copyable & ~Escapable,
@@ -28,7 +28,7 @@ where
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
public struct BorrowingMapProducer<
Base: BorrowingIteratorProtocol & ~Copyable & ~Escapable,
Element: ~Copyable,
@@ -53,7 +53,7 @@ public struct BorrowingMapProducer<
// FIXME: Sendable
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension BorrowingMapProducer: Producer
where
Base: ~Copyable & ~Escapable,
@@ -13,7 +13,7 @@
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension BorrowingIteratorProtocol
where
Self: ~Copyable & ~Escapable,
@@ -17,7 +17,7 @@ import InternalCollectionsUtilities
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension BorrowingIteratorProtocol
where
Self: ~Copyable & ~Escapable,
@@ -17,6 +17,8 @@
import InternalCollectionsUtilities
#endif
#if false // Use the stdlib's definition
@available(SwiftStdlib 5.0, *)
public protocol BorrowingIteratorProtocol<Element>: ~Copyable, ~Escapable {
associatedtype Element: ~Copyable
@@ -142,13 +144,16 @@ extension BorrowingIteratorProtocol where Self: ~Copyable & ~Escapable {
// }
}
@available(SwiftStdlib 5.0, *)
#endif
@available(SwiftStdlib 6.4, *)
extension BorrowingIteratorProtocol
where Self: ~Copyable & ~Escapable, Element: Copyable
{
@_lifetime(self: copy self)
@inlinable
@_transparent
public mutating func copyContents(into target: inout OutputSpan<Element>) {
package mutating func _copyContents(into target: inout OutputSpan<Element>) {
target.withUnsafeMutableBufferPointer { dst, dstCount in
var tail = dst._extracting(droppingFirst: dstCount)
while !tail.isEmpty {
@@ -161,4 +166,5 @@ where Self: ~Copyable & ~Escapable, Element: Copyable
}
}
#endif
@@ -13,7 +13,7 @@
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension BorrowingSequence
where
Self: ~Copyable & ~Escapable,
@@ -48,7 +48,7 @@ where
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension BorrowingSequence
where
Self: ~Copyable & ~Escapable,
@@ -84,7 +84,7 @@ where
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension BorrowingSequence
where Self: ~Copyable & ~Escapable, Element: ~Copyable & Equatable {
@inlinable
@@ -13,7 +13,8 @@
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
#if false // Use the stdlib's conformance
@available(SwiftStdlib 6.4, *)
extension Span: BorrowingSequence where Element: ~Copyable {
public typealias BorrowingIterator = SpanIterator<Element>
@@ -26,8 +27,10 @@ extension Span: BorrowingSequence where Element: ~Copyable {
SpanIterator(self)
}
}
#endif
@available(SwiftStdlib 5.0, *)
#if false // Use the stdlib's conformance
@available(SwiftStdlib 6.4, *)
extension MutableSpan: BorrowingSequence where Element: ~Copyable {
public typealias BorrowingIterator = SpanIterator<Element>
@@ -44,8 +47,10 @@ extension MutableSpan: BorrowingSequence where Element: ~Copyable {
SpanIterator(self.span)
}
}
#endif
@available(SwiftStdlib 5.0, *)
#if false // Use the stdlib's conformance
@available(SwiftStdlib 6.4, *)
extension OutputSpan: BorrowingSequence where Element: ~Copyable {
public typealias BorrowingIterator = SpanIterator<Element>
@@ -58,8 +63,9 @@ extension OutputSpan: BorrowingSequence where Element: ~Copyable {
SpanIterator(self.span)
}
}
#endif
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension InputSpan: BorrowingSequence where Element: ~Copyable {
public typealias BorrowingIterator = SpanIterator<Element>
@@ -73,7 +79,8 @@ extension InputSpan: BorrowingSequence where Element: ~Copyable {
}
}
@available(SwiftStdlib 6.2, *)
#if false // Use the stdlib's conformance
@available(SwiftStdlib 6.4, *)
extension Array: BorrowingSequence {
public typealias BorrowingIterator = SpanIterator<Element>
@@ -86,8 +93,10 @@ extension Array: BorrowingSequence {
SpanIterator(self.span)
}
}
#endif
@available(SwiftStdlib 6.2, *)
#if false // Use the stdlib's conformance
@available(SwiftStdlib 6.4, *)
extension InlineArray: BorrowingSequence where Element: ~Copyable {
public typealias BorrowingIterator = SpanIterator<Element>
@@ -104,8 +113,10 @@ extension InlineArray: BorrowingSequence where Element: ~Copyable {
SpanIterator(self.span)
}
}
#endif
@available(SwiftStdlib 6.2, *)
#if false // Use the stdlib's conformance
@available(SwiftStdlib 6.4, *)
extension Range: BorrowingSequence
where Bound: Strideable, Bound.Stride: SignedInteger
{
@@ -160,8 +171,9 @@ where Bound: Strideable, Bound.Stride: SignedInteger
BorrowingIterator(self)
}
}
#endif
@available(SwiftStdlib 6.2, *)
@available(SwiftStdlib 6.4, *)
extension ClosedRange: BorrowingSequence
where Bound: Strideable, Bound.Stride: SignedInteger
{
@@ -17,7 +17,7 @@ import InternalCollectionsUtilities
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension BorrowingSequence where Self: ~Copyable & ~Escapable, Element: Copyable {
@inlinable
package func _copyContents(
@@ -13,6 +13,8 @@
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
#if false // Use the stdlib's definition
@available(SwiftStdlib 5.0, *)
public protocol BorrowingSequence<Element>: ~Copyable, ~Escapable {
associatedtype Element: ~Copyable
@@ -75,3 +77,5 @@ where
}
#endif
#endif
@@ -13,7 +13,7 @@
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
public protocol BidirectionalContainer<Element>: Container, ~Copyable, ~Escapable
where Element: ~Copyable
{
@@ -25,7 +25,7 @@ where Element: ~Copyable
func previousSpan(before index: inout Index, maximumCount: Int) -> Span<Element>
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension BidirectionalContainer
where Self: ~Copyable & ~Escapable, Element: ~Copyable {
@inlinable
@@ -17,7 +17,7 @@ import InternalCollectionsUtilities
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension Container where Self: ~Copyable /*& ~Escapable*/, Element: ~Copyable {
@_lifetime(borrow self)
public func _filter(
@@ -27,7 +27,7 @@ extension Container where Self: ~Copyable /*& ~Escapable*/, Element: ~Copyable {
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension ContainerIterator where Base.Element: ~Copyable {
@_lifetime(copy self)
public func filter(
@@ -37,7 +37,7 @@ extension ContainerIterator where Base.Element: ~Copyable {
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
public struct ContainerFilter<
Base: Container & ~Copyable/* FIXME & ~Escapable */
>: ~Copyable, ~Escapable
@@ -85,7 +85,7 @@ where Base.Element: ~Copyable
// FIXME: Sendable
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension ContainerFilter: BorrowingIteratorProtocol where Element: ~Copyable {
@_lifetime(copy self)
public mutating func nextSpan(maximumCount: Int) -> Span<Element> {
@@ -17,7 +17,7 @@ import InternalCollectionsUtilities
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.2, *)
@available(SwiftStdlib 6.4, *)
extension Container where Self: ~Copyable & ~Escapable, Element: ~Copyable {
@_alwaysEmitIntoClient
internal func _spanwiseZip<Other: Container & ~Copyable & ~Escapable, E: Error>(
@@ -13,7 +13,7 @@
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
public protocol Container<Element>: BorrowingSequence, ~Copyable, ~Escapable
where Element: ~Copyable
{
@@ -169,7 +169,7 @@ where Element: ~Copyable
func index(alignedUp index: Index) -> Index
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension Container where Self: ~Copyable & ~Escapable, Element: ~Copyable {
/// Return a span over the container's storage that begins with the element at
/// the given index, and extends to the end of the contiguous storage chunk
@@ -225,7 +225,7 @@ extension Container where Self: ~Copyable & ~Escapable, Element: ~Copyable {
// }
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension Container where Self: ~Copyable & ~Escapable, Element: ~Copyable {
@inlinable
public func formIndex(after index: inout Index) {
@@ -257,7 +257,7 @@ extension Container where Self: ~Copyable & ~Escapable, Element: ~Copyable {
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension Container where Self: ~Copyable & ~Escapable, Element: ~Copyable {
@inlinable
public func _defaultDistance(from start: Index, to end: Index) -> Int {
@@ -387,7 +387,7 @@ extension Container where Self: ~Copyable & ~Escapable, Element: ~Copyable {
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension Container where Self: ~Copyable & ~Escapable, Element: ~Copyable {
@_transparent
public var underestimatedCount: Int { count }
@@ -13,7 +13,7 @@
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension Container
where
Self: ~Copyable /*FIXME: & ~Escapable*/,
@@ -26,7 +26,7 @@ where
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
public struct ContainerIterator<
Base: Container & ~Copyable /*FIXME: & ~Escapable*/
>: ~Copyable, ~Escapable
@@ -42,7 +42,7 @@ where Base.Element: ~Copyable
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension ContainerIterator: BorrowingIteratorProtocol
where
Base: ~Copyable /*FIXME: & ~Escapable*/,
@@ -13,7 +13,7 @@
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
public protocol DynamicContainer<Element>: RangeReplaceableContainer, ~Copyable
where Element: ~Copyable
{
@@ -25,7 +25,7 @@ where Element: ~Copyable
var freeCapacity: Int { get }
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension DynamicContainer where Self: ~Copyable, Element: ~Copyable {
@inlinable
public init() {
@@ -77,7 +77,7 @@ extension DynamicContainer where Self: ~Copyable, Element: ~Copyable {
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension DynamicContainer where Self: ~Copyable, Element: Copyable {
@inlinable
public init(repeating repeatedValue: Element, count: Int) {
@@ -13,7 +13,7 @@
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
public protocol MutableContainer<Element>:
PermutableContainer, ~Copyable, ~Escapable
where
@@ -30,7 +30,7 @@ where
// FIXME: What about previousMutableSpan?
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension MutableContainer
where Self: ~Copyable & ~Escapable, Element: ~Copyable
{
@@ -13,7 +13,7 @@
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
public protocol PermutableContainer<Element>: Container, ~Copyable, ~Escapable
where Element: ~Copyable
{
@@ -13,7 +13,7 @@
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.2, *)
@available(SwiftStdlib 6.4, *)
public protocol RandomAccessContainer<Element>
: BidirectionalContainer, ~Copyable, ~Escapable
where Element: ~Copyable {}
@@ -34,7 +34,7 @@ extension RandomAccessCollection {
}
}
@available(SwiftStdlib 6.2, *)
@available(SwiftStdlib 6.4, *)
extension RandomAccessContainer
where Self: ~Copyable & ~Escapable, Index: Strideable, Index.Stride == Int
{
@@ -91,7 +91,7 @@ where Self: ~Copyable & ~Escapable, Index: Strideable, Index.Stride == Int
// Disambiguate parallel extensions on RandomAccessContainer and RandomAccessCollection
@available(SwiftStdlib 6.2, *)
@available(SwiftStdlib 6.4, *)
extension RandomAccessCollection
where
Self: RandomAccessContainer,
@@ -15,7 +15,7 @@
// FIXME: Figure out if it would be possible to add the container-based
// `relative(to:)` to the existing `RangeExpression`.
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
public protocol RangeExpression2<Bound> {
associatedtype Bound: Comparable
@@ -26,7 +26,7 @@ public protocol RangeExpression2<Bound> {
func contains(_ element: Bound) -> Bool
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension Range: RangeExpression2 {
@inlinable
public func relative<C: Container & ~Copyable & ~Escapable>(
@@ -36,7 +36,7 @@ extension Range: RangeExpression2 {
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension ClosedRange: RangeExpression2 {
@inlinable
public func relative<C: Container & ~Copyable & ~Escapable>(
@@ -47,7 +47,7 @@ extension ClosedRange: RangeExpression2 {
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension PartialRangeFrom: RangeExpression2 {
@inlinable
public func relative<C: Container & ~Copyable & ~Escapable>(
@@ -57,7 +57,7 @@ extension PartialRangeFrom: RangeExpression2 {
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension PartialRangeUpTo: RangeExpression2 {
@inlinable
public func relative<C: Container & ~Copyable & ~Escapable>(
@@ -67,7 +67,7 @@ extension PartialRangeUpTo: RangeExpression2 {
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension PartialRangeThrough: RangeExpression2 {
@inlinable
public func relative<C: Container & ~Copyable & ~Escapable>(
@@ -19,7 +19,7 @@ import InternalCollectionsUtilities
//MARK: - Protocol Definition
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
public protocol RangeReplaceableContainer<Element>
: Container, ~Copyable, ~Escapable
where Element: ~Copyable
@@ -64,7 +64,7 @@ where Element: ~Copyable
//MARK: - Default Implementations
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension RangeReplaceableContainer
where Self: ~Copyable & ~Escapable, Element: ~Copyable
{
@@ -137,7 +137,7 @@ where Self: ~Copyable & ~Escapable, Element: ~Copyable
//MARK: - Standard Extensions
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension RangeReplaceableContainer
where Self: ~Copyable & ~Escapable, Element: ~Copyable
{
@@ -206,7 +206,7 @@ where Self: ~Copyable & ~Escapable, Element: ~Copyable
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension RangeReplaceableContainer
where Self: ~Copyable & ~Escapable, Element: ~Copyable {
@inlinable
@@ -258,7 +258,7 @@ where Self: ~Copyable & ~Escapable, Element: ~Copyable {
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension RangeReplaceableContainer
where
Self: BidirectionalContainer,
@@ -278,7 +278,7 @@ where
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension RangeReplaceableContainer
where Self: ~Copyable & ~Escapable, Element: ~Copyable
{
@@ -297,7 +297,7 @@ where Self: ~Copyable & ~Escapable, Element: ~Copyable
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension RangeReplaceableContainer
where Self: ~Copyable & ~Escapable, Element: ~Copyable
{
@@ -334,7 +334,7 @@ where Self: ~Copyable & ~Escapable, Element: ~Copyable
}
}
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension RangeReplaceableContainer
where Self: ~Copyable & ~Escapable, Element: ~Copyable {
@inlinable
@@ -367,7 +367,7 @@ where Self: ~Copyable & ~Escapable, Element: ~Copyable {
//MARK: - Standard Extensions Requiring Copyability
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension RangeReplaceableContainer
where
Self: ~Copyable & ~Escapable,
@@ -13,7 +13,7 @@
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
extension Producer where Self: ~Copyable & ~Escapable, Element: ~Copyable {
@inlinable
public consuming func collect<
@@ -13,9 +13,11 @@
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
#if false // Use the stdlib's definition
/// A borrowing iterator that provides access to the elements of a single
/// span through a `BorrowingIteratorProtocol` interface.
@available(SwiftStdlib 5.0, *)
@available(SwiftStdlib 6.4, *)
public struct SpanIterator<Element>: BorrowingIteratorProtocol, ~Copyable, ~Escapable
where Element: ~Copyable
{
@@ -59,3 +61,4 @@ public struct SpanIterator<Element>: BorrowingIteratorProtocol, ~Copyable, ~Esca
}
#endif
#endif
@@ -307,6 +307,7 @@ extension RigidDeque /*where Element: Copyable*/ {
}
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
internal mutating func _append<
S: BorrowingSequence<Element> & ~Copyable & ~Escapable
@@ -329,6 +330,7 @@ extension RigidDeque /*where Element: Copyable*/ {
/// - newElements: The new elements to copy into the deque.
///
/// - Complexity: O(*m*), where *m* is the length of `newElements`.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
public mutating func append<S: BorrowingSequence<Element> & ~Copyable & ~Escapable>(
copying newElements: borrowing S
@@ -369,6 +371,7 @@ extension RigidDeque /*where Element: Copyable*/ {
/// - items: The new elements to copy into the deque.
///
/// - Complexity: O(*m*), where *m* is the length of `items`.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
public mutating func append<
S: BorrowingSequence<Element> & Sequence<Element>
@@ -36,13 +36,14 @@ extension RigidDeque /*: Equatable */ where Element: Equatable /* & ~Copyable */
guard !left.isTriviallyIdentical(to: right) else { return true }
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
return left._elementsEqual(right)
#else
if #available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, visionOS 9999, *) { // FIXME: SwiftStdlib 6.4
return left._elementsEqual(right)
}
#endif
for i in 0 ..< left.count {
guard left[i] == right[i] else { return false }
}
return true
#endif
}
}
@@ -127,6 +127,7 @@ extension RigidDeque /*where Element: Copyable*/ {
/// - capacity: The storage capacity of the new deque.
/// - contents: A sequence whose contents to copy into the new deque.
/// The sequence must not contain more than `capacity` elements.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public init<
@@ -182,6 +183,7 @@ extension RigidDeque /*where Element: Copyable*/ {
/// - capacity: The storage capacity of the new deque.
/// - contents: A sequence whose contents to copy into the new deque.
/// The sequence must not contain more than `capacity` elements.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public init<
@@ -203,6 +205,7 @@ extension RigidDeque /*where Element: Copyable*/ {
/// than or equal to the count of the collection.
/// - contents: A collection whose contents to copy into the new deque.
/// The sequence must not contain more than `capacity` elements.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public init<
@@ -353,6 +353,7 @@ extension RigidDeque /* where Element: Copyable */ {
}
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@inlinable
internal mutating func _insertContainer<
C: Container<Element> & ~Copyable & ~Escapable
@@ -364,7 +365,7 @@ extension RigidDeque /* where Element: Copyable */ {
let expectedCount = self.count + newCount
var it = items.makeBorrowingIterator()
insert(addingCount: newCount, at: index) { target in
it.copyContents(into: &target)
it._copyContents(into: &target)
}
precondition(
it.nextSpan().isEmpty && self.count == expectedCount,
@@ -415,6 +416,7 @@ extension RigidDeque /* where Element: Copyable */ {
/// a valid index of the deque.
///
/// - Complexity: O(`self.count` + `items.count`).
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public mutating func insert<
@@ -477,6 +479,7 @@ extension RigidDeque /* where Element: Copyable */ {
/// a valid index of the deque.
///
/// - Complexity: O(`self.count` + `items.count`)
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public mutating func insert<
@@ -286,6 +286,7 @@ extension RigidDeque /*where Element: Copyable*/ {
}
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@inlinable
internal mutating func _prepend<
S: BorrowingSequence<Element> & ~Copyable & ~Escapable
@@ -302,6 +303,7 @@ extension RigidDeque /*where Element: Copyable*/ {
_handle.rotate(toStartAtOffset: oldCount)
}
@available(SwiftStdlib 6.4, *)
@inlinable
internal mutating func _prepend<
S: BorrowingSequence<Element> & ~Copyable & ~Escapable
@@ -330,6 +332,7 @@ extension RigidDeque /*where Element: Copyable*/ {
/// - items: The new elements to copy into the deque.
///
/// - Complexity: O(*m*), where *m* is the length of `items`.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
public mutating func prepend<S: BorrowingSequence<Element> & ~Copyable & ~Escapable>(
copying items: borrowing S
@@ -347,6 +350,7 @@ extension RigidDeque /*where Element: Copyable*/ {
/// - items: The new elements to copy into the deque.
///
/// - Complexity: O(`items.count`)
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
public mutating func prepend<C: Container<Element> & ~Copyable & ~Escapable>(
copying items: borrowing C
@@ -434,6 +438,7 @@ extension RigidDeque /*where Element: Copyable*/ {
/// - items: The new elements to copy into the deque.
///
/// - Complexity: O(*m*), where *m* is the length of `items`.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
public mutating func prepend<S: BorrowingSequence<Element> & Sequence<Element>>(
copying items: borrowing S
@@ -450,6 +455,7 @@ extension RigidDeque /*where Element: Copyable*/ {
/// - items: The new elements to copy into the deque.
///
/// - Complexity: O(*m*), where *m* is the length of `items`.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
public mutating func prepend<S: BorrowingSequence<Element> & Collection<Element>>(
copying items: borrowing S
@@ -466,6 +472,7 @@ extension RigidDeque /*where Element: Copyable*/ {
/// - items: The new elements to copy into the deque.
///
/// - Complexity: O(*m*), where *m* is the length of `items`.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
public mutating func prepend<C: Container<Element> & Sequence<Element>>(
copying items: borrowing C
@@ -482,6 +489,7 @@ extension RigidDeque /*where Element: Copyable*/ {
/// - items: The new elements to copy into the deque.
///
/// - Complexity: O(*m*), where *m* is the length of `items`.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
public mutating func prepend<C: Container<Element> & Collection<Element>>(
copying items: borrowing C
@@ -454,6 +454,7 @@ extension RigidDeque /* where Element: Copyable */ {
}
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@inlinable
internal mutating func _replace<
C: Container<Element> & ~Copyable & ~Escapable
@@ -466,7 +467,7 @@ extension RigidDeque /* where Element: Copyable */ {
let expectedCount = self.count - subrange.count + newCount
var it = items.makeBorrowingIterator()
self.replace(removing: subrange, addingCount: newCount) { target in
it.copyContents(into: &target)
it._copyContents(into: &target)
}
precondition(
it.nextSpan().isEmpty && count == expectedCount,
@@ -524,6 +525,7 @@ extension RigidDeque /* where Element: Copyable */ {
/// - items: The new elements to copy into the collection.
///
/// - Complexity: O(`self.count` + `items.count`)
@available(SwiftStdlib 6.4, *)
@inlinable
@inline(__always)
public mutating func replace<
@@ -601,6 +603,7 @@ extension RigidDeque /* where Element: Copyable */ {
///
/// - Complexity: O(*n* + *m*), where *n* is count of this deque and
/// *m* is the count of `items`.
@available(SwiftStdlib 6.4, *)
@inlinable
@inline(__always)
public mutating func replace<
@@ -294,6 +294,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
}
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
internal mutating func _append<
S: BorrowingSequence<Element> & ~Copyable & ~Escapable
@@ -318,6 +319,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
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
public mutating func append<S: BorrowingSequence<Element> & ~Copyable & ~Escapable>(
copying items: borrowing S
@@ -368,6 +370,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
///
/// - Complexity: O(*m*), where *m* is the length of `items`, when
/// amortized over many similar invocations over the same deque.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
public mutating func append<
S: BorrowingSequence<Element> & Sequence<Element>
@@ -147,6 +147,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
/// - capacity: The storage capacity of the new deque, or nil to let the
/// deque grow itself as needed to accomodate all items in `contents`.
/// - contents: A sequence whose contents to copy into the new deque.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public init<
@@ -186,6 +187,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
/// deque grow itself as needed to accomodate all items in `contents`.
/// - contents: A sequence whose contents to copy into the new deque.
/// The sequence must not contain more than `capacity` elements.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public init<
@@ -205,6 +207,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
/// - capacity: The storage capacity of the new deque.
/// - contents: A sequence whose contents to copy into the new deque.
/// The sequence must not contain more than `capacity` elements.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public init<
@@ -371,6 +371,7 @@ extension UniqueDeque /* where Element: Copyable */ {
}
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@inlinable
internal mutating func _insertContainer<
C: Container<Element> & ~Copyable & ~Escapable
@@ -382,7 +383,7 @@ extension UniqueDeque /* where Element: Copyable */ {
let expectedCount = self.count + newCount
var it = items.makeBorrowingIterator()
insert(addingCount: newCount, at: index) { target in
it.copyContents(into: &target)
it._copyContents(into: &target)
}
precondition(
it.nextSpan().isEmpty && count == expectedCount,
@@ -436,6 +437,7 @@ extension UniqueDeque /* where Element: Copyable */ {
///
/// - Complexity: O(`self.count` + `items.count`) when amortized over many
/// similar invocations on the same deque.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public mutating func insert<
@@ -502,6 +504,7 @@ extension UniqueDeque /* where Element: Copyable */ {
///
/// - Complexity: O(`self.count` + `items.count`) when amortized over many
/// similar invocations on the same deque.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
@inline(__always)
public mutating func insert<
@@ -316,6 +316,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
}
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@inlinable
internal mutating func _prepend<
S: BorrowingSequence<Element> & ~Copyable & ~Escapable
@@ -332,6 +333,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
_storage._handle.rotate(toStartAtOffset: oldCount)
}
@available(SwiftStdlib 6.4, *)
@inlinable
internal mutating func _prepend<
S: BorrowingSequence<Element> & ~Copyable & ~Escapable
@@ -361,6 +363,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
///
/// - Complexity: O(*m*), where *m* is the length of `items`, as amortized
/// over many similar invocations on the same deque.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
public mutating func prepend<
S: BorrowingSequence<Element> & ~Copyable & ~Escapable
@@ -381,6 +384,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
///
/// - Complexity: O(`items.count`) when amortized over many similar
/// invocations on the same deque.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
public mutating func prepend<C: Container<Element> & ~Copyable & ~Escapable>(
copying items: borrowing C
@@ -471,6 +475,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
///
/// - Complexity: O(*m*), where *m* is the length of `items`, as amortized
/// over many similar invocations on the same deque.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
public mutating func prepend<
S: BorrowingSequence<Element> & Sequence<Element>
@@ -490,6 +495,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.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
public mutating func prepend<
S: BorrowingSequence<Element> & Collection<Element>
@@ -509,6 +515,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.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
public mutating func prepend<C: Container<Element> & Sequence<Element>>(
copying items: borrowing C
@@ -526,6 +533,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.
@available(SwiftStdlib 6.4, *)
@_alwaysEmitIntoClient
public mutating func prepend<C: Container<Element> & Collection<Element>>(
copying items: C
@@ -463,6 +463,7 @@ extension UniqueDeque /* where Element: Copyable */ {
}
#if compiler(>=6.4) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW
@available(SwiftStdlib 6.4, *)
@inlinable
internal mutating func _replace<
C: Container<Element> & ~Copyable & ~Escapable
@@ -475,7 +476,7 @@ extension UniqueDeque /* where Element: Copyable */ {
let expectedCount = self.count - subrange.count + newCount
var it = items.makeBorrowingIterator()
self.replace(removing: subrange, addingCount: newCount) { target in
it.copyContents(into: &target)
it._copyContents(into: &target)
}
precondition(
it.nextSpan().isEmpty && count == expectedCount,
@@ -534,6 +535,7 @@ extension UniqueDeque /* where Element: Copyable */ {
/// - items: The new elements to copy into the collection.
///
/// - Complexity: O(`self.count` + `items.count`)
@available(SwiftStdlib 6.4, *)
@inlinable
@inline(__always)
public mutating func replace<
@@ -613,6 +615,7 @@ extension UniqueDeque /* where Element: Copyable */ {
///
/// - Complexity: O(*n* + *m*), where *n* is count of this deque and
/// *m* is the count of `items`.
@available(SwiftStdlib 6.4, *)
@inlinable
@inline(__always)
public mutating func replace<
+4 -4
View File
@@ -153,7 +153,6 @@
7D72468E2F3D9DDB00112FD0 /* _HTable+Bitmap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D72467B2F3D9DDB00112FD0 /* _HTable+Bitmap.swift */; };
7D7246902F3D9DDB00112FD0 /* _HTable+Sizing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D72467D2F3D9DDB00112FD0 /* _HTable+Sizing.swift */; };
7D7246922F3D9E6800112FD0 /* RigidSetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D7246912F3D9E6800112FD0 /* RigidSetTests.swift */; };
7D72F5952F75DA62004AB792 /* BorrowingSequence+SpanIterator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D72F5942F75DA62004AB792 /* BorrowingSequence+SpanIterator.swift */; };
7D72F5962F75DA62004AB792 /* BorrowingSequence+Algorithms.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D72F5932F75DA62004AB792 /* BorrowingSequence+Algorithms.swift */; };
7D72F5982F75E5E6004AB792 /* BorrowingSequenceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D72F5972F75E5E6004AB792 /* BorrowingSequenceTests.swift */; };
7D9748D42E9748930098631A /* BigString+Chunk+UTF16.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D9748D32E9748930098631A /* BigString+Chunk+UTF16.swift */; };
@@ -186,6 +185,7 @@
7DA23F582F32C66300E4C03A /* RigidArray+Equatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DA23F572F32C65900E4C03A /* RigidArray+Equatable.swift */; };
7DA23F5A2F32C68300E4C03A /* RigidArray+Hashable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DA23F592F32C67D00E4C03A /* RigidArray+Hashable.swift */; };
7DA23F5C2F32C69100E4C03A /* RigidArray+Descriptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DA23F5B2F32C68B00E4C03A /* RigidArray+Descriptions.swift */; };
7DACFA122F75FBF100291F2E /* SpanIterator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DACFA112F75FBF100291F2E /* SpanIterator.swift */; };
7DAD899E2E8B09C300DD5786 /* UInt+first and last set bit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DAD899C2E8B09C300DD5786 /* UInt+first and last set bit.swift */; };
7DAD899F2E8B09C300DD5786 /* UInt+reversed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DAD899D2E8B09C300DD5786 /* UInt+reversed.swift */; };
7DAD89A02E8B09C300DD5786 /* FixedWidthInteger+roundUpToPowerOfTwo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DAD899A2E8B09C300DD5786 /* FixedWidthInteger+roundUpToPowerOfTwo.swift */; };
@@ -753,7 +753,6 @@
7D7246852F3D9DDB00112FD0 /* RigidSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RigidSet.swift; sourceTree = "<group>"; };
7D7246912F3D9E6800112FD0 /* RigidSetTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RigidSetTests.swift; sourceTree = "<group>"; };
7D72F5932F75DA62004AB792 /* BorrowingSequence+Algorithms.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BorrowingSequence+Algorithms.swift"; sourceTree = "<group>"; };
7D72F5942F75DA62004AB792 /* BorrowingSequence+SpanIterator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BorrowingSequence+SpanIterator.swift"; sourceTree = "<group>"; };
7D72F5972F75E5E6004AB792 /* BorrowingSequenceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BorrowingSequenceTests.swift; sourceTree = "<group>"; };
7D9748CF2E9748930098631A /* BigString+Chunk+Character.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BigString+Chunk+Character.swift"; sourceTree = "<group>"; };
7D9748D02E9748930098631A /* BigString+Chunk+Index.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BigString+Chunk+Index.swift"; sourceTree = "<group>"; };
@@ -786,6 +785,7 @@
7DA23F572F32C65900E4C03A /* RigidArray+Equatable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RigidArray+Equatable.swift"; sourceTree = "<group>"; };
7DA23F592F32C67D00E4C03A /* RigidArray+Hashable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RigidArray+Hashable.swift"; sourceTree = "<group>"; };
7DA23F5B2F32C68B00E4C03A /* RigidArray+Descriptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RigidArray+Descriptions.swift"; sourceTree = "<group>"; };
7DACFA112F75FBF100291F2E /* SpanIterator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpanIterator.swift; sourceTree = "<group>"; };
7DAD899A2E8B09C300DD5786 /* FixedWidthInteger+roundUpToPowerOfTwo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FixedWidthInteger+roundUpToPowerOfTwo.swift"; sourceTree = "<group>"; };
7DAD899B2E8B09C300DD5786 /* Integer rank.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Integer rank.swift"; sourceTree = "<group>"; };
7DAD899C2E8B09C300DD5786 /* UInt+first and last set bit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UInt+first and last set bit.swift"; sourceTree = "<group>"; };
@@ -1262,7 +1262,6 @@
7D57EDC42F647DB10029D5E3 /* BorrowingIteratorProtocol+SpanwiseZip.swift */,
7D2A772B2F27F1E4005780C7 /* BorrowingSequence.swift */,
7D72F5932F75DA62004AB792 /* BorrowingSequence+Algorithms.swift */,
7D72F5942F75DA62004AB792 /* BorrowingSequence+SpanIterator.swift */,
7D2A772C2F27F1E4005780C7 /* BorrowingSequence+Standard Conformances.swift */,
7D2A772D2F27F1E4005780C7 /* BorrowingSequence+Utilities.swift */,
7D57EDCE2F647DB10029D5E3 /* Container */,
@@ -1286,6 +1285,7 @@
7D2A77342F27F1E4005780C7 /* Inout.swift */,
7D2A77352F27F1E4005780C7 /* InputSpan.swift */,
7D2A77362F27F1E4005780C7 /* Shared.swift */,
7DACFA112F75FBF100291F2E /* SpanIterator.swift */,
);
path = Types;
sourceTree = "<group>";
@@ -2684,6 +2684,7 @@
7DE9209A29CA70F4004483EB /* Rope+Append.swift in Sources */,
7DE9203F29CA70F3004483EB /* OrderedSet+Partial SetAlgebra isDisjoint.swift in Sources */,
7DC85F8D2F3FDC91004A4E3D /* String+Padding.swift in Sources */,
7DACFA122F75FBF100291F2E /* SpanIterator.swift in Sources */,
7DE9208629CA70F4004483EB /* BigString+LosslessStringConvertible.swift in Sources */,
7DE9204329CA70F3004483EB /* _HashTable+Bucket.swift in Sources */,
7DE9216A29CA70F4004483EB /* TreeDictionary.swift in Sources */,
@@ -2991,7 +2992,6 @@
7DE9217129CA70F4004483EB /* TreeDictionary+Values.swift in Sources */,
7D2A77262F27F1D1005780C7 /* Span+Extras.swift in Sources */,
7DE920D029CA70F4004483EB /* BitSet+SetAlgebra isSubset.swift in Sources */,
7D72F5952F75DA62004AB792 /* BorrowingSequence+SpanIterator.swift in Sources */,
7D72F5962F75DA62004AB792 /* BorrowingSequence+Algorithms.swift in Sources */,
7D479CD92F47CBBA00A8CB59 /* RigidDictionary+Initializers.swift in Sources */,
7DE920C829CA70F4004483EB /* BitSet+SetAlgebra isEqualSet.swift in Sources */,
+4 -2
View File
@@ -19,9 +19,10 @@ OTHER_SWIFT_FLAGS = $(inherited) \
-enable-experimental-feature BuiltinModule \
-enable-experimental-feature Lifetimes \
-enable-experimental-feature InoutLifetimeDependence \
-enable-experimental-feature SuppressedAssociatedTypesWithDefaults \
-enable-experimental-feature AddressableParameters \
-enable-experimental-feature AddressableTypes \
-enable-experimental-feature SuppressedAssociatedTypesWithDefaults \
-enable-experimental-feature BorrowingSequence \
-enable-experimental-feature "AvailabilityMacro=SwiftStdlib 5.0: macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2" \
-enable-experimental-feature "AvailabilityMacro=SwiftStdlib 5.1: macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0" \
-enable-experimental-feature "AvailabilityMacro=SwiftStdlib 5.6: macOS 12.3, iOS 15.4, watchOS 8.5, tvOS 15.4" \
@@ -32,7 +33,8 @@ OTHER_SWIFT_FLAGS = $(inherited) \
-enable-experimental-feature "AvailabilityMacro=SwiftStdlib 6.0: macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0" \
-enable-experimental-feature "AvailabilityMacro=SwiftStdlib 6.1: macOS 15.4, iOS 18.4, watchOS 11.4, tvOS 18.4, visionOS 2.4" \
-enable-experimental-feature "AvailabilityMacro=SwiftStdlib 6.2: macOS 26.0, iOS 26.0, watchOS 26.0, tvOS 26.0, visionOS 26.0" \
-enable-experimental-feature "AvailabilityMacro=SwiftStdlib 6.3: macOS 26.4, iOS 26.4, watchOS 26.4, tvOS 26.4, visionOS 26.4"
-enable-experimental-feature "AvailabilityMacro=SwiftStdlib 6.3: macOS 26.4, iOS 26.4, watchOS 26.4, tvOS 26.4, visionOS 26.4" \
-enable-experimental-feature "AvailabilityMacro=SwiftStdlib 6.4: macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999"
ONLY_ACTIVE_ARCH[config=Debug] = YES