mirror of
https://github.com/apple/swift-collections
synced 2026-11-22 04:20:40 +00:00
Drop support for Swift 6.0 and 6.1
This allows the use of Span types without `#if compiler` guards.
This commit is contained in:
145 files changed
+342
-1047
No files matched your search
@@ -1,339 +0,0 @@
|
||||
// swift-tools-version:6.0
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Collections open source project
|
||||
//
|
||||
// Copyright (c) 2021 - 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import PackageDescription
|
||||
|
||||
// This package recognizes the conditional compilation flags listed below.
|
||||
// To use enable them, uncomment the corresponding lines or define them
|
||||
// from the package manager command line:
|
||||
//
|
||||
// swift build -Xswiftc -DCOLLECTIONS_INTERNAL_CHECKS
|
||||
var defines: [String] = [
|
||||
|
||||
// Enables internal consistency checks at the end of initializers and
|
||||
// mutating operations. This can have very significant overhead, so enabling
|
||||
// this setting invalidates all documented performance guarantees.
|
||||
//
|
||||
// This is mostly useful while debugging an issue with the implementation of
|
||||
// the hash table itself. This setting should never be enabled in production
|
||||
// code.
|
||||
// "COLLECTIONS_INTERNAL_CHECKS",
|
||||
|
||||
// Hashing collections provided by this package usually seed their hash
|
||||
// function with the address of the memory location of their storage,
|
||||
// to prevent some common hash table merge/copy operations from regressing to
|
||||
// quadratic behavior. This setting turns off this mechanism, seeding
|
||||
// the hash function with the table's size instead.
|
||||
//
|
||||
// When used in conjunction with the SWIFT_DETERMINISTIC_HASHING environment
|
||||
// variable, this enables reproducible hashing behavior.
|
||||
//
|
||||
// This is mostly useful while debugging an issue with the implementation of
|
||||
// the hash table itself. This setting should never be enabled in production
|
||||
// code.
|
||||
// "COLLECTIONS_DETERMINISTIC_HASHING",
|
||||
|
||||
// Enables randomized testing of some data structure implementations.
|
||||
"COLLECTIONS_RANDOMIZED_TESTING",
|
||||
|
||||
// Enable this to build the sources as a single, large module.
|
||||
// This removes the distinct modules for each data structure, instead
|
||||
// putting them all directly into the `Collections` module.
|
||||
// Note: This is a source-incompatible variation of the default configuration.
|
||||
// "COLLECTIONS_SINGLE_MODULE",
|
||||
|
||||
// Enables longer, more exhaustive tests.
|
||||
// "COLLECTIONS_LONG_TESTS",
|
||||
]
|
||||
|
||||
let availabilityMacros: KeyValuePairs<String, String> = [
|
||||
"SwiftStdlib 5.0": "macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2",
|
||||
"SwiftStdlib 5.1": "macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0",
|
||||
"SwiftStdlib 5.6": "macOS 12.3, iOS 15.4, watchOS 8.5, tvOS 15.4",
|
||||
"SwiftStdlib 5.8": "macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4",
|
||||
"SwiftStdlib 5.9": "macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0",
|
||||
"SwiftStdlib 5.10": "macOS 14.4, iOS 17.4, watchOS 10.4, tvOS 17.4, visionOS 1.1",
|
||||
"SwiftStdlib 6.0": "macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0",
|
||||
"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 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0",
|
||||
"SwiftStdlib 6.5": "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.
|
||||
]
|
||||
|
||||
let extraSettings: [SwiftSetting] = [
|
||||
.enableUpcomingFeature("MemberImportVisibility"),
|
||||
.enableExperimentalFeature("BuiltinModule"),
|
||||
]
|
||||
|
||||
let _baseSettings: [SwiftSetting] = (
|
||||
defines.map { .define($0) }
|
||||
+ availabilityMacros.map { name, value in
|
||||
.enableExperimentalFeature("AvailabilityMacro=\(name): \(value)")
|
||||
}
|
||||
)
|
||||
|
||||
let _sharedSettings: [SwiftSetting] = _baseSettings + extraSettings
|
||||
let _settings: [SwiftSetting] = _sharedSettings + []
|
||||
let _testSettings: [SwiftSetting] = _sharedSettings + []
|
||||
|
||||
struct CustomTarget {
|
||||
enum Kind {
|
||||
case exported
|
||||
case hidden
|
||||
case test
|
||||
case testSupport
|
||||
}
|
||||
|
||||
var kind: Kind
|
||||
var name: String
|
||||
var dependencies: [Target.Dependency]
|
||||
var directory: String
|
||||
var exclude: [String]
|
||||
var sources: [String]?
|
||||
var settings: [SwiftSetting]
|
||||
}
|
||||
|
||||
extension CustomTarget.Kind {
|
||||
func path(for name: String) -> String {
|
||||
switch self {
|
||||
case .exported, .hidden: return "Sources/\(name)"
|
||||
case .test, .testSupport: return "Tests/\(name)"
|
||||
}
|
||||
}
|
||||
|
||||
var isTest: Bool {
|
||||
switch self {
|
||||
case .exported, .hidden: return false
|
||||
case .test, .testSupport: return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension CustomTarget {
|
||||
static func target(
|
||||
kind: Kind,
|
||||
name: String,
|
||||
dependencies: [Target.Dependency] = [],
|
||||
directory: String? = nil,
|
||||
exclude: [String] = [],
|
||||
sources: [String]? = nil,
|
||||
settings: [SwiftSetting]? = nil
|
||||
) -> CustomTarget {
|
||||
CustomTarget(
|
||||
kind: kind,
|
||||
name: name,
|
||||
dependencies: dependencies,
|
||||
directory: directory ?? name,
|
||||
exclude: exclude,
|
||||
sources: sources,
|
||||
settings: settings ?? (kind.isTest ? _testSettings : _settings))
|
||||
}
|
||||
|
||||
func toTarget() -> Target {
|
||||
var linkerSettings: [LinkerSetting] = []
|
||||
if kind == .testSupport {
|
||||
linkerSettings.append(
|
||||
.linkedFramework("XCTest", .when(platforms: [.macOS, .iOS, .watchOS, .tvOS])))
|
||||
}
|
||||
switch kind {
|
||||
case .exported, .hidden, .testSupport:
|
||||
return Target.target(
|
||||
name: name,
|
||||
dependencies: dependencies,
|
||||
path: kind.path(for: directory),
|
||||
exclude: exclude,
|
||||
sources: sources,
|
||||
swiftSettings: settings,
|
||||
linkerSettings: linkerSettings)
|
||||
case .test:
|
||||
return Target.testTarget(
|
||||
name: name,
|
||||
dependencies: dependencies,
|
||||
path: kind.path(for: directory),
|
||||
exclude: exclude,
|
||||
swiftSettings: settings,
|
||||
linkerSettings: linkerSettings)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let targets: [CustomTarget] = [
|
||||
.target(
|
||||
kind: .testSupport,
|
||||
name: "_CollectionsTestSupport",
|
||||
dependencies: [
|
||||
"InternalCollectionsUtilities",
|
||||
"ContainersPreview",
|
||||
"BasicContainers",
|
||||
"SpanPreview",
|
||||
]),
|
||||
.target(
|
||||
kind: .test,
|
||||
name: "CollectionsTestSupportTests",
|
||||
dependencies: ["_CollectionsTestSupport"]),
|
||||
.target(
|
||||
kind: .hidden,
|
||||
name: "InternalCollectionsUtilities",
|
||||
exclude: [
|
||||
"CMakeLists.txt",
|
||||
]),
|
||||
|
||||
.target(
|
||||
kind: .exported,
|
||||
name: "BasicContainers",
|
||||
dependencies: ["InternalCollectionsUtilities", "SpanPreview"],
|
||||
exclude: ["CMakeLists.txt"]
|
||||
),
|
||||
.target(
|
||||
kind: .test,
|
||||
name: "BasicContainersTests",
|
||||
dependencies: [
|
||||
"BasicContainers", "_CollectionsTestSupport"
|
||||
]),
|
||||
|
||||
.target(
|
||||
kind: .exported,
|
||||
name: "BitCollections",
|
||||
dependencies: ["InternalCollectionsUtilities"],
|
||||
exclude: ["CMakeLists.txt"]),
|
||||
.target(
|
||||
kind: .test,
|
||||
name: "BitCollectionsTests",
|
||||
dependencies: [
|
||||
"BitCollections", "_CollectionsTestSupport", "OrderedCollections"
|
||||
]),
|
||||
|
||||
.target(
|
||||
kind: .exported,
|
||||
name: "ContainersPreview",
|
||||
dependencies: [
|
||||
"InternalCollectionsUtilities",
|
||||
"BasicContainers",
|
||||
"DequeModule",
|
||||
"SpanPreview",
|
||||
],
|
||||
exclude: ["CMakeLists.txt"]),
|
||||
.target(
|
||||
kind: .test,
|
||||
name: "ContainersTests",
|
||||
dependencies: [
|
||||
"ContainersPreview", "_CollectionsTestSupport"
|
||||
]),
|
||||
|
||||
.target(
|
||||
kind: .exported,
|
||||
name: "DequeModule",
|
||||
dependencies: ["InternalCollectionsUtilities", "SpanPreview"],
|
||||
exclude: ["CMakeLists.txt"]),
|
||||
.target(
|
||||
kind: .test,
|
||||
name: "DequeTests",
|
||||
dependencies: ["DequeModule", "_CollectionsTestSupport"]),
|
||||
|
||||
.target(
|
||||
kind: .exported,
|
||||
name: "HashTreeCollections",
|
||||
dependencies: ["InternalCollectionsUtilities"],
|
||||
exclude: ["CMakeLists.txt"]),
|
||||
.target(
|
||||
kind: .test,
|
||||
name: "HashTreeCollectionsTests",
|
||||
dependencies: ["HashTreeCollections", "_CollectionsTestSupport"]),
|
||||
|
||||
.target(
|
||||
kind: .exported,
|
||||
name: "HeapModule",
|
||||
dependencies: ["InternalCollectionsUtilities"],
|
||||
exclude: ["CMakeLists.txt"]),
|
||||
.target(
|
||||
kind: .test,
|
||||
name: "HeapTests",
|
||||
dependencies: ["HeapModule", "_CollectionsTestSupport"]),
|
||||
|
||||
.target(
|
||||
kind: .exported,
|
||||
name: "OrderedCollections",
|
||||
dependencies: ["InternalCollectionsUtilities"],
|
||||
exclude: ["CMakeLists.txt"]),
|
||||
.target(
|
||||
kind: .test,
|
||||
name: "OrderedCollectionsTests",
|
||||
dependencies: ["OrderedCollections", "_CollectionsTestSupport"]),
|
||||
|
||||
.target(
|
||||
kind: .exported,
|
||||
name: "_RopeModule",
|
||||
dependencies: ["InternalCollectionsUtilities"],
|
||||
directory: "RopeModule",
|
||||
exclude: ["CMakeLists.txt"],
|
||||
// FIXME: _modify accessors in RopeModule seem to be broken in Swift 6 mode
|
||||
settings: _sharedSettings + [.swiftLanguageMode(.v5)]),
|
||||
.target(
|
||||
kind: .test,
|
||||
name: "RopeModuleTests",
|
||||
dependencies: ["_RopeModule", "_CollectionsTestSupport"]),
|
||||
|
||||
.target(
|
||||
kind: .exported,
|
||||
name: "SpanPreview",
|
||||
dependencies: ["InternalCollectionsUtilities"],
|
||||
exclude: ["CMakeLists.txt"]),
|
||||
.target(
|
||||
kind: .test,
|
||||
name: "SpanPreviewTests",
|
||||
dependencies: ["SpanPreview", "_CollectionsTestSupport"]),
|
||||
|
||||
.target(
|
||||
kind: .exported,
|
||||
name: "TrailingElementsModule",
|
||||
exclude: ["CMakeLists.txt"]),
|
||||
.target(
|
||||
kind: .test,
|
||||
name: "TrailingElementsTests",
|
||||
dependencies: ["TrailingElementsModule"]),
|
||||
|
||||
.target(
|
||||
kind: .exported,
|
||||
name: "Collections",
|
||||
dependencies: [
|
||||
"BitCollections",
|
||||
"DequeModule",
|
||||
"HashTreeCollections",
|
||||
"HeapModule",
|
||||
"OrderedCollections",
|
||||
"_RopeModule",
|
||||
//"SortedCollections",
|
||||
],
|
||||
exclude: ["CMakeLists.txt"]),
|
||||
.target(
|
||||
kind: .test,
|
||||
name: "CollectionsModuleTests",
|
||||
dependencies: ["Collections", "_CollectionsTestSupport"],
|
||||
settings: _baseSettings),
|
||||
]
|
||||
|
||||
let _products: [Product] = targets.compactMap { t in
|
||||
guard t.kind == .exported else { return nil }
|
||||
return .library(name: t.name, targets: [t.name])
|
||||
}
|
||||
let _targets: [Target] = targets.map { $0.toTarget() }
|
||||
|
||||
let package = Package(
|
||||
name: "swift-collections",
|
||||
products: _products,
|
||||
targets: _targets
|
||||
)
|
||||
@@ -15,7 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
extension _HTable {
|
||||
@usableFromInline
|
||||
@frozen
|
||||
@@ -70,7 +69,7 @@ extension _HTable.Bitmap {
|
||||
package func clearAll() {
|
||||
_words.update(repeating: .empty)
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
package func occupiedCount() -> Int {
|
||||
var c = 0
|
||||
@@ -197,4 +196,3 @@ extension _HTable.Bitmap {
|
||||
return result
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -15,7 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
extension _HTable {
|
||||
/// Identifies a particular bucket within a hash table by its offset.
|
||||
/// Having a dedicated wrapper type for this prevents passing a bucket number
|
||||
@@ -102,7 +101,7 @@ extension _HTable.Bucket {
|
||||
package var word: Int {
|
||||
Int(truncatingIfNeeded: offset &>> Word.wordShift)
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
package var bit: UInt {
|
||||
@@ -135,7 +134,7 @@ extension UnsafeMutableBufferPointer where Element: ~Copyable {
|
||||
return _ptr(at: bucket.offset)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
package func _ptr(
|
||||
@@ -143,7 +142,7 @@ extension UnsafeMutableBufferPointer where Element: ~Copyable {
|
||||
) -> UnsafeMutablePointer<Element> {
|
||||
_ptr(at: bucket.offset)
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
package func _initializeElement(
|
||||
@@ -152,7 +151,7 @@ extension UnsafeMutableBufferPointer where Element: ~Copyable {
|
||||
) {
|
||||
initializeElement(at: bucket.offset, to: value)
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
package func _extracting(_ buckets: Range<_HTable.Bucket>) -> Self {
|
||||
@@ -171,5 +170,3 @@ extension Range where Bound == _HTable.Bucket {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
extension _HTable {
|
||||
@usableFromInline
|
||||
package mutating func consumeAll(
|
||||
@@ -25,5 +23,3 @@ extension _HTable {
|
||||
clear()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -15,7 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
extension _HTable {
|
||||
package func maxOccupiedRun() -> Int {
|
||||
if isSmall { return self.count }
|
||||
@@ -61,7 +60,7 @@ extension _HTable {
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
|
||||
package func describe(
|
||||
bitmap: Bool = false,
|
||||
) -> String {
|
||||
@@ -78,11 +77,11 @@ extension _HTable {
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
|
||||
package var description: String {
|
||||
describe()
|
||||
}
|
||||
|
||||
|
||||
package func checkInvariants(
|
||||
failureHandler: (String) -> Void,
|
||||
hashGenerator: (Bucket) -> Int
|
||||
@@ -104,13 +103,13 @@ extension _HTable {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// large
|
||||
let c = bitmap.occupiedCount()
|
||||
if c != self.count {
|
||||
failureHandler("Count does not match bitmap count (count: \(self.count), bitmap: \(c))")
|
||||
}
|
||||
|
||||
|
||||
guard c > 0 else { return }
|
||||
// Start iterating from the first empty bucket, wrapping around once
|
||||
var it = self.makeBucketIterator()
|
||||
@@ -167,4 +166,3 @@ extension _HTable {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#if COLLECTIONS_SINGLE_MODULE
|
||||
|
||||
#if compiler(>=6.2)
|
||||
extension _HTable.BucketIterator {
|
||||
// FIXME: Remove after 27.0 releases
|
||||
@available(*, deprecated, renamed: "advanceToOccupied(maxCount:)")
|
||||
@@ -58,6 +57,3 @@ extension _HTable.BucketIterator {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
extension _HTable {
|
||||
@usableFromInline
|
||||
internal func find_Small(
|
||||
@@ -63,4 +62,3 @@ extension _HTable {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -11,7 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
extension _HTable {
|
||||
@usableFromInline
|
||||
internal mutating func insertNew_Small(
|
||||
@@ -27,8 +26,8 @@ extension _HTable {
|
||||
_maxProbeLength = _count
|
||||
return r
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@usableFromInline
|
||||
internal mutating func insertNew_Large(
|
||||
hashValue: Int,
|
||||
@@ -37,7 +36,7 @@ extension _HTable {
|
||||
) -> Bucket {
|
||||
assert(!isSmall)
|
||||
assert(!isFull)
|
||||
|
||||
|
||||
#if COLLECTIONS_NO_ROBIN_HOOD_HASHING
|
||||
let ideal = idealBucket(forHashValue: hashValue)
|
||||
let bitmap = self.bitmap
|
||||
@@ -84,4 +83,3 @@ extension _HTable {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -15,7 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
extension _HTable {
|
||||
@usableFromInline
|
||||
@_lifetime(borrow self)
|
||||
@@ -53,7 +52,7 @@ extension _HTable {
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
package var _bucket: Bucket
|
||||
|
||||
|
||||
/// Remaining bits not yet processed from the last word read.
|
||||
@_alwaysEmitIntoClient
|
||||
package var _nextBits: Word
|
||||
@@ -98,13 +97,13 @@ extension _HTable.BucketIterator {
|
||||
package var currentBucket: Bucket {
|
||||
_bucket
|
||||
}
|
||||
|
||||
|
||||
@usableFromInline
|
||||
@_transparent
|
||||
package var isAtEnd: Bool {
|
||||
_bucket >= _endBucket
|
||||
}
|
||||
|
||||
|
||||
@usableFromInline
|
||||
@_transparent
|
||||
package var isOccupied: Bool {
|
||||
@@ -112,7 +111,7 @@ extension _HTable.BucketIterator {
|
||||
if _words == nil { return true }
|
||||
return _nextBits.contains(0)
|
||||
}
|
||||
|
||||
|
||||
@_transparent
|
||||
@_lifetime(self: copy self)
|
||||
package mutating func restart() {
|
||||
@@ -123,7 +122,7 @@ extension _HTable.BucketIterator {
|
||||
_nextBitCount = UInt8(Swift.min(Word._capacity, _endBucket._offset))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@_transparent
|
||||
@_lifetime(self: copy self)
|
||||
package mutating func _wrap() {
|
||||
@@ -266,7 +265,7 @@ extension _HTable.BucketIterator {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@usableFromInline
|
||||
@_lifetime(self: copy self)
|
||||
package mutating func wrapToOccupied() {
|
||||
@@ -392,4 +391,3 @@ extension _HTable.BucketIterator {
|
||||
return Range(uncheckedBounds: (start, end))
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
extension _HTable {
|
||||
/// Create a hole at the specified occupied bucket without marking it as
|
||||
/// unoccupied or restoring the hash table's other invariants. After a hole
|
||||
@@ -25,7 +23,7 @@ extension _HTable {
|
||||
assert(isOccupied(bucket))
|
||||
_count &-= 1
|
||||
}
|
||||
|
||||
|
||||
/// Restore hash table invariants after a hole was created by `createHole`.
|
||||
/// This works by swapping items as needed to move the hole forward until we
|
||||
/// reach the end of the affected chain of occupied buckets.
|
||||
@@ -120,5 +118,3 @@ extension _HTable {
|
||||
return bucket
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
extension _HTable {
|
||||
@usableFromInline
|
||||
package mutating func migrateItems_Small(
|
||||
@@ -23,7 +21,7 @@ extension _HTable {
|
||||
assert(self.isSmall)
|
||||
assert(source.count <= self.capacity)
|
||||
guard !source.isEmpty else { return }
|
||||
|
||||
|
||||
// Let's reverse the order of members, to emphasize that this is not an
|
||||
// ordered container.
|
||||
let c = source.count
|
||||
@@ -41,7 +39,7 @@ extension _HTable {
|
||||
}
|
||||
source.clear()
|
||||
}
|
||||
|
||||
|
||||
@usableFromInline
|
||||
package mutating func migrateItems_Large(
|
||||
from source: inout _HTable,
|
||||
@@ -54,7 +52,7 @@ extension _HTable {
|
||||
assert(!self.isSmall)
|
||||
assert(source.count <= self.capacity)
|
||||
guard !source.isEmpty else { return }
|
||||
|
||||
|
||||
// Move & rehash items one by one.
|
||||
var it = source.makeBucketIterator()
|
||||
while let next = it.nextOccupiedRegion() {
|
||||
@@ -72,5 +70,3 @@ extension _HTable {
|
||||
source.clear()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -15,7 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
extension _HTable {
|
||||
/// The minimum hash table scale.
|
||||
@_alwaysEmitIntoClient
|
||||
@@ -26,7 +25,7 @@ extension _HTable {
|
||||
4
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// The maximum hash table scale.
|
||||
@_alwaysEmitIntoClient
|
||||
package static var maximumScale: UInt8 {
|
||||
@@ -36,7 +35,7 @@ extension _HTable {
|
||||
Swift.min(UInt8(truncatingIfNeeded: Int.bitWidth) &- 1, 56)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// The maximum number of items for which we do not create a hash table.
|
||||
@usableFromInline
|
||||
package static var maximumUnhashedCount: Int {
|
||||
@@ -45,7 +44,7 @@ extension _HTable {
|
||||
maximumCapacity(forScale: 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@inlinable
|
||||
@inline(__always)
|
||||
package static func wordCount(forScale scale: UInt8) -> Int {
|
||||
@@ -72,24 +71,24 @@ extension _HTable {
|
||||
// away. This provides hysteresis for storage capacities, preventing hash
|
||||
// tables from repeatedly shrinking/growing when only a handful of items are
|
||||
// added/removed in a loop.
|
||||
|
||||
|
||||
/// The numerator of the maximum hash table load factor.
|
||||
@_transparent
|
||||
internal static var _maxLFNum: UInt { 7 }
|
||||
|
||||
|
||||
/// The denominator of the maximum hash table load factor.
|
||||
@_transparent
|
||||
internal static var _maxLFDenom: UInt { 8 }
|
||||
|
||||
|
||||
/// The numerator of the minimum hash table load factor.
|
||||
@_transparent
|
||||
internal static var _minLFNum: UInt { 1 }
|
||||
|
||||
|
||||
/// The denominator of minimum hash table load factor.
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
internal static var _minLFDenom: UInt { 8 }
|
||||
|
||||
|
||||
/// The minimum number of items that can be held in a hash table of the given scale.
|
||||
@usableFromInline
|
||||
@_effects(readnone)
|
||||
@@ -99,7 +98,7 @@ extension _HTable {
|
||||
let bucketCount: UInt = 1 &<< scale
|
||||
return Int(bucketCount * _minLFNum / _minLFDenom)
|
||||
}
|
||||
|
||||
|
||||
/// The maximum number of items that can be held in a hash table of the given scale.
|
||||
@usableFromInline
|
||||
@_effects(readnone)
|
||||
@@ -108,8 +107,8 @@ extension _HTable {
|
||||
let bucketCount: UInt = 1 &<< scale
|
||||
return Int(bucketCount * _maxLFNum / _maxLFDenom)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// The minimum hash table scale that can hold the specified number of elements.
|
||||
@usableFromInline
|
||||
@_effects(readnone)
|
||||
@@ -151,4 +150,3 @@ extension _HTable {
|
||||
return (scale, capacity)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -15,7 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
@usableFromInline
|
||||
@frozen
|
||||
package struct _HTable: ~Copyable {
|
||||
@@ -30,13 +29,13 @@ package struct _HTable: ~Copyable {
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
package let _bitmap: UnsafeMutablePointer<Word>?
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
package var _maxProbeLength: Int
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
package let scale: UInt8
|
||||
|
||||
|
||||
// FIXME: Add a reservedScale for UniqueSet/UniqueDictonary
|
||||
|
||||
@inlinable
|
||||
@@ -61,7 +60,7 @@ package struct _HTable: ~Copyable {
|
||||
self._bitmap = bitmap
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@inlinable
|
||||
internal init(capacity: Int) {
|
||||
assert(capacity >= 0)
|
||||
@@ -69,7 +68,7 @@ package struct _HTable: ~Copyable {
|
||||
_capacity: capacity,
|
||||
scale: Self.minimumScale(forCapacity: capacity))
|
||||
}
|
||||
|
||||
|
||||
@inlinable
|
||||
internal init(minimumCapacity: Int) {
|
||||
precondition(minimumCapacity >= 0, "Capacity must be nonnegative")
|
||||
@@ -77,7 +76,7 @@ package struct _HTable: ~Copyable {
|
||||
self.init(_capacity: p.capacity, scale: p.scale)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
deinit {
|
||||
_bitmap?.deallocate()
|
||||
@@ -115,7 +114,7 @@ extension _HTable {
|
||||
_count == capacity
|
||||
}
|
||||
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
package var wordCount: Int {
|
||||
@@ -130,7 +129,7 @@ extension _HTable {
|
||||
package var startBucket: Bucket {
|
||||
Bucket(offset: 0)
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
package var endBucket: Bucket {
|
||||
@@ -149,13 +148,13 @@ extension _HTable {
|
||||
package var bucketCount: UInt {
|
||||
UInt(bitPattern: storageCapacity)
|
||||
}
|
||||
|
||||
|
||||
@_transparent
|
||||
@inlinable
|
||||
package func isValid(_ bucket: Bucket) -> Bool {
|
||||
bucket._offset < bucketCount
|
||||
}
|
||||
|
||||
|
||||
@_transparent
|
||||
@inlinable
|
||||
package func wrapBucket(after bucket: inout Bucket) {
|
||||
@@ -180,7 +179,7 @@ extension _HTable {
|
||||
Bitmap(table: self)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@_transparent
|
||||
@inlinable
|
||||
package func isOccupied(_ bucket: Bucket) -> Bool {
|
||||
@@ -236,4 +235,3 @@ extension _HTable {
|
||||
&& self.scale == other.scale
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
@_alwaysEmitIntoClient
|
||||
@@ -348,7 +346,7 @@ extension RigidArray {
|
||||
var it = self._append(prefixOf: newElements)
|
||||
precondition(it.next() == nil, "RigidArray capacity overflow")
|
||||
}
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
/// Copies the elements of a borrowing sequence to the end of this array.
|
||||
///
|
||||
@@ -372,4 +370,3 @@ extension RigidArray {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
#if UnstableContainersPreview
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
@@ -30,7 +28,7 @@ extension RigidArray where Element: ~Copyable {
|
||||
initializedCount: buffer.count)
|
||||
return _overrideLifetime(result, mutating: &self)
|
||||
}
|
||||
|
||||
|
||||
/// Remove the specified subrange of items from this array,
|
||||
/// passing an input span to the given function to consume them in place.
|
||||
///
|
||||
@@ -57,7 +55,7 @@ extension RigidArray where Element: ~Copyable {
|
||||
}
|
||||
let buffer = unsafe _storage.extracting(subrange)
|
||||
var span = InputSpan(buffer: buffer, initializedCount: buffer.count)
|
||||
|
||||
|
||||
consumer(&span)
|
||||
_ = consume span
|
||||
|
||||
@@ -167,15 +165,15 @@ extension RigidArray where Element: ~Copyable {
|
||||
|
||||
@usableFromInline
|
||||
internal var _offsetRange: Range<Int>
|
||||
|
||||
|
||||
@usableFromInline
|
||||
internal var _remainder: UnsafeMutableBufferPointer<Element>
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
@_lifetime(&_base)
|
||||
internal init(_base: inout RigidArray, offsetRange: Range<Int>) {
|
||||
|
||||
|
||||
self._remainder = _base._storage._extracting(unchecked: offsetRange)
|
||||
self._base = _MutableRef(&_base)
|
||||
self._offsetRange = offsetRange
|
||||
@@ -184,7 +182,7 @@ extension RigidArray where Element: ~Copyable {
|
||||
@inlinable
|
||||
deinit {
|
||||
self._remainder.deinitialize()
|
||||
|
||||
|
||||
// FIXME: This needs to be written as
|
||||
// self._base.value.closeGap(offsets: self._offsetRange)
|
||||
// but unfortunately we cannot mutate self in deinit yet.
|
||||
@@ -225,5 +223,3 @@ extension RigidArray.SubrangeConsumer where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
/// A Boolean value indicating whether this array contains no elements.
|
||||
@@ -442,5 +440,3 @@ extension RigidArray where Element: ~Copyable {
|
||||
return _span(in: Range(uncheckedBounds: (start, index)))
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
@available(*, deprecated, renamed: "nextSpan(after:maxCount:)")
|
||||
@@ -76,7 +74,7 @@ extension RigidArray where Element: ~Copyable {
|
||||
}
|
||||
return result.take()!
|
||||
}
|
||||
|
||||
|
||||
/// Inserts a given number of new items into this array at the specified
|
||||
/// position, using a callback to directly initialize array storage by
|
||||
/// populating an output span.
|
||||
@@ -140,8 +138,8 @@ extension RigidArray {
|
||||
public func copy() -> Self {
|
||||
clone()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// Copy the contents of this array into a newly allocated rigid array
|
||||
/// instance with the specified capacity.
|
||||
///
|
||||
@@ -240,5 +238,3 @@ extension RigidArray {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
// FIXME: Add this when/if SE-0499 gets implemented.
|
||||
//#if compiler(>=6.x)
|
||||
//@available(SwiftStdlib 5.0, *)
|
||||
@@ -42,6 +40,3 @@ extension RigidArray where Element: ~Copyable {
|
||||
"<\(count) items>"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
#if !COLLECTIONS_SINGLE_MODULE
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
@@ -52,5 +50,3 @@ extension RigidArray /*: Equatable */ where Element: Equatable /* & ~Copyable */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,7 +15,7 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2) && UnstableContainersPreview
|
||||
#if UnstableContainersPreview
|
||||
|
||||
#if false // FIXME
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
#if !COLLECTIONS_SINGLE_MODULE
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
@@ -40,5 +38,3 @@ extension RigidArray where Element: Hashable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
/// Initializes a new rigid array with zero capacity and no elements.
|
||||
@@ -28,7 +26,7 @@ extension RigidArray where Element: ~Copyable {
|
||||
_capacity = 0
|
||||
_count = 0
|
||||
}
|
||||
|
||||
|
||||
/// Initializes a new rigid array with the specified capacity and no elements.
|
||||
@inlinable
|
||||
public init(capacity: Int) {
|
||||
@@ -114,7 +112,7 @@ extension RigidArray /*where Element: Copyable*/ {
|
||||
self.init(capacity: capacity)
|
||||
self.append(copying: contents)
|
||||
}
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
/// Creates a new array with the specified capacity, holding a copy
|
||||
/// of the contents of a given container.
|
||||
@@ -135,9 +133,9 @@ extension RigidArray /*where Element: Copyable*/ {
|
||||
self.init(capacity: capacity)
|
||||
try self.append(copying: contents)
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
/// Creates a new array with the specified capacity, holding a copy
|
||||
/// of the contents of a given container.
|
||||
@@ -159,7 +157,7 @@ extension RigidArray /*where Element: Copyable*/ {
|
||||
try self.append(copying: contents)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/// Creates a new array with the specified capacity, holding a copy
|
||||
/// of the contents of a given collection.
|
||||
///
|
||||
@@ -196,5 +194,3 @@ extension RigidArray /*where Element: Copyable*/ {
|
||||
self.append(copying: span)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
/// Inserts a new element into the array at the specified position.
|
||||
@@ -403,5 +401,3 @@ extension RigidArray {
|
||||
_insertCollection(addingCount: items.count, copying: items, at: index)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
@inlinable
|
||||
@@ -36,5 +34,3 @@ extension RigidArray: Iterable where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
/// Removes all elements from the array, preserving its allocated capacity.
|
||||
@@ -157,5 +155,3 @@ extension RigidArray where Element: ~Copyable {
|
||||
return removeLast()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
/// Replaces the specified range of elements by a given count of new items,
|
||||
@@ -251,7 +249,7 @@ extension RigidArray where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if UnstableContainersPreview
|
||||
/// Replaces the specified range of elements by moving the contents of an
|
||||
/// input span into their place. On return, the span is left empty.
|
||||
@@ -595,5 +593,3 @@ extension RigidArray {
|
||||
newCount: newElements.count)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
/// Adds an element to the end of the array.
|
||||
@@ -93,7 +91,7 @@ extension UniqueArray where Element: ~Copyable {
|
||||
_ensureFreeCapacity(items.count)
|
||||
return _storage._appendUnchecked(moving: items)
|
||||
}
|
||||
|
||||
|
||||
#if UnstableContainersPreview
|
||||
/// Moves the elements of a input span to the end of this array, leaving the
|
||||
/// span empty.
|
||||
@@ -309,7 +307,7 @@ extension UniqueArray {
|
||||
self.append(item)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
/// Copies the elements of a container to the end of this array.
|
||||
///
|
||||
@@ -334,5 +332,3 @@ extension UniqueArray {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
#if UnstableContainersPreview
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
@@ -128,5 +126,3 @@ extension UniqueArray where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
/// A Boolean value indicating whether this array contains no elements.
|
||||
@@ -380,5 +378,3 @@ extension UniqueArray where Element: ~Copyable {
|
||||
_storage.previousSpan(before: &index, maxCount: maxCount)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
@available(*, deprecated, renamed: "nextSpan(after:maxCount:)")
|
||||
@@ -99,7 +97,7 @@ extension UniqueArray where Element: ~Copyable {
|
||||
}
|
||||
return result.take()!
|
||||
}
|
||||
|
||||
|
||||
/// Inserts a given number of new items into this array at the specified
|
||||
/// position, using a callback to directly initialize array storage by
|
||||
/// populating an output span.
|
||||
@@ -240,7 +238,7 @@ extension UniqueArray {
|
||||
public func copy() -> Self {
|
||||
self.clone()
|
||||
}
|
||||
|
||||
|
||||
/// Copy the contents of this array into a newly allocated unique array
|
||||
/// instance with the specified capacity.
|
||||
///
|
||||
@@ -290,5 +288,3 @@ extension UniqueArray {
|
||||
replaceSubrange(subrange, copying: newElements)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray /*: CustomStringConvertible */ where Element: ~Copyable {
|
||||
public var description: String {
|
||||
@@ -28,5 +26,3 @@ extension UniqueArray /*: CustomDebugStringConvertible */ where Element: ~Copyab
|
||||
"<\(count) items>"
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
#if !COLLECTIONS_SINGLE_MODULE
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
@@ -51,5 +49,3 @@ extension UniqueArray where Element: Equatable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,7 +15,7 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2) && UnstableContainersPreview
|
||||
#if UnstableContainersPreview
|
||||
|
||||
#if false // TODO
|
||||
extension UniqueArray /*where Element: Copyable*/ {
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
#if !COLLECTIONS_SINGLE_MODULE
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
@@ -38,5 +36,3 @@ extension UniqueArray where Element: Hashable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
/// Initializes a new unique array with no elements.
|
||||
@@ -24,7 +22,7 @@ extension UniqueArray where Element: ~Copyable {
|
||||
public init() {
|
||||
_storage = .init(capacity: 0)
|
||||
}
|
||||
|
||||
|
||||
/// Initializes a new unique array with the specified capacity and no elements.
|
||||
@inlinable
|
||||
public init(minimumCapacity: Int) {
|
||||
@@ -122,7 +120,7 @@ extension UniqueArray /*where Element: Copyable*/ {
|
||||
self.init(minimumCapacity: capacity ?? 0)
|
||||
self.append(copying: contents)
|
||||
}
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
/// Creates a new array with the specified initial capacity, holding a copy
|
||||
/// of the contents of a given container.
|
||||
@@ -162,5 +160,3 @@ extension UniqueArray /*where Element: Copyable*/ {
|
||||
self.append(copying: span)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
/// Inserts a new element into the array at the specified position.
|
||||
@@ -335,5 +333,3 @@ extension UniqueArray {
|
||||
addingCount: newCount, copying: newElements, at: index)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
/// Removes all elements from the array, preserving its
|
||||
@@ -141,5 +139,3 @@ extension UniqueArray where Element: ~Copyable {
|
||||
return removeLast()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
/// Replaces the specified range of elements by a given count of new items,
|
||||
@@ -468,7 +466,7 @@ extension UniqueArray {
|
||||
_ensureFreeCapacity(newElements.count - subrange.count)
|
||||
return _storage.replaceSubrange(subrange, copying: newElements)
|
||||
}
|
||||
|
||||
|
||||
/// Replaces the specified subrange of elements by copying the elements of
|
||||
/// the given collection.
|
||||
///
|
||||
@@ -513,4 +511,3 @@ extension UniqueArray {
|
||||
newCount: c)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -40,7 +40,7 @@ where Element: ~Copyable
|
||||
}
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2) && UnstableContainersPreview
|
||||
#if UnstableContainersPreview
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension InputSpan where Element: ~Copyable {
|
||||
@_alwaysEmitIntoClient
|
||||
|
||||
@@ -36,7 +36,7 @@ extension MutableSpan: RandomAccessContainer where Element: ~Copyable {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2) && UnstableContainersPreview
|
||||
#if UnstableContainersPreview
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension MutableSpan where Element: ~Copyable {
|
||||
@_alwaysEmitIntoClient
|
||||
@@ -86,7 +86,7 @@ extension MutableSpan where Element: ~Copyable {
|
||||
extension MutableSpan: MutableContainer where Element: ~Copyable {}
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2) && UnstableContainersPreview
|
||||
#if UnstableContainersPreview
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension MutableSpan where Element: ~Copyable {
|
||||
@_alwaysEmitIntoClient
|
||||
|
||||
@@ -47,7 +47,6 @@ extension Span: RandomAccessContainer where Element: ~Copyable {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension Span where Element: ~Copyable {
|
||||
@_alwaysEmitIntoClient
|
||||
@@ -91,4 +90,3 @@ extension Span where Element: ~Copyable {
|
||||
_spanBoundary(before: index, maxDistance: maxDistance, limitedBy: limit)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && UnstableContainersPreview
|
||||
|
||||
#if false // TODO
|
||||
import Builtin // For Shared.isIdentical
|
||||
|
||||
@@ -163,4 +161,3 @@ extension Shared where Storage: ~Copyable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidDeque where Element: ~Copyable {
|
||||
/// Adds an element to the end of the deque.
|
||||
@@ -137,7 +135,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
precondition(items.count <= freeCapacity, "RigidDeque capacity overflow")
|
||||
return _handle.uncheckedAppend(moving: items)
|
||||
}
|
||||
|
||||
|
||||
#if UnstableContainersPreview
|
||||
/// Moves the elements of an input span by appending them to the end of
|
||||
/// this deque, leaving the span empty.
|
||||
@@ -161,7 +159,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/// Moves the elements of an output span by appending them to the end of
|
||||
/// this deque, leaving the span empty.
|
||||
///
|
||||
@@ -208,7 +206,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
"RigidDeque capacity overflow")
|
||||
return _handle.uncheckedAppend(copying: items)
|
||||
}
|
||||
|
||||
|
||||
/// Copies the elements of a buffer and append them to the end of this
|
||||
/// deque.
|
||||
///
|
||||
@@ -227,7 +225,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
) -> Range<Int> {
|
||||
unsafe self.append(copying: UnsafeBufferPointer(items))
|
||||
}
|
||||
|
||||
|
||||
/// Copies the elements of a span and append them to the end of this deque.
|
||||
///
|
||||
/// If the deque does not have sufficient capacity to hold all items in the
|
||||
@@ -244,7 +242,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
unsafe self.append(copying: source)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@_alwaysEmitIntoClient
|
||||
@@ -259,7 +257,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
self.append(copying: span)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Copies the elements of a borrowing sequence and append them to the end of
|
||||
/// this deque.
|
||||
///
|
||||
@@ -279,7 +277,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
try self._append(copying: newElements)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/// Append the elements of a sequence to the end of this deque by copying
|
||||
/// them.
|
||||
///
|
||||
@@ -297,11 +295,11 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
return
|
||||
}
|
||||
if done != nil { return }
|
||||
|
||||
|
||||
var it = _handle.uncheckedAppend(copyingPrefixOf: newElements)
|
||||
precondition(it.next() == nil, "RigidDeque capacity overflow")
|
||||
}
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
/// Copies the elements of a borrowing sequence to the end of this deque.
|
||||
///
|
||||
@@ -324,5 +322,3 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidDeque where Element: ~Copyable {
|
||||
#if UnstableContainersPreview
|
||||
@@ -46,12 +44,12 @@ extension RigidDeque where Element: ~Copyable {
|
||||
) -> Index {
|
||||
_checkValidBounds(subrange)
|
||||
let segments = self._handle.mutableSegments(forOffsets: subrange)
|
||||
|
||||
|
||||
var span = InputSpan(
|
||||
buffer: segments.first, initializedCount: segments.first.count)
|
||||
consumer(&span)
|
||||
_ = consume span
|
||||
|
||||
|
||||
if let second = segments.second {
|
||||
var span = InputSpan(buffer: second, initializedCount: second.count)
|
||||
consumer(&span)
|
||||
@@ -87,7 +85,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
) -> Index {
|
||||
consumeSubrange(subrange.relative(to: indices), consumingWith: consumer)
|
||||
}
|
||||
|
||||
|
||||
/// Remove all items currently in this deque, passing a series of input
|
||||
/// spans to a given callback function to consume them in place.
|
||||
///
|
||||
@@ -108,7 +106,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
) {
|
||||
consumeSubrange(indices, consumingWith: consumer)
|
||||
}
|
||||
|
||||
|
||||
/// Remove the specified number of items from the end of this deque,
|
||||
/// passing an input span to a given callback function to consume them in
|
||||
/// place.
|
||||
@@ -267,5 +265,3 @@ extension RigidDeque.SubrangeConsumer where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidDeque where Element: ~Copyable {
|
||||
@_alwaysEmitIntoClient
|
||||
@@ -127,5 +125,3 @@ extension RigidDeque where Element: ~Copyable {
|
||||
return _overrideLifetime(Span(_unsafeElements: segment), borrowing: self)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidDeque where Element: ~Copyable {
|
||||
/// Grow or shrink the capacity of a rigid deque instance without discarding
|
||||
@@ -303,5 +301,3 @@ extension RigidDeque /* where Element: Copyable */ {
|
||||
replaceSubrange(subrange, copying: items)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidDeque /*: CustomStringConvertible */ where Element: ~Copyable {
|
||||
public var description: String {
|
||||
@@ -28,5 +26,3 @@ extension RigidDeque /*: CustomDebugStringConvertible */ where Element: ~Copyabl
|
||||
"<\(count) items>"
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
#if !COLLECTIONS_SINGLE_MODULE
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
@@ -65,5 +63,3 @@ extension RigidDeque where Element: Equatable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
#if !COLLECTIONS_SINGLE_MODULE
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
@@ -48,5 +46,3 @@ extension RigidDeque where Element: Hashable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidDeque where Element: ~Copyable {
|
||||
/// Initializes a new rigid deque with zero capacity and no elements.
|
||||
@@ -32,7 +30,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
public init(capacity: Int) {
|
||||
self.init(_handle: .allocate(capacity: capacity))
|
||||
}
|
||||
|
||||
|
||||
/// Creates a rigid deque with the specified capacity, then calls the given
|
||||
/// closure with an output span covering the deque's uninitialized memory.
|
||||
///
|
||||
@@ -141,7 +139,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
self.init(capacity: capacity ?? contents.count)
|
||||
self.append(copying: contents)
|
||||
}
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
/// Creates a new deque with the specified capacity, holding a copy
|
||||
/// of the contents of a given sequence.
|
||||
@@ -186,5 +184,3 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidDeque where Element: ~Copyable {
|
||||
/// Inserts a new element into the deque at the specified position.
|
||||
@@ -368,5 +366,3 @@ extension RigidDeque /* where Element: Copyable */ {
|
||||
at: index, copying: items, newCount: items.count)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidDeque where Element: ~Copyable {
|
||||
/// Adds an element to the front of the deque.
|
||||
@@ -34,7 +32,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
precondition(!isFull, "RigidDeque capacity overflow")
|
||||
_handle.uncheckedPrepend(item)
|
||||
}
|
||||
|
||||
|
||||
/// Adds an element to the front of the deque, if possible.
|
||||
///
|
||||
/// If the deque does not have sufficient capacity to hold any more elements,
|
||||
@@ -140,7 +138,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
precondition(items.count <= freeCapacity, "RigidDeque capacity overflow")
|
||||
return _handle.uncheckedPrepend(moving: items)
|
||||
}
|
||||
|
||||
|
||||
#if UnstableContainersPreview
|
||||
/// Moves the elements of an input span by prepending them to the front of
|
||||
/// this deque, leaving the span empty.
|
||||
@@ -164,7 +162,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/// Moves the elements of an output span by prepending them to the front of
|
||||
/// this deque, leaving the span empty.
|
||||
///
|
||||
@@ -212,7 +210,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
"RigidDeque capacity overflow")
|
||||
return _handle.uncheckedPrepend(copying: items)
|
||||
}
|
||||
|
||||
|
||||
/// Copies the elements of a buffer and prepend them to the front of this
|
||||
/// deque.
|
||||
///
|
||||
@@ -232,7 +230,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
) -> Range<Int> {
|
||||
unsafe self.prepend(copying: UnsafeBufferPointer(items))
|
||||
}
|
||||
|
||||
|
||||
/// Copy the elements of a span and prepend them to the front of this deque.
|
||||
///
|
||||
/// If the deque does not have sufficient capacity to hold all items in the
|
||||
@@ -250,7 +248,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
unsafe self.prepend(copying: source)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@inlinable
|
||||
@@ -287,7 +285,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
target._append(copying: span)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Copies the elements of a borrowing sequence and prepend them to the front
|
||||
/// of this deque.
|
||||
///
|
||||
@@ -380,7 +378,7 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
precondition(c <= freeCapacity, "RigidDeque capacity overflow")
|
||||
return _handle.uncheckedPrepend(copying: items, exactCount: c)
|
||||
}
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
/// Copies the elements of a borrowing sequence to the front of this deque.
|
||||
///
|
||||
@@ -420,4 +418,3 @@ extension RigidDeque /*where Element: Copyable*/ {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidDeque where Element: ~Copyable {
|
||||
/// Removes and returns the element at the specified position.
|
||||
@@ -64,7 +62,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
public mutating func removeAll() {
|
||||
_handle.uncheckedRemoveAll()
|
||||
}
|
||||
|
||||
|
||||
/// Removes and returns the first element of the deque.
|
||||
///
|
||||
/// The deque must not be empty.
|
||||
@@ -98,7 +96,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
precondition(!isEmpty, "Cannot remove last element of an empty RigidDeque")
|
||||
return _handle.uncheckedRemoveLast()
|
||||
}
|
||||
|
||||
|
||||
/// Removes and discards the specified number of elements from the start of
|
||||
/// the deque.
|
||||
///
|
||||
@@ -142,7 +140,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
precondition(n <= count, "Cannot remove more elements than there are in the container")
|
||||
_handle.uncheckedRemoveLast(n)
|
||||
}
|
||||
|
||||
|
||||
/// Removes the specified subrange of elements from the deque.
|
||||
///
|
||||
/// - Parameter bounds: The subrange to remove. The bounds of the
|
||||
@@ -188,5 +186,3 @@ extension RigidDeque where Element: ~Copyable {
|
||||
return _handle.uncheckedRemoveLast()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidDeque where Element: ~Copyable {
|
||||
/// Replaces the specified range of elements by a given count of new items,
|
||||
@@ -77,7 +75,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
addingCount: newItemCount,
|
||||
initializingWith: initializer)
|
||||
}
|
||||
|
||||
|
||||
#if UnstableContainersPreview
|
||||
/// Replaces the specified range of elements by a given count of new items,
|
||||
/// using callbacks to consume old items, and to then insert new ones.
|
||||
@@ -204,7 +202,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
assert(remainder.isEmpty)
|
||||
return range
|
||||
}
|
||||
|
||||
|
||||
#if UnstableContainersPreview
|
||||
/// Replaces the specified range of elements by moving the contents of an
|
||||
/// input span into their place. On return, the span is left empty.
|
||||
@@ -466,5 +464,3 @@ extension RigidDeque /* where Element: Copyable */ {
|
||||
_replaceSubrange(subrange, copyingCollection: items, newCount: items.count)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -18,8 +18,6 @@ import InternalCollectionsUtilities
|
||||
// This file contains exported but non-public entry points to support clear box
|
||||
// testing.
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidDeque where Element: ~Copyable {
|
||||
/// The number of the storage slot in this deque that holds the first element.
|
||||
@@ -48,7 +46,7 @@ extension RigidDeque {
|
||||
copying contents: some Sequence<Element>
|
||||
) {
|
||||
let contents = Array(contents)
|
||||
|
||||
|
||||
self.init(capacity: capacity)
|
||||
_handle.startSlot = _handle.slot(_handle.startSlot, offsetBy: startSlot)
|
||||
self.append(copying: contents)
|
||||
@@ -57,5 +55,3 @@ extension RigidDeque {
|
||||
assert(self.count == contents.count)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueDeque where Element: ~Copyable {
|
||||
/// Adds an element to the end of the deque.
|
||||
@@ -121,7 +119,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
_ensureFreeCapacity(items.count)
|
||||
return _storage._handle.uncheckedAppend(moving: items)
|
||||
}
|
||||
|
||||
|
||||
#if UnstableContainersPreview
|
||||
/// Moves the elements of an input span by appending them to the end of
|
||||
/// this deque, leaving the span empty.
|
||||
@@ -147,7 +145,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/// Moves the elements of an output span by appending them to the end of
|
||||
/// this deque, leaving the span empty.
|
||||
///
|
||||
@@ -302,7 +300,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
_storage.append(item)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
/// Copies the elements of a borrowing sequence to the end of this deque.
|
||||
///
|
||||
@@ -325,5 +323,3 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueDeque where Element: ~Copyable {
|
||||
#if UnstableContainersPreview
|
||||
@@ -70,7 +68,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
) {
|
||||
consumeSubrange(subrange.relative(to: indices), consumingWith: consumer)
|
||||
}
|
||||
|
||||
|
||||
/// Remove all items currently in this deque, passing a series of input
|
||||
/// spans to a given callback function to consume them in place.
|
||||
///
|
||||
@@ -91,7 +89,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
) {
|
||||
consumeSubrange(indices, consumingWith: consumer)
|
||||
}
|
||||
|
||||
|
||||
/// Remove the specified number of items from the end of this deque,
|
||||
/// passing an input span to a given callback function to consume them in
|
||||
/// place.
|
||||
@@ -162,5 +160,3 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueDeque where Element: ~Copyable {
|
||||
@_alwaysEmitIntoClient
|
||||
@@ -97,5 +95,3 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
_storage.previousSpan(before: &index, maxCount: maxCount)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueDeque where Element: ~Copyable {
|
||||
/// Creates an empty unique deque with the specified capacity.
|
||||
@@ -328,5 +326,3 @@ extension UniqueDeque /* where Element: Copyable */ {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueDeque /*: CustomStringConvertible */ where Element: ~Copyable {
|
||||
public var description: String {
|
||||
@@ -28,5 +26,3 @@ extension UniqueDeque /*: CustomDebugStringConvertible */ where Element: ~Copyab
|
||||
"<\(count) items>"
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
#if !COLLECTIONS_SINGLE_MODULE
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
@@ -51,5 +49,3 @@ extension UniqueDeque where Element: Equatable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
#if compiler(>=6.4)
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
extension UniqueDeque: Hashable where Element: Hashable & ~Copyable {
|
||||
@@ -34,5 +32,3 @@ extension UniqueDeque where Element: Hashable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueDeque where Element: ~Copyable {
|
||||
/// Initializes a new unique deque with no elements.
|
||||
@@ -122,7 +120,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
self.init(minimumCapacity: capacity ?? contents.underestimatedCount)
|
||||
self.append(copying: contents)
|
||||
}
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
/// Creates a new deque with the specified capacity, holding a copy
|
||||
/// of the contents of a given sequence.
|
||||
@@ -164,5 +162,3 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueDeque where Element: ~Copyable {
|
||||
/// Inserts a new element into the deque at the specified position.
|
||||
@@ -386,5 +384,3 @@ extension UniqueDeque /* where Element: Copyable */ {
|
||||
at: index, copying: items, newCount: items.count)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueDeque where Element: ~Copyable {
|
||||
/// Adds an element to the front of the deque.
|
||||
@@ -126,7 +124,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
_ensureFreeCapacity(items.count)
|
||||
return _storage._handle.uncheckedPrepend(moving: items)
|
||||
}
|
||||
|
||||
|
||||
#if UnstableContainersPreview
|
||||
/// Moves the elements of an input span by prepending them to the front of
|
||||
/// this deque, leaving the span empty.
|
||||
@@ -152,7 +150,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/// Moves the elements of an output span by prepending them to the front of
|
||||
/// this deque, leaving the span empty.
|
||||
///
|
||||
@@ -201,7 +199,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
_ensureFreeCapacity(items.count)
|
||||
return _storage._handle.uncheckedPrepend(copying: items)
|
||||
}
|
||||
|
||||
|
||||
/// Copies the elements of a buffer and prepend them to the front of this
|
||||
/// deque.
|
||||
///
|
||||
@@ -221,7 +219,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
) -> Range<Int> {
|
||||
unsafe self.prepend(copying: UnsafeBufferPointer(items))
|
||||
}
|
||||
|
||||
|
||||
/// Copy the elements of a span and prepend them to the front of this deque.
|
||||
///
|
||||
/// If the deque does not have sufficient capacity to hold all items in the
|
||||
@@ -239,7 +237,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
unsafe self.prepend(copying: source)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
@available(SwiftStdlib 6.4, *)
|
||||
@inlinable
|
||||
@@ -273,7 +271,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
target._append(copying: span)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Copies the elements of a borrowing sequence and prepend them to the front
|
||||
/// of this deque.
|
||||
///
|
||||
@@ -370,7 +368,7 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
_ensureFreeCapacity(c)
|
||||
return _storage._handle.uncheckedPrepend(copying: items, exactCount: c)
|
||||
}
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
/// Copies the elements of a borrowing sequence to the end of this deque.
|
||||
///
|
||||
@@ -412,4 +410,3 @@ extension UniqueDeque /*where Element: Copyable*/ {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueDeque where Element: ~Copyable {
|
||||
/// Removes and returns the element at the specified position.
|
||||
@@ -36,7 +34,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
public mutating func remove(at index: Int) -> Element {
|
||||
_storage.remove(at: index)
|
||||
}
|
||||
|
||||
|
||||
/// Removes all elements from the deque, preserving its allocated capacity.
|
||||
///
|
||||
/// - Complexity: O(`count`)
|
||||
@@ -45,7 +43,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
public mutating func removeAll() {
|
||||
_storage.removeAll()
|
||||
}
|
||||
|
||||
|
||||
/// Removes and returns the first element of the deque.
|
||||
///
|
||||
/// The deque must not be empty.
|
||||
@@ -59,7 +57,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
public mutating func removeFirst() -> Element {
|
||||
_storage.removeFirst()
|
||||
}
|
||||
|
||||
|
||||
/// Removes and returns the last element of the deque.
|
||||
///
|
||||
/// The deque must not be empty.
|
||||
@@ -73,7 +71,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
public mutating func removeLast() -> Element {
|
||||
_storage.removeLast()
|
||||
}
|
||||
|
||||
|
||||
/// Removes and discards the specified number of elements from the start of
|
||||
/// the deque.
|
||||
///
|
||||
@@ -90,7 +88,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
public mutating func removeFirst(_ k: Int) {
|
||||
_storage.removeFirst(k)
|
||||
}
|
||||
|
||||
|
||||
/// Removes and discards the specified number of elements from the end of the
|
||||
/// deque.
|
||||
///
|
||||
@@ -107,7 +105,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
public mutating func removeLast(_ k: Int) {
|
||||
_storage.removeLast(k)
|
||||
}
|
||||
|
||||
|
||||
/// Removes the specified subrange of elements from the deque.
|
||||
///
|
||||
/// - Parameter bounds: The subrange to remove. The bounds of the
|
||||
@@ -149,5 +147,3 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
_storage.popLast()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueDeque where Element: ~Copyable {
|
||||
/// Replaces the specified range of elements by a given count of new items,
|
||||
@@ -89,7 +87,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
addingCount: newItemCount,
|
||||
initializingWith: initializer)
|
||||
}
|
||||
|
||||
|
||||
#if UnstableContainersPreview
|
||||
/// Replaces the specified range of elements by a given count of new items,
|
||||
/// using callbacks to consume old items, and to then insert new ones.
|
||||
@@ -212,7 +210,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
assert(remainder.isEmpty)
|
||||
return range
|
||||
}
|
||||
|
||||
|
||||
#if UnstableContainersPreview
|
||||
/// Replaces the specified range of elements by moving the contents of an
|
||||
/// input span into their place. On return, the span is left empty.
|
||||
@@ -480,5 +478,3 @@ extension UniqueDeque /* where Element: Copyable */ {
|
||||
_replaceSubrange(subrange, copyingCollection: items, newCount: items.count)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -215,13 +215,13 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
guard position < capacity else { return Slot(at: position &- capacity) }
|
||||
return Slot(at: position)
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
internal func distance(from start: Slot, to end: Slot) -> Int {
|
||||
assert(start.position >= 0 && start.position <= capacity)
|
||||
assert(end.position >= 0 && end.position <= capacity)
|
||||
|
||||
|
||||
if end.position >= start.position {
|
||||
return end.position - start.position
|
||||
} else {
|
||||
@@ -633,7 +633,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
}
|
||||
self.count = 0
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
internal mutating func unsafeConsumePrefix(
|
||||
@@ -666,7 +666,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
mutablePtr(at: endSlot).initialize(to: element)
|
||||
count &+= 1
|
||||
}
|
||||
|
||||
|
||||
/// Prepend `element` to the front of this buffer. The buffer must have enough
|
||||
/// free capacity to insert one new element.
|
||||
///
|
||||
@@ -683,7 +683,6 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=6.2)
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UnsafeMutableBufferPointer where Element: ~Copyable {
|
||||
@_alwaysEmitIntoClient
|
||||
@@ -700,7 +699,6 @@ extension UnsafeMutableBufferPointer where Element: ~Copyable {
|
||||
return try body(&span)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
@_alwaysEmitIntoClient
|
||||
@@ -727,7 +725,6 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=6.2)
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
/// Append a given number of items to the end of this deque by populating
|
||||
@@ -769,7 +766,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
}
|
||||
return Range(uncheckedBounds: (origCount, count))
|
||||
}
|
||||
|
||||
|
||||
/// Prepend a given number of items to the end of this deque by populating
|
||||
/// a series of storage regions through repeated calls of the specified
|
||||
/// callback function.
|
||||
@@ -835,7 +832,6 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
return Range(uncheckedBounds: (0, c))
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
@@ -858,7 +854,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
|
||||
gap.first.moveInitializeAll(
|
||||
fromContentsOf: items._extracting(first: gap.first.count))
|
||||
|
||||
|
||||
if let second = gap.second {
|
||||
assert(gap.first.count + second.count == items.count)
|
||||
second.moveInitializeAll(
|
||||
@@ -866,7 +862,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
}
|
||||
return Range(uncheckedBounds: (count &- items.count, count))
|
||||
}
|
||||
|
||||
|
||||
/// Prepends the elements of a buffer to the front of this deque, leaving the
|
||||
/// buffer uninitialized.
|
||||
///
|
||||
@@ -886,7 +882,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
|
||||
gap.first.moveInitializeAll(
|
||||
fromContentsOf: items._extracting(first: gap.first.count))
|
||||
|
||||
|
||||
if let second = gap.second {
|
||||
assert(gap.first.count + second.count == items.count)
|
||||
second.moveInitializeAll(
|
||||
@@ -911,7 +907,7 @@ extension _UnsafeDequeHandle {
|
||||
gap.initialize(copying: source)
|
||||
return Range(uncheckedBounds: (count &- source.count, count))
|
||||
}
|
||||
|
||||
|
||||
/// Prepend the contents of `source` to this buffer. The buffer must have
|
||||
/// enough free capacity to insert the new elements.
|
||||
///
|
||||
@@ -941,7 +937,7 @@ extension _UnsafeDequeHandle {
|
||||
self.count += c
|
||||
return it
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
internal mutating func uncheckedPrepend<C: Collection<Element>>(
|
||||
@@ -1259,7 +1255,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
if gapSize > 0 {
|
||||
_ = openGap(ofSize: gapSize, atOffset: newStart)
|
||||
}
|
||||
|
||||
|
||||
// With the prefix and suffix swapped, update the starting slot and
|
||||
// restore the count.
|
||||
startSlot = slot(startSlot, offsetBy: newStart - oldCount)
|
||||
@@ -1291,7 +1287,6 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=6.2)
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
@_alwaysEmitIntoClient
|
||||
@@ -1302,7 +1297,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
) throws(E) -> Range<Int> {
|
||||
guard newItemCount > 0 else { return offset ..< offset }
|
||||
let gap = self.openGap(ofSize: newItemCount, atOffset: offset)
|
||||
|
||||
|
||||
var c = 0
|
||||
defer {
|
||||
if c < newItemCount {
|
||||
@@ -1316,7 +1311,6 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
return Range(uncheckedBounds: (offset, offset &+ c))
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension _UnsafeDequeHandle {
|
||||
/// Insert all elements from `newElements` into this deque, starting at
|
||||
@@ -1355,7 +1349,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
closeGap(offsets: Range(uncheckedBounds: (offset, offset + 1)))
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
internal mutating func uncheckedRemoveFirst() -> Element {
|
||||
@@ -1365,7 +1359,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
count -= 1
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
internal mutating func uncheckedRemoveLast() -> Element {
|
||||
@@ -1375,7 +1369,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
count -= 1
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
internal mutating func uncheckedRemoveFirst(_ n: Int) {
|
||||
@@ -1386,7 +1380,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
startSlot = slot(startSlot, offsetBy: n)
|
||||
count -= n
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
internal mutating func uncheckedRemoveLast(_ n: Int) {
|
||||
@@ -1396,7 +1390,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
target.deinitialize()
|
||||
count -= n
|
||||
}
|
||||
|
||||
|
||||
/// Remove all elements stored in this instance, deinitializing their storage.
|
||||
///
|
||||
/// This method does not ensure that the storage buffer is uniquely
|
||||
@@ -1410,7 +1404,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
count = 0
|
||||
startSlot = .zero
|
||||
}
|
||||
|
||||
|
||||
/// Remove all elements in `bounds`, deinitializing their storage and sliding
|
||||
/// remaining elements to close the resulting gap.
|
||||
///
|
||||
@@ -1420,7 +1414,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
@_transparent
|
||||
internal mutating func uncheckedRemove(offsets bounds: Range<Int>) -> Int {
|
||||
assert(bounds.lowerBound >= 0 && bounds.upperBound <= self.count)
|
||||
|
||||
|
||||
// Deinitialize elements in `bounds`.
|
||||
mutableSegments(forOffsets: bounds).deinitialize()
|
||||
closeGap(offsets: bounds)
|
||||
@@ -1430,7 +1424,6 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
|
||||
// MARK: Replacement
|
||||
|
||||
#if compiler(>=6.2)
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
@_alwaysEmitIntoClient
|
||||
@@ -1456,7 +1449,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
subrange.lowerBound,
|
||||
subrange.lowerBound &+ newItemCount))
|
||||
let gap = self.mutableSegments(forOffsets: newRange)
|
||||
|
||||
|
||||
var c = 0
|
||||
defer {
|
||||
if c < newItemCount {
|
||||
@@ -1519,4 +1512,3 @@ extension _UnsafeDequeHandle where Element: ~Copyable {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -11,7 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
/// Unsafely discard any lifetime dependency on the `dependent` argument.
|
||||
/// Return a value identical to `dependent` with an immortal lifetime.
|
||||
@unsafe
|
||||
@@ -90,5 +89,3 @@ public func _overrideLifetime<
|
||||
>(
|
||||
_ dependent: inout T, borrowing source: borrowing U
|
||||
) {}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension MutableSpan where Element: ~Copyable {
|
||||
// FIXME: Replace with stdlib implementation when it becomes available
|
||||
@@ -146,5 +144,3 @@ extension MutableSpan /* where Element: Copyable */ {
|
||||
precondition(i == self.count)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
@_alwaysEmitIntoClient
|
||||
package func withTemporaryOutputSpan<Element: ~Copyable, E: Error, R: ~Copyable>(
|
||||
@@ -168,6 +166,3 @@ extension OutputSpan where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@_frozen
|
||||
@usableFromInline
|
||||
package struct _ShamSpanIterator {
|
||||
@@ -238,5 +236,3 @@ extension Span where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
/// A polyfill of the typed-throws supporting `withUnsafeTemporaryAllocation` in the 6.3 stdlib.
|
||||
@_alwaysEmitIntoClient @_transparent
|
||||
package func _withUnsafeTemporaryAllocation<
|
||||
@@ -34,5 +32,3 @@ package func _withUnsafeTemporaryAllocation<
|
||||
return try r.get()
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -214,7 +214,6 @@ extension UnsafeMutableBufferPointer {
|
||||
_initializePrefix(copying: UnsafeBufferPointer(source))
|
||||
}
|
||||
|
||||
#if compiler(>=6.2)
|
||||
/// Initialize slots at the start of this buffer by copying data from `source`.
|
||||
///
|
||||
/// If `Element` is not bitwise copyable, then the memory region addressed by `self` must be
|
||||
@@ -228,7 +227,6 @@ extension UnsafeMutableBufferPointer {
|
||||
package func _initializePrefix(copying source: Span<Element>) -> Int {
|
||||
source.withUnsafeBufferPointer { self._initializePrefix(copying: $0) }
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Initialize slots at the start of this buffer by copying data from `buffer`, then
|
||||
/// shrink `self` to drop all initialized items from its front, leaving it addressing the
|
||||
@@ -244,7 +242,6 @@ extension UnsafeMutableBufferPointer {
|
||||
self = self.extracting(i...)
|
||||
}
|
||||
|
||||
#if compiler(>=6.2)
|
||||
/// Initialize slots at the start of this buffer by copying data from `span`, then
|
||||
/// shrink `self` to drop all initialized items from its front, leaving it addressing the
|
||||
/// uninitialized remainder.
|
||||
@@ -260,7 +257,6 @@ extension UnsafeMutableBufferPointer {
|
||||
self._initializeAndDropPrefix(copying: buffer)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
extension UnsafeMutableBufferPointer {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString {
|
||||
@@ -148,4 +148,4 @@ extension BigString.Builder {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString {
|
||||
@@ -560,4 +560,4 @@ extension BigString {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString {
|
||||
@@ -20,4 +20,4 @@ extension BigString {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString {
|
||||
@@ -238,4 +238,4 @@ extension BigString {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString {
|
||||
@@ -172,4 +172,4 @@ extension BigString._Chunk {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString {
|
||||
@@ -38,4 +38,4 @@ extension BigString {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
internal protocol _StringMetric: RopeMetric where Element == BigString._Chunk {
|
||||
@@ -296,4 +296,4 @@ extension BigString {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString {
|
||||
@@ -81,4 +81,4 @@ extension BigString.Summary: RopeSummary {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
/// The core of a B-tree based String implementation.
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
@@ -26,4 +26,4 @@ public struct BigString: Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString._Chunk {
|
||||
@@ -242,4 +242,4 @@ extension BigString._Chunk {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString._Chunk {
|
||||
@@ -78,4 +78,4 @@ extension BigString._Chunk {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString._Chunk {
|
||||
@@ -301,4 +301,4 @@ extension BigString._Chunk {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString._Chunk {
|
||||
@@ -151,4 +151,4 @@ extension BigString._Chunk.Counts {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -15,7 +15,7 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString._Chunk: CustomStringConvertible {
|
||||
@@ -70,4 +70,4 @@ extension BigString._Chunk: CustomStringConvertible {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString._Chunk {
|
||||
@@ -142,4 +142,4 @@ extension BigString._Chunk.Index: CustomStringConvertible {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString._Chunk: RopeElement {
|
||||
@@ -155,4 +155,4 @@ extension BigString._Chunk {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString._Chunk {
|
||||
@@ -144,4 +144,4 @@ extension BigString._Chunk {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString._Chunk {
|
||||
@@ -178,4 +178,4 @@ extension BigString._Chunk {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString._Chunk {
|
||||
@@ -25,4 +25,4 @@ extension BigString._Chunk {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString._Chunk {
|
||||
@@ -139,4 +139,4 @@ extension BigString._Chunk {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString {
|
||||
@@ -195,4 +195,4 @@ extension BigString._Chunk {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString: BidirectionalCollection {
|
||||
@@ -74,4 +74,4 @@ extension BigString {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString: Comparable {
|
||||
@@ -38,4 +38,4 @@ extension BigString: Comparable {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
+2
-2
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString: CustomDebugStringConvertible {
|
||||
@@ -20,4 +20,4 @@ extension BigString: CustomDebugStringConvertible {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString: CustomStringConvertible {
|
||||
@@ -20,4 +20,4 @@ extension BigString: CustomStringConvertible {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2) && !$Embedded
|
||||
#if !$Embedded
|
||||
|
||||
@available(SwiftStdlib 6.2, *)
|
||||
extension BigString {
|
||||
@@ -104,4 +104,4 @@ extension BigString {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // compiler(>=6.2) && !$Embedded
|
||||
#endif // !$Embedded
|
||||
Loaded 100 of 145 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user