[BasicContainers] Enable APIs scheduled to ship in 1.5.0

- `RigidArray.nextMutableSpan(after:maximumCount:)`
- `UniqueArray.nextMutableSpan(after:maximumCount:)`
- `RigidDeque.nextMutableSpan(after:maximumCount:)`
- `UniqueDeque.nextMutableSpan(after:maximumCount:)`
- `UniqueArray.init(minimumCapacity:)` (replacing `.init(capacity:)`)
- `UniqueDeque.init(minimumCapacity:)` (replacing `.init(capacity:)`)
- `RigidDeque.index(before:)`
- `UniqueDeque.index(before:)`
- `RigidDeque.formIndex(before:)`
- `UniqueDeque.formIndex(before:)`
This commit is contained in:
Karoy Lorentey committed 2026-05-05 16:01:31 -07:00
1 parent e07146a0ca
commit 022795168a
11 files changed
+39 -35

No files matched your search

+1
View File
@@ -47,6 +47,7 @@ target_sources(${module_name} PRIVATE
"UniqueDeque/UniqueDeque+Append.swift"
"UniqueDeque/UniqueDeque+Consumption.swift"
"UniqueDeque/UniqueDeque+Container.swift"
"UniqueDeque/UniqueDeque+Deprecated.swift"
"UniqueDeque/UniqueDeque+Descriptions.swift"
"UniqueDeque/UniqueDeque+Equatable.swift"
"UniqueDeque/UniqueDeque+Experimental.swift"
@@ -91,21 +91,17 @@ extension RigidDeque where Element: ~Copyable {
@inline(__always)
public func index(after index: Int) -> Int { index + 1 }
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW // FIXME: Enable unconditionally in 1.5.0
@_alwaysEmitIntoClient
@inline(__always)
public func index(before index: Int) -> Int { index - 1 }
#endif
@_alwaysEmitIntoClient
@inline(__always)
public func formIndex(after index: inout Int) { index += 1 }
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW // FIXME: Enable unconditionally in 1.5.0
@_alwaysEmitIntoClient
@inline(__always)
public func formIndex(before index: inout Int) { index -= 1 }
#endif
@_alwaysEmitIntoClient
@inline(__always)
@@ -132,7 +128,6 @@ extension RigidDeque where Element: ~Copyable {
return _overrideLifetime(Span(_unsafeElements: segment), borrowing: self)
}
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW // FIXME: Enable unconditionally in 1.5.0
@_lifetime(&self)
public mutating func nextMutableSpan(
after index: inout Int, maximumCount: Int
@@ -159,7 +154,6 @@ extension RigidDeque where Element: ~Copyable {
index &-= segment.count
return _overrideLifetime(Span(_unsafeElements: segment), borrowing: self)
}
#endif
}
#endif
@@ -60,21 +60,17 @@ extension UniqueDeque where Element: ~Copyable {
@inline(__always)
public func index(after index: Int) -> Int { index + 1 }
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW // FIXME: Enable unconditionally in 1.5.0
@_alwaysEmitIntoClient
@inline(__always)
public func index(before index: Int) -> Int { index - 1 }
#endif
@_alwaysEmitIntoClient
@inline(__always)
public func formIndex(after index: inout Int) { index += 1 }
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW // FIXME: Enable unconditionally in 1.5.0
@_alwaysEmitIntoClient
@inline(__always)
public func formIndex(before index: inout Int) { index -= 1 }
#endif
@_alwaysEmitIntoClient
@inline(__always)
@@ -95,7 +91,6 @@ extension UniqueDeque where Element: ~Copyable {
_storage.nextSpan(after: &index, maximumCount: maximumCount)
}
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW // FIXME: Enable unconditionally in 1.5.0
@_lifetime(&self)
public mutating func nextMutableSpan(
after index: inout Int, maximumCount: Int
@@ -108,7 +103,6 @@ extension UniqueDeque where Element: ~Copyable {
public func previousSpan(before index: inout Int, maximumCount: Int) -> Span<Element> {
_storage.previousSpan(before: &index, maximumCount: maximumCount)
}
#endif
}
#endif
@@ -0,0 +1,27 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2026 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
//
// SPDX-License-Identifier: Apache-2.0 WITH Swift-exception
//
//===----------------------------------------------------------------------===//
#if compiler(>=6.2)
@available(SwiftStdlib 5.0, *)
extension UniqueDeque where Element: ~Copyable {
/// Creates an empty unique deque with the specified capacity.
@available(*, deprecated, renamed: "init(minimumCapacity:)")
@_alwaysEmitIntoClient
@_transparent
public init(capacity: Int) {
_storage = .init(capacity: capacity)
}
}
#endif
@@ -29,21 +29,12 @@ extension UniqueDeque where Element: ~Copyable {
_storage = .init(capacity: 0)
}
/// Creates an empty unique deque with the specified capacity.
@_alwaysEmitIntoClient
@_transparent
public init(capacity: Int) {
_storage = .init(capacity: capacity)
}
#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW // FIXME: Enable unconditionally in 1.5.0
/// Creates an empty unique deque with the specified capacity.
@_alwaysEmitIntoClient
@_transparent
public init(minimumCapacity: Int) {
_storage = .init(capacity: minimumCapacity)
}
#endif
/// Creates a unique deque with the specified capacity, then calls the given
/// closure with an output span covering the deque's uninitialized memory.