[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

@@ -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<