Merge pull request #423 from apple/release-1.2-setup

Set up release/1.2 branch
This commit is contained in:
Karoy Lorentey authored and GitHub committed 2024-10-01 12:51:07 -07:00
commit ee59f38779
79 files changed
+116 -2117

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
LinuxSwiftPackageJob {
swift_version_tag = "5.10-jammy"
repo = "swift-collections"
branch = "release/1.1"
branch = "release/1.2"
}
-5
View File
@@ -1,5 +0,0 @@
LinuxSwiftPackageJob {
swift_version_tag = "5.7-jammy"
repo = "swift-collections"
branch = "release/1.1"
}
-5
View File
@@ -1,5 +0,0 @@
LinuxSwiftPackageJob {
swift_version_tag = "5.8-jammy"
repo = "swift-collections"
branch = "release/1.1"
}
+1 -1
View File
@@ -1,5 +1,5 @@
LinuxSwiftPackageJob {
swift_version_tag = "5.9-jammy"
repo = "swift-collections"
branch = "release/1.1"
branch = "release/1.2"
}
+1 -1
View File
@@ -1,5 +1,5 @@
macOSSwiftPackageJob {
swift_version = "6.0"
repo = "swift-collections"
branch = "release/1.1"
branch = "release/1.2"
}
+1 -1
View File
@@ -1,5 +1,5 @@
LinuxSwiftPackageJob {
nightly_docker_tag = "nightly-6.0-jammy"
repo = "swift-collections"
branch = "release/1.1"
branch = "release/1.2"
}
+1 -1
View File
@@ -1,5 +1,5 @@
macOSSwiftPackageJob {
swift_version = "main"
repo = "swift-collections"
branch = "release/1.1"
branch = "release/1.2"
}
+1 -1
View File
@@ -1,5 +1,5 @@
LinuxSwiftPackageJob {
nightly_docker_tag = "nightly-jammy"
repo = "swift-collections"
branch = "release/1.1"
branch = "release/1.2"
}
+1 -5
View File
@@ -1,4 +1,4 @@
// swift-tools-version:5.7
// swift-tools-version:5.9
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
@@ -188,9 +188,6 @@ let targets: [CustomTarget] = [
name: "InternalCollectionsUtilities",
exclude: [
"CMakeLists.txt",
"Compatibility/UnsafeMutableBufferPointer+SE-0370.swift.gyb",
"Compatibility/UnsafeMutablePointer+SE-0370.swift.gyb",
"Compatibility/UnsafeRawPointer extensions.swift.gyb",
"Debugging.swift.gyb",
"Descriptions.swift.gyb",
"IntegerTricks/FixedWidthInteger+roundUpToPowerOfTwo.swift.gyb",
@@ -198,7 +195,6 @@ let targets: [CustomTarget] = [
"IntegerTricks/UInt+first and last set bit.swift.gyb",
"IntegerTricks/UInt+reversed.swift.gyb",
"RandomAccessCollection+Offsets.swift.gyb",
"Specialize.swift.gyb",
"UnsafeBitSet/_UnsafeBitSet+Index.swift.gyb",
"UnsafeBitSet/_UnsafeBitSet+_Word.swift.gyb",
"UnsafeBitSet/_UnsafeBitSet.swift.gyb",
+28 -13
View File
@@ -53,10 +53,11 @@ The Swift Collections package is source stable. The version numbers follow [Sema
[semver]: https://semver.org
The public API of version 1.1 of the `swift-collections` package consists of non-underscored declarations that are marked `public` in the `Collections`, `BitCollections`, `DequeModule`, `HeapModule`, `OrderedCollections` and `HashTreeCollections` modules.
### Public API
Interfaces that aren't part of the public API may continue to change in any release, including patch releases.
If you have a use case that requires using underscored APIs, please [submit a Feature Request][enhancement] describing it! We'd like the public interface to be as useful as possible -- although preferably without compromising safety or limiting future evolution.
The public API of version 1.2 of the `swift-collections` package consists of non-underscored declarations that are marked `public` in the `Collections`, `BitCollections`, `DequeModule`, `HeapModule`, `OrderedCollections` and `HashTreeCollections` modules.
Interfaces that aren't part of the public API may continue to change in any release, including patch releases.
By "underscored declarations" we mean declarations that have a leading underscore anywhere in their fully qualified name. For instance, here are some names that wouldn't be considered part of the public API, even if they were technically marked public:
@@ -65,18 +66,25 @@ By "underscored declarations" we mean declarations that have a leading underscor
- `_FooModule.Bar` (underscored module)
- `FooModule.Bar.init(_value:)` (underscored initializer)
Note that contents of the `Tests`, `Utils` and `Benchmarks` subdirectories aren't public API. We don't make any source compatibility promises about them -- they may change at whim, and code may be removed in any new release. Do not rely on anything about them.
If you have a use case that requires using underscored (or otherwise non-public) APIs, please [submit a Feature Request][enhancement] describing it! We'd like the public interface to be as useful as possible -- although preferably without compromising safety or limiting future evolution.
This source compatibility promise only applies to swift-collection when built as a Swift package. (The repository also contains unstable configurations for building swift-collections using CMake and Xcode. These configurations are provided for internal Swift project use only -- such as for building the (private) swift-collections binaries that ship within Swift toolchains.)
Note that the files in the `Tests`, `Utils`, `Documentation`, `Xcode`, `cmake` and `Benchmarks` subdirectories may change at whim; they may be added, modified or removed in any new release. Do not rely on anything about them.
Future minor versions of the package may update these rules as needed.
### Minimum Required Swift Toolchain Version
We'd like this package to quickly embrace Swift language and toolchain improvements that are relevant to its mandate. Accordingly, from time to time, new versions of this package require clients to upgrade to a more recent Swift toolchain release. (This allows the package to make use of new language/stdlib features, build on compiler bug fixes, and adopt new package manager functionality as soon as they are available.) Patch (i.e., bugfix) releases will not increase the required toolchain version, but any minor (i.e., new feature) release may do so.
The following table maps existing package releases to their minimum required Swift toolchain release:
The following table maps package releases to their minimum required Swift toolchain release:
| Package version | Swift version | Xcode release |
| ----------------------- | --------------- | ------------- |
| swift-collections 1.0.x | >= Swift 5.3.2 | >= Xcode 12.4 |
| swift-collections 1.1.x | >= Swift 5.7.2 | >= Xcode 14.2 |
| swift-collections 1.2.x | >= Swift 5.9.0 | >= Xcode 15.0 |
(Note: the package has no minimum deployment target, so while it does require clients to use a recent Swift toolchain to build it, the code itself is able to run on any OS release that supports running Swift code.)
@@ -86,7 +94,7 @@ The following table maps existing package releases to their minimum required Swi
To use this package in a SwiftPM project, you need to set it up as a package dependency:
```swift
// swift-tools-version:5.9
// swift-tools-version:6.0
import PackageDescription
let package = Package(
@@ -120,17 +128,19 @@ If you find something that looks like a bug, please open a [Bug Report][bugrepor
We maintain separate branches for each minor version of the package:
| Package version | Branch |
| ----------------------- | ----------- |
| swift-collections 1.0.x | release/1.0 |
| swift-collections 1.1.x | release/1.1 |
| swift-collections 1.2.x | main |
| Package version | Branch | Status |
| ----------------------- | ----------- | -------- |
| swift-collections 1.0.x | release/1.0 | Critical bugfixes only |
| swift-collections 1.1.x | release/1.1 | Critical bugfixes only |
| swift-collections 1.2.x | release/1.2 | Open for feature development (next feature release) |
| swift-collections 1.3.x | main | Open for feature development (unscheduled landing area) |
| n.a. | future | Experimental prototyping |
Changes must land on the branch corresponding to the earliest release that they will need to ship on. They are periodically propagated to subsequent branches, in the following direction:
`release/1.0` → `release/1.1` → `main`
`release/1.0` → `release/1.1` → `release/1.2` → `main`
For example, anything landing on `release/1.0` will eventually appear on `release/1.1` and then `main` too; there is no need to file standalone PRs for each release line. (Change propagation currently requires manual work -- it is performed by project maintainers.)
For example, anything landing on `release/1.1` will eventually appear on `release/1.2` and then `main` too; there is no need to file standalone PRs for each release line. (Change propagation currently requires manual work -- it is performed by project maintainers.)
### Working on the package
@@ -160,6 +170,10 @@ By submitting a pull request, you represent that you have the right to license y
#### Proposing the addition of a new data structure
**Note:** As of 2024, we are fully preoccupied with refactoring our existing data structures to support noncopyable and/or nonescapable element types; this includes designing new container protocols around them. I don't expect we'll have capacity to work on any major new data structure implementations until this effort is complete.
<!--
We intend this package to collect generally useful data structures -- the ones that ought to be within easy reach of every Swift engineer's basic toolbox. The implementations we ship need to be of the highest technical quality, polished to the same shine as anything that gets included in the Swift Standard Library. (The only real differences are that this package isn't under the formal Swift Evolution process, and its code isn't ABI stable.)
Accordingly, adding a new data structure to this package is not an easy or quick process, and not all useful data structures are going to be a good fit.
@@ -174,6 +188,7 @@ Participate in the review discussion, and adapt code accordingly. Sometimes we m
Historically, PRs adding a new data structure have typically been merged to a new feature branch rather than directly to a release branch or `main`, and there was an extended amount of time between the initial merge and the tag that shipped the new feature. Nobody likes to wait, but getting a new data structure implementation from a state that was ready to merge to a state that's ready to ship is actually quite difficult work, and it takes maintainer time and effort that needs to be scheduled in advance. The closer an implementation is to the coding conventions and performance baseline of the Standard Library, the shorter this wait is likely to become, and the fewer changes there will be between merging and shipping.
-->
### Code of Conduct
+17 -6
View File
@@ -39,11 +39,22 @@ extension _DequeBuffer: CustomStringConvertible {
}
}
#if compiler(>=5.10)
/// The type-punned empty singleton storage instance.
@usableFromInline
internal let _emptyDequeStorage = _DequeBuffer<Void>.create(
minimumCapacity: 0,
makingHeaderWith: { _ in
_DequeBufferHeader(capacity: 0, count: 0, startSlot: .init(at: 0))
})
nonisolated(unsafe) internal let _emptyDequeStorage
= _DequeBuffer<Void>.create(
minimumCapacity: 0,
makingHeaderWith: { _ in
_DequeBufferHeader(capacity: 0, count: 0, startSlot: .init(at: 0))
})
#else
/// The type-punned empty singleton storage instance.
@usableFromInline
internal let _emptyDequeStorage
= _DequeBuffer<Void>.create(
minimumCapacity: 0,
makingHeaderWith: { _ in
_DequeBufferHeader(capacity: 0, count: 0, startSlot: .init(at: 0))
})
#endif
@@ -18,6 +18,20 @@ import InternalCollectionsUtilities
@usableFromInline
internal typealias _RawHashStorage = ManagedBuffer<_HashNodeHeader, _RawHashNode>
#if compiler(>=5.10)
/// Type-punned storage for the singleton root node used in empty hash trees
/// (of all `Key` and `Value` types).
///
/// `_HashNode` is carefully defined to use a `_RawHashStorage` reference as its
/// storage variable, so that this can work. (The only reason we need the
/// `_HashNode.Storage` subclass is to allow storage instances to properly
/// clean up after themselves in their `deinit` method.)
@usableFromInline
nonisolated(unsafe)
internal let _emptySingleton: _RawHashStorage = _RawHashStorage.create(
minimumCapacity: 0,
makingHeaderWith: { _ in _HashNodeHeader(byteCapacity: 0) })
#else
/// Type-punned storage for the singleton root node used in empty hash trees
/// (of all `Key` and `Value` types).
///
@@ -29,6 +43,7 @@ internal typealias _RawHashStorage = ManagedBuffer<_HashNodeHeader, _RawHashNode
internal let _emptySingleton: _RawHashStorage = _RawHashStorage.create(
minimumCapacity: 0,
makingHeaderWith: { _ in _HashNodeHeader(byteCapacity: 0) })
#endif
extension _HashNode {
/// Instances of this class hold (tail-allocated) storage for individual
@@ -14,7 +14,7 @@
@usableFromInline
@frozen
internal struct _HashStack<Element> {
#if arch(x86_64) || arch(arm64)
#if _pointerBitWidth(_64)
@inlinable
@inline(__always)
internal static var capacity: Int { 13 }
@@ -27,7 +27,7 @@ internal struct _HashStack<Element> {
Element, Element, Element, Element,
Element
)
#else
#elseif _pointerBitWidth(_32)
@inlinable
@inline(__always)
internal static var capacity: Int { 7 }
@@ -38,6 +38,8 @@ internal struct _HashStack<Element> {
Element, Element, Element, Element,
Element, Element, Element
)
#else
#error("Unexpected pointer bit width")
#endif
@usableFromInline
@@ -46,18 +48,20 @@ internal struct _HashStack<Element> {
@inlinable
internal init(filledWith value: Element) {
assert(Self.capacity == _HashLevel.limit)
#if arch(x86_64) || arch(arm64)
#if _pointerBitWidth(_64)
_contents = (
value, value, value, value,
value, value, value, value,
value, value, value, value,
value
)
#else
#elseif _pointerBitWidth(_32)
_contents = (
value, value, value, value,
value, value, value
)
#else
#error("Unexpected pointer bit width")
#endif
self._count = 0
}
@@ -24,12 +24,8 @@ target_sources(${module_name} PRIVATE
"autogenerated/Debugging.swift"
"autogenerated/Descriptions.swift"
"autogenerated/RandomAccessCollection+Offsets.swift"
"autogenerated/Specialize.swift"
"autogenerated/UnsafeBufferPointer+Extras.swift"
"autogenerated/UnsafeMutableBufferPointer+Extras.swift"
"Compatibility/autogenerated/UnsafeMutableBufferPointer+SE-0370.swift"
"Compatibility/autogenerated/UnsafeMutablePointer+SE-0370.swift"
"Compatibility/autogenerated/UnsafeRawPointer extensions.swift"
"IntegerTricks/autogenerated/FixedWidthInteger+roundUpToPowerOfTwo.swift"
"IntegerTricks/autogenerated/Integer rank.swift"
"IntegerTricks/autogenerated/UInt+first and last set bit.swift"
@@ -1,424 +0,0 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2022 - 2024 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
//
//===----------------------------------------------------------------------===//
// Note: These are adapted from SE-0370 in the Swift 5.8 Standard Library.
%{
from gyb_utils import *
}%
${autogenerated_warning()}
% for modifier in visibility_levels:
${visibility_boilerplate(modifier)}
#if swift(<5.8)
extension UnsafeMutableBufferPointer {
/// Deinitializes every instance in this buffer.
///
/// The region of memory underlying this buffer must be fully initialized.
/// After calling `deinitialize(count:)`, the memory is uninitialized,
/// but still bound to the `Element` type.
///
/// - Note: All buffer elements must already be initialized.
///
/// - Returns: A raw buffer to the same range of memory as this buffer.
/// The range of memory is still bound to `Element`.
@discardableResult
@inlinable
${modifier} func deinitialize() -> UnsafeMutableRawBufferPointer {
guard let start = baseAddress else { return .init(start: nil, count: 0) }
start.deinitialize(count: count)
return .init(start: UnsafeMutableRawPointer(start),
count: count * MemoryLayout<Element>.stride)
}
}
#endif
// Note: this is left unconditionally enabled because we need the SR14663 workaround. :-(
extension UnsafeMutableBufferPointer {
/// Initializes the buffer's memory with
/// every element of the source.
///
/// Prior to calling the `initialize(fromContentsOf:)` method on a buffer,
/// the memory referenced by the buffer must be uninitialized,
/// or the `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer up to, but not including,
/// the returned index is initialized.
/// The buffer must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the position of the next uninitialized element
/// in the buffer, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to the
/// buffer's `startIndex`. If `source` contains as many elements as the buffer
/// can hold, the returned index is equal to the buffer's `endIndex`.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Note: The memory regions referenced by `source` and this buffer
/// must not overlap.
///
/// - Parameter source: A collection of elements to be used to
/// initialize the buffer's storage.
/// - Returns: The index one past the last element of the buffer initialized
/// by this function.
@inlinable
${modifier} func initialize<C: Collection>(
fromContentsOf source: C
) -> Index
where C.Element == Element {
let count: Int? = source.withContiguousStorageIfAvailable {
guard let sourceAddress = $0.baseAddress, !$0.isEmpty else {
return 0
}
precondition(
$0.count <= self.count,
"buffer cannot contain every element from source."
)
baseAddress?.initialize(from: sourceAddress, count: $0.count)
return $0.count
}
if let count = count {
return startIndex.advanced(by: count)
}
var (iterator, copied) = source._copyContents(initializing: self)
precondition(
iterator.next() == nil,
"buffer cannot contain every element from source."
)
return startIndex.advanced(by: copied)
}
}
#if swift(<5.8)
extension UnsafeMutableBufferPointer {
/// Moves every element of an initialized source buffer into the
/// uninitialized memory referenced by this buffer, leaving the source memory
/// uninitialized and this buffer's memory initialized.
///
/// Prior to calling the `moveInitialize(fromContentsOf:)` method on a buffer,
/// the memory it references must be uninitialized,
/// or its `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer up to, but not including,
/// the returned index is initialized. The memory referenced by
/// `source` is uninitialized after the function returns.
/// The buffer must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the position of the next uninitialized element
/// in the buffer, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to the
/// buffer's `startIndex`. If `source` contains as many elements as the buffer
/// can hold, the returned index is equal to the buffer's `endIndex`.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Note: The memory regions referenced by `source` and this buffer
/// may overlap.
///
/// - Parameter source: A buffer containing the values to copy. The memory
/// region underlying `source` must be initialized.
/// - Returns: The index one past the last element of the buffer initialized
/// by this function.
@inlinable
@_alwaysEmitIntoClient
${modifier} func moveInitialize(fromContentsOf source: Self) -> Index {
guard let sourceAddress = source.baseAddress, !source.isEmpty else {
return startIndex
}
precondition(
source.count <= self.count,
"buffer cannot contain every element from source."
)
baseAddress?.moveInitialize(from: sourceAddress, count: source.count)
return startIndex.advanced(by: source.count)
}
/// Moves every element of an initialized source buffer into the
/// uninitialized memory referenced by this buffer, leaving the source memory
/// uninitialized and this buffer's memory initialized.
///
/// Prior to calling the `moveInitialize(fromContentsOf:)` method on a buffer,
/// the memory it references must be uninitialized,
/// or its `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer up to, but not including,
/// the returned index is initialized. The memory referenced by
/// `source` is uninitialized after the function returns.
/// The buffer must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the position of the next uninitialized element
/// in the buffer, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to the
/// buffer's `startIndex`. If `source` contains as many elements as the buffer
/// can hold, the returned index is equal to the buffer's `endIndex`.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Note: The memory regions referenced by `source` and this buffer
/// may overlap.
///
/// - Parameter source: A buffer containing the values to copy. The memory
/// region underlying `source` must be initialized.
/// - Returns: The index one past the last element of the buffer initialized
/// by this function.
@inlinable
@_alwaysEmitIntoClient
${modifier} func moveInitialize(fromContentsOf source: Slice<Self>) -> Index {
return moveInitialize(fromContentsOf: Self(rebasing: source))
}
/// Initializes the element at `index` to the given value.
///
/// The memory underlying the destination element must be uninitialized,
/// or `Element` must be a trivial type. After a call to `initialize(to:)`,
/// the memory underlying this element of the buffer is initialized.
///
/// - Parameters:
/// - value: The value used to initialize the buffer element's memory.
/// - index: The index of the element to initialize
@inlinable
@_alwaysEmitIntoClient
${modifier} func initializeElement(at index: Index, to value: Element) {
assert(startIndex <= index && index < endIndex)
let p = baseAddress.unsafelyUnwrapped.advanced(by: index)
p.initialize(to: value)
}
/// Retrieves and returns the element at `index`,
/// leaving that element's underlying memory uninitialized.
///
/// The memory underlying the element at `index` must be initialized.
/// After calling `moveElement(from:)`, the memory underlying this element
/// of the buffer is uninitialized, and still bound to type `Element`.
///
/// - Parameters:
/// - index: The index of the buffer element to retrieve and deinitialize.
/// - Returns: The instance referenced by this index in this buffer.
@inlinable
@_alwaysEmitIntoClient
${modifier} func moveElement(from index: Index) -> Element {
assert(startIndex <= index && index < endIndex)
return baseAddress.unsafelyUnwrapped.advanced(by: index).move()
}
/// Deinitializes the memory underlying the element at `index`.
///
/// The memory underlying the element at `index` must be initialized.
/// After calling `deinitializeElement()`, the memory underlying this element
/// of the buffer is uninitialized, and still bound to type `Element`.
///
/// - Parameters:
/// - index: The index of the buffer element to deinitialize.
@inlinable
@_alwaysEmitIntoClient
${modifier} func deinitializeElement(at index: Index) {
assert(startIndex <= index && index < endIndex)
let p = baseAddress.unsafelyUnwrapped.advanced(by: index)
p.deinitialize(count: 1)
}
}
#endif
#if swift(<5.8)
extension Slice {
/// Initializes the buffer slice's memory with with
/// every element of the source.
///
/// Prior to calling the `initialize(fromContentsOf:)` method
/// on a buffer slice, the memory it references must be uninitialized,
/// or the `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer slice up to, but not including,
/// the returned index is initialized.
/// The buffer slice must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the index of the next uninitialized element
/// in the buffer slice, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to
/// the buffer slice's `startIndex`. If `source` contains as many elements
/// as the buffer slice can hold, the returned index is equal to
/// to the slice's `endIndex`.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Note: The memory regions referenced by `source` and this buffer slice
/// must not overlap.
///
/// - Parameter source: A collection of elements to be used to
/// initialize the buffer slice's storage.
/// - Returns: The index one past the last element of the buffer slice
/// initialized by this function.
@inlinable
@_alwaysEmitIntoClient
${modifier} func initialize<C: Collection>(
fromContentsOf source: C
) -> Index where Base == UnsafeMutableBufferPointer<C.Element> {
let buffer = Base(rebasing: self)
let index = buffer.initialize(fromContentsOf: source)
let distance = buffer.distance(from: buffer.startIndex, to: index)
return startIndex.advanced(by: distance)
}
/// Moves every element of an initialized source buffer into the
/// uninitialized memory referenced by this buffer slice, leaving the
/// source memory uninitialized and this buffer slice's memory initialized.
///
/// Prior to calling the `moveInitialize(fromContentsOf:)` method on a
/// buffer slice, the memory it references must be uninitialized,
/// or its `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer slice up to, but not including,
/// the returned index is initialized. The memory referenced by
/// `source` is uninitialized after the function returns.
/// The buffer slice must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the position of the next uninitialized element
/// in the buffer slice, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to the
/// slice's `startIndex`. If `source` contains as many elements as the slice
/// can hold, the returned index is equal to the slice's `endIndex`.
///
/// - Note: The memory regions referenced by `source` and this buffer slice
/// may overlap.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Parameter source: A buffer containing the values to copy.
/// The memory region underlying `source` must be initialized.
/// - Returns: The index one past the last element of the buffer slice
/// initialized by this function.
@inlinable
@_alwaysEmitIntoClient
${modifier} func moveInitialize<Element>(
fromContentsOf source: UnsafeMutableBufferPointer<Element>
) -> Index where Base == UnsafeMutableBufferPointer<Element> {
let buffer = Base(rebasing: self)
let index = buffer.moveInitialize(fromContentsOf: source)
let distance = buffer.distance(from: buffer.startIndex, to: index)
return startIndex.advanced(by: distance)
}
/// Moves every element of an initialized source buffer slice into the
/// uninitialized memory referenced by this buffer slice, leaving the
/// source memory uninitialized and this buffer slice's memory initialized.
///
/// Prior to calling the `moveInitialize(fromContentsOf:)` method on a
/// buffer slice, the memory it references must be uninitialized,
/// or its `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer slice up to, but not including,
/// the returned index is initialized. The memory referenced by
/// `source` is uninitialized after the function returns.
/// The buffer slice must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the position of the next uninitialized element
/// in the buffer slice, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to the
/// slice's `startIndex`. If `source` contains as many elements as the slice
/// can hold, the returned index is equal to the slice's `endIndex`.
///
/// - Note: The memory regions referenced by `source` and this buffer slice
/// may overlap.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Parameter source: A buffer slice containing the values to copy.
/// The memory region underlying `source` must be initialized.
/// - Returns: The index one past the last element of the buffer slice
/// initialized by this function.
@inlinable
@_alwaysEmitIntoClient
${modifier} func moveInitialize<Element>(
fromContentsOf source: Slice<UnsafeMutableBufferPointer<Element>>
) -> Index where Base == UnsafeMutableBufferPointer<Element> {
let buffer = Base(rebasing: self)
let index = buffer.moveInitialize(fromContentsOf: source)
let distance = buffer.distance(from: buffer.startIndex, to: index)
return startIndex.advanced(by: distance)
}
/// Deinitializes every instance in this buffer slice.
///
/// The region of memory underlying this buffer slice must be fully
/// initialized. After calling `deinitialize(count:)`, the memory
/// is uninitialized, but still bound to the `Element` type.
///
/// - Note: All buffer elements must already be initialized.
///
/// - Returns: A raw buffer to the same range of memory as this buffer.
/// The range of memory is still bound to `Element`.
@discardableResult
@inlinable
@_alwaysEmitIntoClient
${modifier} func deinitialize<Element>() -> UnsafeMutableRawBufferPointer
where Base == UnsafeMutableBufferPointer<Element> {
Base(rebasing: self).deinitialize()
}
/// Initializes the element at `index` to the given value.
///
/// The memory underlying the destination element must be uninitialized,
/// or `Element` must be a trivial type. After a call to `initialize(to:)`,
/// the memory underlying this element of the buffer slice is initialized.
///
/// - Parameters:
/// - value: The value used to initialize the buffer element's memory.
/// - index: The index of the element to initialize
@inlinable
@_alwaysEmitIntoClient
${modifier} func initializeElement<Element>(at index: Int, to value: Element)
where Base == UnsafeMutableBufferPointer<Element> {
assert(startIndex <= index && index < endIndex)
base.baseAddress.unsafelyUnwrapped.advanced(by: index).initialize(to: value)
}
}
#endif
#if swift(<5.8)
extension UnsafeMutableBufferPointer {
/// Updates every element of this buffer's initialized memory.
///
/// The buffer’s memory must be initialized or its `Element` type
/// must be a trivial type.
///
/// - Note: All buffer elements must already be initialized.
///
/// - Parameters:
/// - repeatedValue: The value used when updating this pointer's memory.
@_alwaysEmitIntoClient
${modifier} func update(repeating repeatedValue: Element) {
guard let dstBase = baseAddress else { return }
dstBase.update(repeating: repeatedValue, count: count)
}
}
#endif
#if swift(<5.8)
extension Slice {
/// Updates every element of this buffer slice's initialized memory.
///
/// The buffer slice’s memory must be initialized or its `Element`
/// must be a trivial type.
///
/// - Note: All buffer elements must already be initialized.
///
/// - Parameters:
/// - repeatedValue: The value used when updating this pointer's memory.
@_alwaysEmitIntoClient
${modifier} func update<Element>(repeating repeatedValue: Element)
where Base == UnsafeMutableBufferPointer<Element> {
Base(rebasing: self).update(repeating: repeatedValue)
}
}
#endif
% end
${visibility_boilerplate("end")}
@@ -1,43 +0,0 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2022 - 2024 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
//
//===----------------------------------------------------------------------===//
%{
from gyb_utils import *
}%
${autogenerated_warning()}
% for modifier in visibility_levels:
${visibility_boilerplate(modifier)}
#if swift(<5.8)
extension UnsafeMutablePointer {
/// Update this pointer's initialized memory with the specified number of
/// consecutive copies of the given value.
///
/// The region of memory starting at this pointer and covering `count`
/// instances of the pointer's `Pointee` type must be initialized or
/// `Pointee` must be a trivial type. After calling
/// `update(repeating:count:)`, the region is initialized.
///
/// - Parameters:
/// - repeatedValue: The value used when updating this pointer's memory.
/// - count: The number of consecutive elements to update.
/// `count` must not be negative.
@_alwaysEmitIntoClient
${modifier} func update(repeating repeatedValue: Pointee, count: Int) {
assert(count >= 0, "UnsafeMutablePointer.update(repeating:count:) with negative count")
for i in 0 ..< count {
self[i] = repeatedValue
}
}
}
#endif
% end
${visibility_boilerplate("end")}
@@ -1,89 +0,0 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2022 - 2024 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
//
//===----------------------------------------------------------------------===//
%{
from gyb_utils import *
}%
${autogenerated_warning()}
% for modifier in visibility_levels:
${visibility_boilerplate(modifier)}
#if compiler(<5.7) || (os(macOS) && compiler(<5.8)) // SE-0334
extension UnsafeRawPointer {
/// Obtain the next pointer properly aligned to store a value of type `T`.
///
/// If `self` is properly aligned for accessing `T`,
/// this function returns `self`.
///
/// - Parameters:
/// - type: the type to be stored at the returned address.
/// - Returns: a pointer properly aligned to store a value of type `T`.
@inlinable
@_alwaysEmitIntoClient
${modifier} func alignedUp<T>(for type: T.Type) -> Self {
let mask = UInt(MemoryLayout<T>.alignment) &- 1
let bits = (UInt(bitPattern: self) &+ mask) & ~mask
return Self(bitPattern: bits)!
}
/// Obtain the preceding pointer properly aligned to store a value of type `T`.
///
/// If `self` is properly aligned for accessing `T`,
/// this function returns `self`.
///
/// - Parameters:
/// - type: the type to be stored at the returned address.
/// - Returns: a pointer properly aligned to store a value of type `T`.
@inlinable
@_alwaysEmitIntoClient
${modifier} func alignedDown<T>(for type: T.Type) -> Self {
let mask = UInt(MemoryLayout<T>.alignment) &- 1
let bits = UInt(bitPattern: self) & ~mask
return Self(bitPattern: bits)!
}
}
extension UnsafeMutableRawPointer {
/// Obtain the next pointer properly aligned to store a value of type `T`.
///
/// If `self` is properly aligned for accessing `T`,
/// this function returns `self`.
///
/// - Parameters:
/// - type: the type to be stored at the returned address.
/// - Returns: a pointer properly aligned to store a value of type `T`.
@inlinable
@_alwaysEmitIntoClient
${modifier} func alignedUp<T>(for type: T.Type) -> Self {
let mask = UInt(MemoryLayout<T>.alignment) &- 1
let bits = (UInt(bitPattern: self) &+ mask) & ~mask
return Self(bitPattern: bits)!
}
/// Obtain the preceding pointer properly aligned to store a value of type `T`.
///
/// If `self` is properly aligned for accessing `T`,
/// this function returns `self`.
///
/// - Parameters:
/// - type: the type to be stored at the returned address.
/// - Returns: a pointer properly aligned to store a value of type `T`.
@inlinable
@_alwaysEmitIntoClient
${modifier} func alignedDown<T>(for type: T.Type) -> Self {
let mask = UInt(MemoryLayout<T>.alignment) &- 1
let bits = UInt(bitPattern: self) & ~mask
return Self(bitPattern: bits)!
}
}
#endif
% end
${visibility_boilerplate("end")}
@@ -1,832 +0,0 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2022 - 2024 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
//
//===----------------------------------------------------------------------===//
// Note: These are adapted from SE-0370 in the Swift 5.8 Standard Library.
// #############################################################################
// # #
// # DO NOT EDIT THIS FILE; IT IS AUTOGENERATED. #
// # #
// #############################################################################
// In single module mode, we need these declarations to be internal,
// but in regular builds we want them to be public. Unfortunately
// the current best way to do this is to duplicate all definitions.
#if COLLECTIONS_SINGLE_MODULE
#if swift(<5.8)
extension UnsafeMutableBufferPointer {
/// Deinitializes every instance in this buffer.
///
/// The region of memory underlying this buffer must be fully initialized.
/// After calling `deinitialize(count:)`, the memory is uninitialized,
/// but still bound to the `Element` type.
///
/// - Note: All buffer elements must already be initialized.
///
/// - Returns: A raw buffer to the same range of memory as this buffer.
/// The range of memory is still bound to `Element`.
@discardableResult
@inlinable
internal func deinitialize() -> UnsafeMutableRawBufferPointer {
guard let start = baseAddress else { return .init(start: nil, count: 0) }
start.deinitialize(count: count)
return .init(start: UnsafeMutableRawPointer(start),
count: count * MemoryLayout<Element>.stride)
}
}
#endif
// Note: this is left unconditionally enabled because we need the SR14663 workaround. :-(
extension UnsafeMutableBufferPointer {
/// Initializes the buffer's memory with
/// every element of the source.
///
/// Prior to calling the `initialize(fromContentsOf:)` method on a buffer,
/// the memory referenced by the buffer must be uninitialized,
/// or the `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer up to, but not including,
/// the returned index is initialized.
/// The buffer must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the position of the next uninitialized element
/// in the buffer, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to the
/// buffer's `startIndex`. If `source` contains as many elements as the buffer
/// can hold, the returned index is equal to the buffer's `endIndex`.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Note: The memory regions referenced by `source` and this buffer
/// must not overlap.
///
/// - Parameter source: A collection of elements to be used to
/// initialize the buffer's storage.
/// - Returns: The index one past the last element of the buffer initialized
/// by this function.
@inlinable
internal func initialize<C: Collection>(
fromContentsOf source: C
) -> Index
where C.Element == Element {
let count: Int? = source.withContiguousStorageIfAvailable {
guard let sourceAddress = $0.baseAddress, !$0.isEmpty else {
return 0
}
precondition(
$0.count <= self.count,
"buffer cannot contain every element from source."
)
baseAddress?.initialize(from: sourceAddress, count: $0.count)
return $0.count
}
if let count = count {
return startIndex.advanced(by: count)
}
var (iterator, copied) = source._copyContents(initializing: self)
precondition(
iterator.next() == nil,
"buffer cannot contain every element from source."
)
return startIndex.advanced(by: copied)
}
}
#if swift(<5.8)
extension UnsafeMutableBufferPointer {
/// Moves every element of an initialized source buffer into the
/// uninitialized memory referenced by this buffer, leaving the source memory
/// uninitialized and this buffer's memory initialized.
///
/// Prior to calling the `moveInitialize(fromContentsOf:)` method on a buffer,
/// the memory it references must be uninitialized,
/// or its `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer up to, but not including,
/// the returned index is initialized. The memory referenced by
/// `source` is uninitialized after the function returns.
/// The buffer must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the position of the next uninitialized element
/// in the buffer, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to the
/// buffer's `startIndex`. If `source` contains as many elements as the buffer
/// can hold, the returned index is equal to the buffer's `endIndex`.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Note: The memory regions referenced by `source` and this buffer
/// may overlap.
///
/// - Parameter source: A buffer containing the values to copy. The memory
/// region underlying `source` must be initialized.
/// - Returns: The index one past the last element of the buffer initialized
/// by this function.
@inlinable
@_alwaysEmitIntoClient
internal func moveInitialize(fromContentsOf source: Self) -> Index {
guard let sourceAddress = source.baseAddress, !source.isEmpty else {
return startIndex
}
precondition(
source.count <= self.count,
"buffer cannot contain every element from source."
)
baseAddress?.moveInitialize(from: sourceAddress, count: source.count)
return startIndex.advanced(by: source.count)
}
/// Moves every element of an initialized source buffer into the
/// uninitialized memory referenced by this buffer, leaving the source memory
/// uninitialized and this buffer's memory initialized.
///
/// Prior to calling the `moveInitialize(fromContentsOf:)` method on a buffer,
/// the memory it references must be uninitialized,
/// or its `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer up to, but not including,
/// the returned index is initialized. The memory referenced by
/// `source` is uninitialized after the function returns.
/// The buffer must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the position of the next uninitialized element
/// in the buffer, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to the
/// buffer's `startIndex`. If `source` contains as many elements as the buffer
/// can hold, the returned index is equal to the buffer's `endIndex`.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Note: The memory regions referenced by `source` and this buffer
/// may overlap.
///
/// - Parameter source: A buffer containing the values to copy. The memory
/// region underlying `source` must be initialized.
/// - Returns: The index one past the last element of the buffer initialized
/// by this function.
@inlinable
@_alwaysEmitIntoClient
internal func moveInitialize(fromContentsOf source: Slice<Self>) -> Index {
return moveInitialize(fromContentsOf: Self(rebasing: source))
}
/// Initializes the element at `index` to the given value.
///
/// The memory underlying the destination element must be uninitialized,
/// or `Element` must be a trivial type. After a call to `initialize(to:)`,
/// the memory underlying this element of the buffer is initialized.
///
/// - Parameters:
/// - value: The value used to initialize the buffer element's memory.
/// - index: The index of the element to initialize
@inlinable
@_alwaysEmitIntoClient
internal func initializeElement(at index: Index, to value: Element) {
assert(startIndex <= index && index < endIndex)
let p = baseAddress.unsafelyUnwrapped.advanced(by: index)
p.initialize(to: value)
}
/// Retrieves and returns the element at `index`,
/// leaving that element's underlying memory uninitialized.
///
/// The memory underlying the element at `index` must be initialized.
/// After calling `moveElement(from:)`, the memory underlying this element
/// of the buffer is uninitialized, and still bound to type `Element`.
///
/// - Parameters:
/// - index: The index of the buffer element to retrieve and deinitialize.
/// - Returns: The instance referenced by this index in this buffer.
@inlinable
@_alwaysEmitIntoClient
internal func moveElement(from index: Index) -> Element {
assert(startIndex <= index && index < endIndex)
return baseAddress.unsafelyUnwrapped.advanced(by: index).move()
}
/// Deinitializes the memory underlying the element at `index`.
///
/// The memory underlying the element at `index` must be initialized.
/// After calling `deinitializeElement()`, the memory underlying this element
/// of the buffer is uninitialized, and still bound to type `Element`.
///
/// - Parameters:
/// - index: The index of the buffer element to deinitialize.
@inlinable
@_alwaysEmitIntoClient
internal func deinitializeElement(at index: Index) {
assert(startIndex <= index && index < endIndex)
let p = baseAddress.unsafelyUnwrapped.advanced(by: index)
p.deinitialize(count: 1)
}
}
#endif
#if swift(<5.8)
extension Slice {
/// Initializes the buffer slice's memory with with
/// every element of the source.
///
/// Prior to calling the `initialize(fromContentsOf:)` method
/// on a buffer slice, the memory it references must be uninitialized,
/// or the `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer slice up to, but not including,
/// the returned index is initialized.
/// The buffer slice must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the index of the next uninitialized element
/// in the buffer slice, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to
/// the buffer slice's `startIndex`. If `source` contains as many elements
/// as the buffer slice can hold, the returned index is equal to
/// to the slice's `endIndex`.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Note: The memory regions referenced by `source` and this buffer slice
/// must not overlap.
///
/// - Parameter source: A collection of elements to be used to
/// initialize the buffer slice's storage.
/// - Returns: The index one past the last element of the buffer slice
/// initialized by this function.
@inlinable
@_alwaysEmitIntoClient
internal func initialize<C: Collection>(
fromContentsOf source: C
) -> Index where Base == UnsafeMutableBufferPointer<C.Element> {
let buffer = Base(rebasing: self)
let index = buffer.initialize(fromContentsOf: source)
let distance = buffer.distance(from: buffer.startIndex, to: index)
return startIndex.advanced(by: distance)
}
/// Moves every element of an initialized source buffer into the
/// uninitialized memory referenced by this buffer slice, leaving the
/// source memory uninitialized and this buffer slice's memory initialized.
///
/// Prior to calling the `moveInitialize(fromContentsOf:)` method on a
/// buffer slice, the memory it references must be uninitialized,
/// or its `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer slice up to, but not including,
/// the returned index is initialized. The memory referenced by
/// `source` is uninitialized after the function returns.
/// The buffer slice must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the position of the next uninitialized element
/// in the buffer slice, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to the
/// slice's `startIndex`. If `source` contains as many elements as the slice
/// can hold, the returned index is equal to the slice's `endIndex`.
///
/// - Note: The memory regions referenced by `source` and this buffer slice
/// may overlap.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Parameter source: A buffer containing the values to copy.
/// The memory region underlying `source` must be initialized.
/// - Returns: The index one past the last element of the buffer slice
/// initialized by this function.
@inlinable
@_alwaysEmitIntoClient
internal func moveInitialize<Element>(
fromContentsOf source: UnsafeMutableBufferPointer<Element>
) -> Index where Base == UnsafeMutableBufferPointer<Element> {
let buffer = Base(rebasing: self)
let index = buffer.moveInitialize(fromContentsOf: source)
let distance = buffer.distance(from: buffer.startIndex, to: index)
return startIndex.advanced(by: distance)
}
/// Moves every element of an initialized source buffer slice into the
/// uninitialized memory referenced by this buffer slice, leaving the
/// source memory uninitialized and this buffer slice's memory initialized.
///
/// Prior to calling the `moveInitialize(fromContentsOf:)` method on a
/// buffer slice, the memory it references must be uninitialized,
/// or its `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer slice up to, but not including,
/// the returned index is initialized. The memory referenced by
/// `source` is uninitialized after the function returns.
/// The buffer slice must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the position of the next uninitialized element
/// in the buffer slice, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to the
/// slice's `startIndex`. If `source` contains as many elements as the slice
/// can hold, the returned index is equal to the slice's `endIndex`.
///
/// - Note: The memory regions referenced by `source` and this buffer slice
/// may overlap.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Parameter source: A buffer slice containing the values to copy.
/// The memory region underlying `source` must be initialized.
/// - Returns: The index one past the last element of the buffer slice
/// initialized by this function.
@inlinable
@_alwaysEmitIntoClient
internal func moveInitialize<Element>(
fromContentsOf source: Slice<UnsafeMutableBufferPointer<Element>>
) -> Index where Base == UnsafeMutableBufferPointer<Element> {
let buffer = Base(rebasing: self)
let index = buffer.moveInitialize(fromContentsOf: source)
let distance = buffer.distance(from: buffer.startIndex, to: index)
return startIndex.advanced(by: distance)
}
/// Deinitializes every instance in this buffer slice.
///
/// The region of memory underlying this buffer slice must be fully
/// initialized. After calling `deinitialize(count:)`, the memory
/// is uninitialized, but still bound to the `Element` type.
///
/// - Note: All buffer elements must already be initialized.
///
/// - Returns: A raw buffer to the same range of memory as this buffer.
/// The range of memory is still bound to `Element`.
@discardableResult
@inlinable
@_alwaysEmitIntoClient
internal func deinitialize<Element>() -> UnsafeMutableRawBufferPointer
where Base == UnsafeMutableBufferPointer<Element> {
Base(rebasing: self).deinitialize()
}
/// Initializes the element at `index` to the given value.
///
/// The memory underlying the destination element must be uninitialized,
/// or `Element` must be a trivial type. After a call to `initialize(to:)`,
/// the memory underlying this element of the buffer slice is initialized.
///
/// - Parameters:
/// - value: The value used to initialize the buffer element's memory.
/// - index: The index of the element to initialize
@inlinable
@_alwaysEmitIntoClient
internal func initializeElement<Element>(at index: Int, to value: Element)
where Base == UnsafeMutableBufferPointer<Element> {
assert(startIndex <= index && index < endIndex)
base.baseAddress.unsafelyUnwrapped.advanced(by: index).initialize(to: value)
}
}
#endif
#if swift(<5.8)
extension UnsafeMutableBufferPointer {
/// Updates every element of this buffer's initialized memory.
///
/// The buffer’s memory must be initialized or its `Element` type
/// must be a trivial type.
///
/// - Note: All buffer elements must already be initialized.
///
/// - Parameters:
/// - repeatedValue: The value used when updating this pointer's memory.
@_alwaysEmitIntoClient
internal func update(repeating repeatedValue: Element) {
guard let dstBase = baseAddress else { return }
dstBase.update(repeating: repeatedValue, count: count)
}
}
#endif
#if swift(<5.8)
extension Slice {
/// Updates every element of this buffer slice's initialized memory.
///
/// The buffer slice’s memory must be initialized or its `Element`
/// must be a trivial type.
///
/// - Note: All buffer elements must already be initialized.
///
/// - Parameters:
/// - repeatedValue: The value used when updating this pointer's memory.
@_alwaysEmitIntoClient
internal func update<Element>(repeating repeatedValue: Element)
where Base == UnsafeMutableBufferPointer<Element> {
Base(rebasing: self).update(repeating: repeatedValue)
}
}
#endif
#else // !COLLECTIONS_SINGLE_MODULE
#if swift(<5.8)
extension UnsafeMutableBufferPointer {
/// Deinitializes every instance in this buffer.
///
/// The region of memory underlying this buffer must be fully initialized.
/// After calling `deinitialize(count:)`, the memory is uninitialized,
/// but still bound to the `Element` type.
///
/// - Note: All buffer elements must already be initialized.
///
/// - Returns: A raw buffer to the same range of memory as this buffer.
/// The range of memory is still bound to `Element`.
@discardableResult
@inlinable
public func deinitialize() -> UnsafeMutableRawBufferPointer {
guard let start = baseAddress else { return .init(start: nil, count: 0) }
start.deinitialize(count: count)
return .init(start: UnsafeMutableRawPointer(start),
count: count * MemoryLayout<Element>.stride)
}
}
#endif
// Note: this is left unconditionally enabled because we need the SR14663 workaround. :-(
extension UnsafeMutableBufferPointer {
/// Initializes the buffer's memory with
/// every element of the source.
///
/// Prior to calling the `initialize(fromContentsOf:)` method on a buffer,
/// the memory referenced by the buffer must be uninitialized,
/// or the `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer up to, but not including,
/// the returned index is initialized.
/// The buffer must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the position of the next uninitialized element
/// in the buffer, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to the
/// buffer's `startIndex`. If `source` contains as many elements as the buffer
/// can hold, the returned index is equal to the buffer's `endIndex`.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Note: The memory regions referenced by `source` and this buffer
/// must not overlap.
///
/// - Parameter source: A collection of elements to be used to
/// initialize the buffer's storage.
/// - Returns: The index one past the last element of the buffer initialized
/// by this function.
@inlinable
public func initialize<C: Collection>(
fromContentsOf source: C
) -> Index
where C.Element == Element {
let count: Int? = source.withContiguousStorageIfAvailable {
guard let sourceAddress = $0.baseAddress, !$0.isEmpty else {
return 0
}
precondition(
$0.count <= self.count,
"buffer cannot contain every element from source."
)
baseAddress?.initialize(from: sourceAddress, count: $0.count)
return $0.count
}
if let count = count {
return startIndex.advanced(by: count)
}
var (iterator, copied) = source._copyContents(initializing: self)
precondition(
iterator.next() == nil,
"buffer cannot contain every element from source."
)
return startIndex.advanced(by: copied)
}
}
#if swift(<5.8)
extension UnsafeMutableBufferPointer {
/// Moves every element of an initialized source buffer into the
/// uninitialized memory referenced by this buffer, leaving the source memory
/// uninitialized and this buffer's memory initialized.
///
/// Prior to calling the `moveInitialize(fromContentsOf:)` method on a buffer,
/// the memory it references must be uninitialized,
/// or its `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer up to, but not including,
/// the returned index is initialized. The memory referenced by
/// `source` is uninitialized after the function returns.
/// The buffer must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the position of the next uninitialized element
/// in the buffer, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to the
/// buffer's `startIndex`. If `source` contains as many elements as the buffer
/// can hold, the returned index is equal to the buffer's `endIndex`.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Note: The memory regions referenced by `source` and this buffer
/// may overlap.
///
/// - Parameter source: A buffer containing the values to copy. The memory
/// region underlying `source` must be initialized.
/// - Returns: The index one past the last element of the buffer initialized
/// by this function.
@inlinable
@_alwaysEmitIntoClient
public func moveInitialize(fromContentsOf source: Self) -> Index {
guard let sourceAddress = source.baseAddress, !source.isEmpty else {
return startIndex
}
precondition(
source.count <= self.count,
"buffer cannot contain every element from source."
)
baseAddress?.moveInitialize(from: sourceAddress, count: source.count)
return startIndex.advanced(by: source.count)
}
/// Moves every element of an initialized source buffer into the
/// uninitialized memory referenced by this buffer, leaving the source memory
/// uninitialized and this buffer's memory initialized.
///
/// Prior to calling the `moveInitialize(fromContentsOf:)` method on a buffer,
/// the memory it references must be uninitialized,
/// or its `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer up to, but not including,
/// the returned index is initialized. The memory referenced by
/// `source` is uninitialized after the function returns.
/// The buffer must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the position of the next uninitialized element
/// in the buffer, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to the
/// buffer's `startIndex`. If `source` contains as many elements as the buffer
/// can hold, the returned index is equal to the buffer's `endIndex`.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Note: The memory regions referenced by `source` and this buffer
/// may overlap.
///
/// - Parameter source: A buffer containing the values to copy. The memory
/// region underlying `source` must be initialized.
/// - Returns: The index one past the last element of the buffer initialized
/// by this function.
@inlinable
@_alwaysEmitIntoClient
public func moveInitialize(fromContentsOf source: Slice<Self>) -> Index {
return moveInitialize(fromContentsOf: Self(rebasing: source))
}
/// Initializes the element at `index` to the given value.
///
/// The memory underlying the destination element must be uninitialized,
/// or `Element` must be a trivial type. After a call to `initialize(to:)`,
/// the memory underlying this element of the buffer is initialized.
///
/// - Parameters:
/// - value: The value used to initialize the buffer element's memory.
/// - index: The index of the element to initialize
@inlinable
@_alwaysEmitIntoClient
public func initializeElement(at index: Index, to value: Element) {
assert(startIndex <= index && index < endIndex)
let p = baseAddress.unsafelyUnwrapped.advanced(by: index)
p.initialize(to: value)
}
/// Retrieves and returns the element at `index`,
/// leaving that element's underlying memory uninitialized.
///
/// The memory underlying the element at `index` must be initialized.
/// After calling `moveElement(from:)`, the memory underlying this element
/// of the buffer is uninitialized, and still bound to type `Element`.
///
/// - Parameters:
/// - index: The index of the buffer element to retrieve and deinitialize.
/// - Returns: The instance referenced by this index in this buffer.
@inlinable
@_alwaysEmitIntoClient
public func moveElement(from index: Index) -> Element {
assert(startIndex <= index && index < endIndex)
return baseAddress.unsafelyUnwrapped.advanced(by: index).move()
}
/// Deinitializes the memory underlying the element at `index`.
///
/// The memory underlying the element at `index` must be initialized.
/// After calling `deinitializeElement()`, the memory underlying this element
/// of the buffer is uninitialized, and still bound to type `Element`.
///
/// - Parameters:
/// - index: The index of the buffer element to deinitialize.
@inlinable
@_alwaysEmitIntoClient
public func deinitializeElement(at index: Index) {
assert(startIndex <= index && index < endIndex)
let p = baseAddress.unsafelyUnwrapped.advanced(by: index)
p.deinitialize(count: 1)
}
}
#endif
#if swift(<5.8)
extension Slice {
/// Initializes the buffer slice's memory with with
/// every element of the source.
///
/// Prior to calling the `initialize(fromContentsOf:)` method
/// on a buffer slice, the memory it references must be uninitialized,
/// or the `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer slice up to, but not including,
/// the returned index is initialized.
/// The buffer slice must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the index of the next uninitialized element
/// in the buffer slice, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to
/// the buffer slice's `startIndex`. If `source` contains as many elements
/// as the buffer slice can hold, the returned index is equal to
/// to the slice's `endIndex`.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Note: The memory regions referenced by `source` and this buffer slice
/// must not overlap.
///
/// - Parameter source: A collection of elements to be used to
/// initialize the buffer slice's storage.
/// - Returns: The index one past the last element of the buffer slice
/// initialized by this function.
@inlinable
@_alwaysEmitIntoClient
public func initialize<C: Collection>(
fromContentsOf source: C
) -> Index where Base == UnsafeMutableBufferPointer<C.Element> {
let buffer = Base(rebasing: self)
let index = buffer.initialize(fromContentsOf: source)
let distance = buffer.distance(from: buffer.startIndex, to: index)
return startIndex.advanced(by: distance)
}
/// Moves every element of an initialized source buffer into the
/// uninitialized memory referenced by this buffer slice, leaving the
/// source memory uninitialized and this buffer slice's memory initialized.
///
/// Prior to calling the `moveInitialize(fromContentsOf:)` method on a
/// buffer slice, the memory it references must be uninitialized,
/// or its `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer slice up to, but not including,
/// the returned index is initialized. The memory referenced by
/// `source` is uninitialized after the function returns.
/// The buffer slice must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the position of the next uninitialized element
/// in the buffer slice, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to the
/// slice's `startIndex`. If `source` contains as many elements as the slice
/// can hold, the returned index is equal to the slice's `endIndex`.
///
/// - Note: The memory regions referenced by `source` and this buffer slice
/// may overlap.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Parameter source: A buffer containing the values to copy.
/// The memory region underlying `source` must be initialized.
/// - Returns: The index one past the last element of the buffer slice
/// initialized by this function.
@inlinable
@_alwaysEmitIntoClient
public func moveInitialize<Element>(
fromContentsOf source: UnsafeMutableBufferPointer<Element>
) -> Index where Base == UnsafeMutableBufferPointer<Element> {
let buffer = Base(rebasing: self)
let index = buffer.moveInitialize(fromContentsOf: source)
let distance = buffer.distance(from: buffer.startIndex, to: index)
return startIndex.advanced(by: distance)
}
/// Moves every element of an initialized source buffer slice into the
/// uninitialized memory referenced by this buffer slice, leaving the
/// source memory uninitialized and this buffer slice's memory initialized.
///
/// Prior to calling the `moveInitialize(fromContentsOf:)` method on a
/// buffer slice, the memory it references must be uninitialized,
/// or its `Element` type must be a trivial type. After the call,
/// the memory referenced by the buffer slice up to, but not including,
/// the returned index is initialized. The memory referenced by
/// `source` is uninitialized after the function returns.
/// The buffer slice must reference enough memory to accommodate
/// `source.count` elements.
///
/// The returned index is the position of the next uninitialized element
/// in the buffer slice, one past the index of the last element written.
/// If `source` contains no elements, the returned index is equal to the
/// slice's `startIndex`. If `source` contains as many elements as the slice
/// can hold, the returned index is equal to the slice's `endIndex`.
///
/// - Note: The memory regions referenced by `source` and this buffer slice
/// may overlap.
///
/// - Precondition: `self.count` >= `source.count`
///
/// - Parameter source: A buffer slice containing the values to copy.
/// The memory region underlying `source` must be initialized.
/// - Returns: The index one past the last element of the buffer slice
/// initialized by this function.
@inlinable
@_alwaysEmitIntoClient
public func moveInitialize<Element>(
fromContentsOf source: Slice<UnsafeMutableBufferPointer<Element>>
) -> Index where Base == UnsafeMutableBufferPointer<Element> {
let buffer = Base(rebasing: self)
let index = buffer.moveInitialize(fromContentsOf: source)
let distance = buffer.distance(from: buffer.startIndex, to: index)
return startIndex.advanced(by: distance)
}
/// Deinitializes every instance in this buffer slice.
///
/// The region of memory underlying this buffer slice must be fully
/// initialized. After calling `deinitialize(count:)`, the memory
/// is uninitialized, but still bound to the `Element` type.
///
/// - Note: All buffer elements must already be initialized.
///
/// - Returns: A raw buffer to the same range of memory as this buffer.
/// The range of memory is still bound to `Element`.
@discardableResult
@inlinable
@_alwaysEmitIntoClient
public func deinitialize<Element>() -> UnsafeMutableRawBufferPointer
where Base == UnsafeMutableBufferPointer<Element> {
Base(rebasing: self).deinitialize()
}
/// Initializes the element at `index` to the given value.
///
/// The memory underlying the destination element must be uninitialized,
/// or `Element` must be a trivial type. After a call to `initialize(to:)`,
/// the memory underlying this element of the buffer slice is initialized.
///
/// - Parameters:
/// - value: The value used to initialize the buffer element's memory.
/// - index: The index of the element to initialize
@inlinable
@_alwaysEmitIntoClient
public func initializeElement<Element>(at index: Int, to value: Element)
where Base == UnsafeMutableBufferPointer<Element> {
assert(startIndex <= index && index < endIndex)
base.baseAddress.unsafelyUnwrapped.advanced(by: index).initialize(to: value)
}
}
#endif
#if swift(<5.8)
extension UnsafeMutableBufferPointer {
/// Updates every element of this buffer's initialized memory.
///
/// The buffer’s memory must be initialized or its `Element` type
/// must be a trivial type.
///
/// - Note: All buffer elements must already be initialized.
///
/// - Parameters:
/// - repeatedValue: The value used when updating this pointer's memory.
@_alwaysEmitIntoClient
public func update(repeating repeatedValue: Element) {
guard let dstBase = baseAddress else { return }
dstBase.update(repeating: repeatedValue, count: count)
}
}
#endif
#if swift(<5.8)
extension Slice {
/// Updates every element of this buffer slice's initialized memory.
///
/// The buffer slice’s memory must be initialized or its `Element`
/// must be a trivial type.
///
/// - Note: All buffer elements must already be initialized.
///
/// - Parameters:
/// - repeatedValue: The value used when updating this pointer's memory.
@_alwaysEmitIntoClient
public func update<Element>(repeating repeatedValue: Element)
where Base == UnsafeMutableBufferPointer<Element> {
Base(rebasing: self).update(repeating: repeatedValue)
}
}
#endif
#endif // COLLECTIONS_SINGLE_MODULE
@@ -1,72 +0,0 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2022 - 2024 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
//
//===----------------------------------------------------------------------===//
// #############################################################################
// # #
// # DO NOT EDIT THIS FILE; IT IS AUTOGENERATED. #
// # #
// #############################################################################
// In single module mode, we need these declarations to be internal,
// but in regular builds we want them to be public. Unfortunately
// the current best way to do this is to duplicate all definitions.
#if COLLECTIONS_SINGLE_MODULE
#if swift(<5.8)
extension UnsafeMutablePointer {
/// Update this pointer's initialized memory with the specified number of
/// consecutive copies of the given value.
///
/// The region of memory starting at this pointer and covering `count`
/// instances of the pointer's `Pointee` type must be initialized or
/// `Pointee` must be a trivial type. After calling
/// `update(repeating:count:)`, the region is initialized.
///
/// - Parameters:
/// - repeatedValue: The value used when updating this pointer's memory.
/// - count: The number of consecutive elements to update.
/// `count` must not be negative.
@_alwaysEmitIntoClient
internal func update(repeating repeatedValue: Pointee, count: Int) {
assert(count >= 0, "UnsafeMutablePointer.update(repeating:count:) with negative count")
for i in 0 ..< count {
self[i] = repeatedValue
}
}
}
#endif
#else // !COLLECTIONS_SINGLE_MODULE
#if swift(<5.8)
extension UnsafeMutablePointer {
/// Update this pointer's initialized memory with the specified number of
/// consecutive copies of the given value.
///
/// The region of memory starting at this pointer and covering `count`
/// instances of the pointer's `Pointee` type must be initialized or
/// `Pointee` must be a trivial type. After calling
/// `update(repeating:count:)`, the region is initialized.
///
/// - Parameters:
/// - repeatedValue: The value used when updating this pointer's memory.
/// - count: The number of consecutive elements to update.
/// `count` must not be negative.
@_alwaysEmitIntoClient
public func update(repeating repeatedValue: Pointee, count: Int) {
assert(count >= 0, "UnsafeMutablePointer.update(repeating:count:) with negative count")
for i in 0 ..< count {
self[i] = repeatedValue
}
}
}
#endif
#endif // COLLECTIONS_SINGLE_MODULE
@@ -1,164 +0,0 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2022 - 2024 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
//
//===----------------------------------------------------------------------===//
// #############################################################################
// # #
// # DO NOT EDIT THIS FILE; IT IS AUTOGENERATED. #
// # #
// #############################################################################
// In single module mode, we need these declarations to be internal,
// but in regular builds we want them to be public. Unfortunately
// the current best way to do this is to duplicate all definitions.
#if COLLECTIONS_SINGLE_MODULE
#if compiler(<5.7) || (os(macOS) && compiler(<5.8)) // SE-0334
extension UnsafeRawPointer {
/// Obtain the next pointer properly aligned to store a value of type `T`.
///
/// If `self` is properly aligned for accessing `T`,
/// this function returns `self`.
///
/// - Parameters:
/// - type: the type to be stored at the returned address.
/// - Returns: a pointer properly aligned to store a value of type `T`.
@inlinable
@_alwaysEmitIntoClient
internal func alignedUp<T>(for type: T.Type) -> Self {
let mask = UInt(MemoryLayout<T>.alignment) &- 1
let bits = (UInt(bitPattern: self) &+ mask) & ~mask
return Self(bitPattern: bits)!
}
/// Obtain the preceding pointer properly aligned to store a value of type `T`.
///
/// If `self` is properly aligned for accessing `T`,
/// this function returns `self`.
///
/// - Parameters:
/// - type: the type to be stored at the returned address.
/// - Returns: a pointer properly aligned to store a value of type `T`.
@inlinable
@_alwaysEmitIntoClient
internal func alignedDown<T>(for type: T.Type) -> Self {
let mask = UInt(MemoryLayout<T>.alignment) &- 1
let bits = UInt(bitPattern: self) & ~mask
return Self(bitPattern: bits)!
}
}
extension UnsafeMutableRawPointer {
/// Obtain the next pointer properly aligned to store a value of type `T`.
///
/// If `self` is properly aligned for accessing `T`,
/// this function returns `self`.
///
/// - Parameters:
/// - type: the type to be stored at the returned address.
/// - Returns: a pointer properly aligned to store a value of type `T`.
@inlinable
@_alwaysEmitIntoClient
internal func alignedUp<T>(for type: T.Type) -> Self {
let mask = UInt(MemoryLayout<T>.alignment) &- 1
let bits = (UInt(bitPattern: self) &+ mask) & ~mask
return Self(bitPattern: bits)!
}
/// Obtain the preceding pointer properly aligned to store a value of type `T`.
///
/// If `self` is properly aligned for accessing `T`,
/// this function returns `self`.
///
/// - Parameters:
/// - type: the type to be stored at the returned address.
/// - Returns: a pointer properly aligned to store a value of type `T`.
@inlinable
@_alwaysEmitIntoClient
internal func alignedDown<T>(for type: T.Type) -> Self {
let mask = UInt(MemoryLayout<T>.alignment) &- 1
let bits = UInt(bitPattern: self) & ~mask
return Self(bitPattern: bits)!
}
}
#endif
#else // !COLLECTIONS_SINGLE_MODULE
#if compiler(<5.7) || (os(macOS) && compiler(<5.8)) // SE-0334
extension UnsafeRawPointer {
/// Obtain the next pointer properly aligned to store a value of type `T`.
///
/// If `self` is properly aligned for accessing `T`,
/// this function returns `self`.
///
/// - Parameters:
/// - type: the type to be stored at the returned address.
/// - Returns: a pointer properly aligned to store a value of type `T`.
@inlinable
@_alwaysEmitIntoClient
public func alignedUp<T>(for type: T.Type) -> Self {
let mask = UInt(MemoryLayout<T>.alignment) &- 1
let bits = (UInt(bitPattern: self) &+ mask) & ~mask
return Self(bitPattern: bits)!
}
/// Obtain the preceding pointer properly aligned to store a value of type `T`.
///
/// If `self` is properly aligned for accessing `T`,
/// this function returns `self`.
///
/// - Parameters:
/// - type: the type to be stored at the returned address.
/// - Returns: a pointer properly aligned to store a value of type `T`.
@inlinable
@_alwaysEmitIntoClient
public func alignedDown<T>(for type: T.Type) -> Self {
let mask = UInt(MemoryLayout<T>.alignment) &- 1
let bits = UInt(bitPattern: self) & ~mask
return Self(bitPattern: bits)!
}
}
extension UnsafeMutableRawPointer {
/// Obtain the next pointer properly aligned to store a value of type `T`.
///
/// If `self` is properly aligned for accessing `T`,
/// this function returns `self`.
///
/// - Parameters:
/// - type: the type to be stored at the returned address.
/// - Returns: a pointer properly aligned to store a value of type `T`.
@inlinable
@_alwaysEmitIntoClient
public func alignedUp<T>(for type: T.Type) -> Self {
let mask = UInt(MemoryLayout<T>.alignment) &- 1
let bits = (UInt(bitPattern: self) &+ mask) & ~mask
return Self(bitPattern: bits)!
}
/// Obtain the preceding pointer properly aligned to store a value of type `T`.
///
/// If `self` is properly aligned for accessing `T`,
/// this function returns `self`.
///
/// - Parameters:
/// - type: the type to be stored at the returned address.
/// - Returns: a pointer properly aligned to store a value of type `T`.
@inlinable
@_alwaysEmitIntoClient
public func alignedDown<T>(for type: T.Type) -> Self {
let mask = UInt(MemoryLayout<T>.alignment) &- 1
let bits = UInt(bitPattern: self) & ~mask
return Self(bitPattern: bits)!
}
}
#endif
#endif // COLLECTIONS_SINGLE_MODULE
@@ -1,34 +0,0 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2023 - 2024 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
//
//===----------------------------------------------------------------------===//
%{
from gyb_utils import *
}%
${autogenerated_warning()}
% for modifier in visibility_levels:
${visibility_boilerplate(modifier)}
/// Returns `x` as its concrete type `U`, or `nil` if `x` has a different
/// concrete type.
///
/// This cast can be useful for dispatching to specializations of generic
/// functions.
@_transparent
@inlinable
${modifier} func _specialize<T, U>(_ x: T, for: U.Type) -> U? {
// Note: this was ported from recent versions of the Swift stdlib.
guard T.self == U.self else {
return nil
}
return _identityCast(x, to: U.self)
}
% end
${visibility_boilerplate("end")}
@@ -118,30 +118,12 @@ extension _UnsafeBitSet {
run body: (inout Self) throws -> Void
) rethrows {
assert(wordCount >= 0)
#if compiler(>=5.6)
return try withUnsafeTemporaryAllocation(
of: _Word.self, capacity: wordCount
) { words in
var bitset = Self(words: words, mutable: true)
return try body(&bitset)
}
#else
if wordCount <= 2 {
var buffer: (_Word, _Word) = (.empty, .empty)
return try withUnsafeMutablePointer(to: &buffer) { p in
// Homogeneous tuples are layout-compatible with their component type.
let start = UnsafeMutableRawPointer(p)
.assumingMemoryBound(to: _Word.self)
let words = UnsafeMutableBufferPointer(start: start, count: wordCount)
var bitset = Self(words: words, mutable: true)
return try body(&bitset)
}
}
let words = UnsafeMutableBufferPointer<_Word>.allocate(capacity: wordCount)
defer { words.deallocate() }
var bitset = Self(words: words, mutable: true)
return try body(&bitset)
#endif
}
}
@@ -124,30 +124,12 @@ extension _UnsafeBitSet {
run body: (inout Self) throws -> Void
) rethrows {
assert(wordCount >= 0)
#if compiler(>=5.6)
return try withUnsafeTemporaryAllocation(
of: _Word.self, capacity: wordCount
) { words in
var bitset = Self(words: words, mutable: true)
return try body(&bitset)
}
#else
if wordCount <= 2 {
var buffer: (_Word, _Word) = (.empty, .empty)
return try withUnsafeMutablePointer(to: &buffer) { p in
// Homogeneous tuples are layout-compatible with their component type.
let start = UnsafeMutableRawPointer(p)
.assumingMemoryBound(to: _Word.self)
let words = UnsafeMutableBufferPointer(start: start, count: wordCount)
var bitset = Self(words: words, mutable: true)
return try body(&bitset)
}
}
let words = UnsafeMutableBufferPointer<_Word>.allocate(capacity: wordCount)
defer { words.deallocate() }
var bitset = Self(words: words, mutable: true)
return try body(&bitset)
#endif
}
}
@@ -596,30 +578,12 @@ extension _UnsafeBitSet {
run body: (inout Self) throws -> Void
) rethrows {
assert(wordCount >= 0)
#if compiler(>=5.6)
return try withUnsafeTemporaryAllocation(
of: _Word.self, capacity: wordCount
) { words in
var bitset = Self(words: words, mutable: true)
return try body(&bitset)
}
#else
if wordCount <= 2 {
var buffer: (_Word, _Word) = (.empty, .empty)
return try withUnsafeMutablePointer(to: &buffer) { p in
// Homogeneous tuples are layout-compatible with their component type.
let start = UnsafeMutableRawPointer(p)
.assumingMemoryBound(to: _Word.self)
let words = UnsafeMutableBufferPointer(start: start, count: wordCount)
var bitset = Self(words: words, mutable: true)
return try body(&bitset)
}
}
let words = UnsafeMutableBufferPointer<_Word>.allocate(capacity: wordCount)
defer { words.deallocate() }
var bitset = Self(words: words, mutable: true)
return try body(&bitset)
#endif
}
}
@@ -18,7 +18,7 @@ ${autogenerated_warning()}
${visibility_boilerplate(modifier)}
extension UnsafeMutableBufferPointer {
@inlinable
public func initialize(fromContentsOf source: Self) -> Index {
${modifier} func initialize(fromContentsOf source: Self) -> Index {
guard source.count > 0 else { return 0 }
precondition(
source.count <= self.count,
@@ -30,7 +30,7 @@ extension UnsafeMutableBufferPointer {
}
@inlinable
public func initialize(fromContentsOf source: Slice<Self>) -> Index {
${modifier} func initialize(fromContentsOf source: Slice<Self>) -> Index {
let sourceCount = source.count
guard sourceCount > 0 else { return 0 }
precondition(
@@ -45,7 +45,7 @@ extension UnsafeMutableBufferPointer {
extension Slice {
@inlinable @inline(__always)
public func initialize<Element>(
${modifier} func initialize<Element>(
fromContentsOf source: UnsafeMutableBufferPointer<Element>
) -> Index
where Base == UnsafeMutableBufferPointer<Element>
@@ -56,7 +56,7 @@ extension Slice {
}
@inlinable @inline(__always)
public func initialize<Element>(
${modifier} func initialize<Element>(
fromContentsOf source: Slice<UnsafeMutableBufferPointer<Element>>
) -> Index
where Base == UnsafeMutableBufferPointer<Element>
@@ -69,7 +69,7 @@ extension Slice {
extension UnsafeMutableBufferPointer {
@inlinable @inline(__always)
public func initializeAll<C: Collection>(
${modifier} func initializeAll<C: Collection>(
fromContentsOf source: C
) where C.Element == Element {
let i = self.initialize(fromContentsOf: source)
@@ -77,25 +77,25 @@ extension UnsafeMutableBufferPointer {
}
@inlinable @inline(__always)
public func initializeAll(fromContentsOf source: Self) {
${modifier} func initializeAll(fromContentsOf source: Self) {
let i = self.initialize(fromContentsOf: source)
assert(i == self.endIndex)
}
@inlinable @inline(__always)
public func initializeAll(fromContentsOf source: Slice<Self>) {
${modifier} func initializeAll(fromContentsOf source: Slice<Self>) {
let i = self.initialize(fromContentsOf: source)
assert(i == self.endIndex)
}
@inlinable @inline(__always)
public func moveInitializeAll(fromContentsOf source: Self) {
${modifier} func moveInitializeAll(fromContentsOf source: Self) {
let i = self.moveInitialize(fromContentsOf: source)
assert(i == self.endIndex)
}
@inlinable @inline(__always)
public func moveInitializeAll(fromContentsOf source: Slice<Self>) {
${modifier} func moveInitializeAll(fromContentsOf source: Slice<Self>) {
let i = self.moveInitialize(fromContentsOf: source)
assert(i == self.endIndex)
}
@@ -103,7 +103,7 @@ extension UnsafeMutableBufferPointer {
extension Slice {
@inlinable @inline(__always)
public func initializeAll<C: Collection>(
${modifier} func initializeAll<C: Collection>(
fromContentsOf source: C
) where Base == UnsafeMutableBufferPointer<C.Element> {
let i = self.initialize(fromContentsOf: source)
@@ -111,7 +111,7 @@ extension Slice {
}
@inlinable @inline(__always)
public func initializeAll<Element>(
${modifier} func initializeAll<Element>(
fromContentsOf source: UnsafeMutableBufferPointer<Element>
) where Base == UnsafeMutableBufferPointer<Element> {
let target = UnsafeMutableBufferPointer(rebasing: self)
@@ -119,7 +119,7 @@ extension Slice {
}
@inlinable @inline(__always)
public func initializeAll<Element>(
${modifier} func initializeAll<Element>(
fromContentsOf source: Slice<UnsafeMutableBufferPointer<Element>>
) where Base == UnsafeMutableBufferPointer<Element> {
let target = UnsafeMutableBufferPointer(rebasing: self)
@@ -127,7 +127,7 @@ extension Slice {
}
@inlinable @inline(__always)
public func moveInitializeAll<Element>(
${modifier} func moveInitializeAll<Element>(
fromContentsOf source: UnsafeMutableBufferPointer<Element>
) where Base == UnsafeMutableBufferPointer<Element> {
let target = UnsafeMutableBufferPointer(rebasing: self)
@@ -135,7 +135,7 @@ extension Slice {
}
@inlinable @inline(__always)
public func moveInitializeAll<Element>(
${modifier} func moveInitializeAll<Element>(
fromContentsOf source: Slice<UnsafeMutableBufferPointer<Element>>
) where Base == UnsafeMutableBufferPointer<Element> {
let target = UnsafeMutableBufferPointer(rebasing: self)
@@ -1,54 +0,0 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2023 - 2024 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
//
//===----------------------------------------------------------------------===//
// #############################################################################
// # #
// # DO NOT EDIT THIS FILE; IT IS AUTOGENERATED. #
// # #
// #############################################################################
// In single module mode, we need these declarations to be internal,
// but in regular builds we want them to be public. Unfortunately
// the current best way to do this is to duplicate all definitions.
#if COLLECTIONS_SINGLE_MODULE
/// Returns `x` as its concrete type `U`, or `nil` if `x` has a different
/// concrete type.
///
/// This cast can be useful for dispatching to specializations of generic
/// functions.
@_transparent
@inlinable
internal func _specialize<T, U>(_ x: T, for: U.Type) -> U? {
// Note: this was ported from recent versions of the Swift stdlib.
guard T.self == U.self else {
return nil
}
return _identityCast(x, to: U.self)
}
#else // !COLLECTIONS_SINGLE_MODULE
/// Returns `x` as its concrete type `U`, or `nil` if `x` has a different
/// concrete type.
///
/// This cast can be useful for dispatching to specializations of generic
/// functions.
@_transparent
@inlinable
public func _specialize<T, U>(_ x: T, for: U.Type) -> U? {
// Note: this was ported from recent versions of the Swift stdlib.
guard T.self == U.self else {
return nil
}
return _identityCast(x, to: U.self)
}
#endif // COLLECTIONS_SINGLE_MODULE
@@ -24,7 +24,7 @@
#if COLLECTIONS_SINGLE_MODULE
extension UnsafeMutableBufferPointer {
@inlinable
public func initialize(fromContentsOf source: Self) -> Index {
internal func initialize(fromContentsOf source: Self) -> Index {
guard source.count > 0 else { return 0 }
precondition(
source.count <= self.count,
@@ -36,7 +36,7 @@ extension UnsafeMutableBufferPointer {
}
@inlinable
public func initialize(fromContentsOf source: Slice<Self>) -> Index {
internal func initialize(fromContentsOf source: Slice<Self>) -> Index {
let sourceCount = source.count
guard sourceCount > 0 else { return 0 }
precondition(
@@ -51,7 +51,7 @@ extension UnsafeMutableBufferPointer {
extension Slice {
@inlinable @inline(__always)
public func initialize<Element>(
internal func initialize<Element>(
fromContentsOf source: UnsafeMutableBufferPointer<Element>
) -> Index
where Base == UnsafeMutableBufferPointer<Element>
@@ -62,7 +62,7 @@ extension Slice {
}
@inlinable @inline(__always)
public func initialize<Element>(
internal func initialize<Element>(
fromContentsOf source: Slice<UnsafeMutableBufferPointer<Element>>
) -> Index
where Base == UnsafeMutableBufferPointer<Element>
@@ -75,7 +75,7 @@ extension Slice {
extension UnsafeMutableBufferPointer {
@inlinable @inline(__always)
public func initializeAll<C: Collection>(
internal func initializeAll<C: Collection>(
fromContentsOf source: C
) where C.Element == Element {
let i = self.initialize(fromContentsOf: source)
@@ -83,25 +83,25 @@ extension UnsafeMutableBufferPointer {
}
@inlinable @inline(__always)
public func initializeAll(fromContentsOf source: Self) {
internal func initializeAll(fromContentsOf source: Self) {
let i = self.initialize(fromContentsOf: source)
assert(i == self.endIndex)
}
@inlinable @inline(__always)
public func initializeAll(fromContentsOf source: Slice<Self>) {
internal func initializeAll(fromContentsOf source: Slice<Self>) {
let i = self.initialize(fromContentsOf: source)
assert(i == self.endIndex)
}
@inlinable @inline(__always)
public func moveInitializeAll(fromContentsOf source: Self) {
internal func moveInitializeAll(fromContentsOf source: Self) {
let i = self.moveInitialize(fromContentsOf: source)
assert(i == self.endIndex)
}
@inlinable @inline(__always)
public func moveInitializeAll(fromContentsOf source: Slice<Self>) {
internal func moveInitializeAll(fromContentsOf source: Slice<Self>) {
let i = self.moveInitialize(fromContentsOf: source)
assert(i == self.endIndex)
}
@@ -109,7 +109,7 @@ extension UnsafeMutableBufferPointer {
extension Slice {
@inlinable @inline(__always)
public func initializeAll<C: Collection>(
internal func initializeAll<C: Collection>(
fromContentsOf source: C
) where Base == UnsafeMutableBufferPointer<C.Element> {
let i = self.initialize(fromContentsOf: source)
@@ -117,7 +117,7 @@ extension Slice {
}
@inlinable @inline(__always)
public func initializeAll<Element>(
internal func initializeAll<Element>(
fromContentsOf source: UnsafeMutableBufferPointer<Element>
) where Base == UnsafeMutableBufferPointer<Element> {
let target = UnsafeMutableBufferPointer(rebasing: self)
@@ -125,7 +125,7 @@ extension Slice {
}
@inlinable @inline(__always)
public func initializeAll<Element>(
internal func initializeAll<Element>(
fromContentsOf source: Slice<UnsafeMutableBufferPointer<Element>>
) where Base == UnsafeMutableBufferPointer<Element> {
let target = UnsafeMutableBufferPointer(rebasing: self)
@@ -133,7 +133,7 @@ extension Slice {
}
@inlinable @inline(__always)
public func moveInitializeAll<Element>(
internal func moveInitializeAll<Element>(
fromContentsOf source: UnsafeMutableBufferPointer<Element>
) where Base == UnsafeMutableBufferPointer<Element> {
let target = UnsafeMutableBufferPointer(rebasing: self)
@@ -141,7 +141,7 @@ extension Slice {
}
@inlinable @inline(__always)
public func moveInitializeAll<Element>(
internal func moveInitializeAll<Element>(
fromContentsOf source: Slice<UnsafeMutableBufferPointer<Element>>
) where Base == UnsafeMutableBufferPointer<Element> {
let target = UnsafeMutableBufferPointer(rebasing: self)
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
struct Builder {
@@ -145,5 +143,3 @@ extension BigString.Builder {
return string
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
/// The estimated maximum number of UTF-8 code units that `BigString` is guaranteed to be able
@@ -530,5 +528,3 @@ extension BigString {
body(lastChunk[..<end._chunkIndex])
}
}
#endif
@@ -9,13 +9,9 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
public func _dump(heightLimit: Int = .max) {
_rope._dump(heightLimit: heightLimit)
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
public struct Index: Sendable {
@@ -247,4 +245,3 @@ extension BigString {
return Index(baseUTF8Offset: i.utf8Offset - ci._utf8Offset, _rope: ri, chunk: ci)
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
func _ingester(
@@ -169,5 +167,3 @@ extension BigString._Chunk {
assert(ingester.isAtEnd)
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
public func _invariantCheck() {
@@ -35,5 +33,3 @@ extension BigString {
#endif
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
struct ChunkIterator {
@@ -34,5 +32,3 @@ extension BigString.ChunkIterator: IteratorProtocol {
base.next()?.string
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
internal protocol _StringMetric: RopeMetric where Element == BigString._Chunk {
func distance(
@@ -205,5 +203,3 @@ extension BigString {
}
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
struct Summary {
@@ -78,5 +76,3 @@ extension BigString.Summary: RopeSummary {
utf8 -= other.utf8
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
/// The core of a B-tree based String implementation.
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
public struct BigString: Sendable {
@@ -22,12 +20,3 @@ public struct BigString: Sendable {
self._rope = _rope
}
}
#else
// `BigString` depends on fixes and newly exposed functionality that landed in
// version 5.8 of the Swift Standard Library.
@available(*, unavailable, message: "BigString depends on version 5.8 of the Swift Standard Library")
public struct BigString: Sendable {}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString._Chunk {
mutating func append(_ other: __owned Self) {
@@ -170,5 +168,3 @@ extension BigString._Chunk {
return .split(spawn: spawn, endStates: (sum - offset, old, new))
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString._Chunk {
@inline(__always)
@@ -67,5 +65,3 @@ extension BigString._Chunk {
return (prev, state)
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString._Chunk {
struct Counts: Equatable {
@@ -148,5 +146,3 @@ extension BigString._Chunk.Counts {
self._characters += other._characters
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString._Chunk: CustomStringConvertible {
var description: String {
@@ -22,13 +20,15 @@ extension BigString._Chunk: CustomStringConvertible {
}
var _identity: String {
#if arch(arm64) || arch(x86_64)
#if _pointerBitWidth(_64)
// Let's use the second word of the string representation as the identity; it contains
// the String's storage reference (if any).
let b = unsafeBitCast(self.string, to: (UInt64, UInt64).self)
return "@" + String(b.1, radix: 16)._rpad(to: 17)
#else
#elseif _pointerBitWidth(_32)
return ""
#else
#error("Unexpected pointer bit width")
#endif
}
@@ -68,5 +68,3 @@ extension BigString._Chunk: CustomStringConvertible {
return result
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension UInt8 {
/// Returns true if this is a leading code unit in the UTF-8 encoding of a Unicode scalar that
@@ -108,5 +106,3 @@ extension BigString._Chunk {
return (false, false)
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString._Chunk {
/// UTF-16 index lookup.
@@ -26,5 +24,3 @@ extension BigString._Chunk {
return index
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString._Chunk: RopeElement {
typealias Summary = BigString.Summary
@@ -154,5 +152,3 @@ extension BigString._Chunk {
left = Self(left.string[..<i], counts.left)
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString._Chunk {
func splitCounts(at i: String.Index) -> (left: Counts, right: Counts) {
@@ -145,5 +143,3 @@ extension BigString._Chunk {
return result
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
internal struct _Chunk {
@@ -119,5 +117,3 @@ extension BigString._Chunk {
utf8Count + other.utf8Count <= Self.maxUTF8Count
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString: BidirectionalCollection {
public typealias SubSequence = BigSubstring
@@ -71,5 +69,3 @@ extension BigString {
_characterIndex(roundingUp: i)
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString: Comparable {
public static func < (left: Self, right: Self) -> Bool {
@@ -84,5 +82,3 @@ extension BigString {
}
}
}
#endif
@@ -9,13 +9,9 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString: CustomDebugStringConvertible {
public var debugDescription: String {
description.debugDescription
}
}
#endif
@@ -9,13 +9,9 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString: CustomStringConvertible {
public var description: String {
String(self)
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
public func isIdentical(to other: Self) -> Bool {
@@ -101,5 +99,3 @@ extension BigString {
return true
}
}
#endif
@@ -9,13 +9,9 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString: ExpressibleByStringLiteral {
public init(stringLiteral value: String) {
self.init(value)
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString: Hashable {
public func hash(into hasher: inout Hasher) {
@@ -58,5 +56,3 @@ extension BigString {
hasher.combine(0xFF as UInt8)
}
}
#endif
@@ -9,11 +9,7 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString: LosslessStringConvertible {
// init?(_: String) is implemented by RangeReplaceableCollection.init(_:)
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
#if !COLLECTIONS_SINGLE_MODULE
import InternalCollectionsUtilities
#endif
@@ -218,5 +216,3 @@ extension BigString: RangeReplaceableCollection {
self = BigString()
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString: Sequence {
public typealias Element = Character
@@ -224,6 +222,3 @@ extension BigString.Iterator {
self.utf8Offset < index.utf8Offset
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString: TextOutputStream {
public mutating func write(_ string: String) {
@@ -26,5 +24,3 @@ extension BigString: TextOutputStreamable {
}
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
mutating func _append(contentsOf other: __owned Substring) {
@@ -194,5 +192,3 @@ extension BigString {
self._rope = _Rope.join(other, self._rope)
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
internal init(_from input: some StringProtocol) {
@@ -146,5 +144,3 @@ extension String {
self.init(_from: big._base, in: big._bounds)
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
mutating func _insert(
@@ -97,5 +95,3 @@ extension BigString {
self = builder.finalize()
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
func _breakState(
@@ -267,5 +265,3 @@ extension BigString._Chunk {
return
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
mutating func _removeSubrange(_ bounds: Range<Index>) {
@@ -44,5 +42,3 @@ extension BigString {
return scalar
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
mutating func _replaceSubrange(
@@ -84,5 +82,3 @@ extension BigString {
return Builder(base: b, prefixEndState: startState, suffixStartState: endState)
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
mutating func split(
@@ -38,5 +36,3 @@ extension BigString {
return _rope.builder(splittingAt: index.utf8Offset, in: _UTF8Metric())
}
}
#endif
@@ -9,13 +9,9 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension Range<BigString.Index> {
internal var _isEmptyUTF8: Bool {
lowerBound.utf8Offset == upperBound.utf8Offset
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
public struct UTF16View: Sendable {
@@ -148,5 +146,3 @@ extension BigString.UTF16View {
_base._utf16Index(roundingUp: i)
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigString {
public struct UTF8View: Sendable {
@@ -184,5 +182,3 @@ extension BigString.UTF8View {
_base._utf8Index(roundingUp: i)
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
#if !COLLECTIONS_SINGLE_MODULE
import InternalCollectionsUtilities
#endif
@@ -394,5 +392,3 @@ extension BigString.UnicodeScalarView: RangeReplaceableCollection {
self._base = BigString()
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigSubstring {
public struct UTF16View: Sendable {
@@ -199,5 +197,3 @@ extension BigSubstring.UTF16View {
return _base._utf16Index(roundingUp: i)
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigSubstring {
public struct UTF8View: Sendable {
@@ -173,5 +171,3 @@ extension BigSubstring.UTF8View {
return _base._utf8Index(roundingUp: i)
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension BigSubstring {
public struct UnicodeScalarView: Sendable {
@@ -320,5 +318,3 @@ extension BigSubstring.UnicodeScalarView: RangeReplaceableCollection {
assert(_bounds.isEmpty)
}
}
#endif
@@ -9,8 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
public struct BigSubstring: Sendable {
var _base: BigString
@@ -368,5 +366,3 @@ extension BigSubstring: RangeReplaceableCollection {
assert(_bounds.isEmpty)
}
}
#endif
@@ -9,10 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(<5.8) && !COLLECTIONS_SINGLE_MODULE
import InternalCollectionsUtilities // for 5.8 polyfills
#endif
extension Rope {
@frozen // Not really! This module isn't ABI stable.
@usableFromInline
@@ -60,7 +60,6 @@ extension String {
}
}
#if swift(>=5.8) // _CharacterRecognizer
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension String {
@discardableResult
@@ -124,4 +123,3 @@ extension String {
return result
}
}
#endif
@@ -9,20 +9,15 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
internal typealias _CharacterRecognizer = Unicode._CharacterRecognizer
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
extension _CharacterRecognizer {
internal func _isKnownEqual(to other: Self) -> Bool {
// FIXME: Enable when Swift 5.9 ships.
// #if swift(>=5.9)
// if #available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) { // SwiftStdlib 5.9
// return self == other
// }
// #endif
if #available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *) { // SwiftStdlib 5.9
return self == other
}
return false
}
}
@@ -168,5 +163,3 @@ extension _CharacterRecognizer {
return (chars, prefix, suffix)
}
}
#endif
@@ -130,11 +130,13 @@ let fixtures: [Fixture] = {
func isAllowed() -> Bool {
let reject: FixtureFlavor
#if arch(i386) || arch(arm64_32)
#if _pointerBitWidth(_32)
reject = .large
#else
#elseif _pointerBitWidth(_64)
precondition(MemoryLayout<Int>.size == 8, "Unknown platform")
reject = .small
#else
#error("Unexpected pointer bit width")
#endif
return self != reject
}
-16
View File
@@ -15,19 +15,3 @@ var isRunningOnSwiftStdlib5_8: Bool {
}
return false
}
#if swift(<5.8)
extension String.Index {
var _description: String {
let raw = unsafeBitCast(self, to: UInt64.self)
let encodedOffset = Int(truncatingIfNeeded: raw &>> 16)
let transcodedOffset = Int(truncatingIfNeeded: (raw &>> 14) & 0x3)
var d = "\(encodedOffset)[unknown]"
if transcodedOffset > 0 {
d += "+\(transcodedOffset)"
}
return d
}
}
#endif
@@ -9,7 +9,6 @@
//
//===----------------------------------------------------------------------===//
#if swift(>=5.8)
import XCTest
#if COLLECTIONS_SINGLE_MODULE
import Collections
@@ -1053,4 +1052,3 @@ class TestBigString: CollectionTestCase {
expectNotEqual(cafe1.utf16, cafe2.utf16)
}
}
#endif
+1 -49
View File
@@ -12,8 +12,6 @@
7D9B859929E4F74400B291CD /* BitArray+LosslessStringConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D9B859329E4F74400B291CD /* BitArray+LosslessStringConvertible.swift */; };
7D9B859A29E4F74400B291CD /* BitArray+RandomBits.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D9B859429E4F74400B291CD /* BitArray+RandomBits.swift */; };
7D9B859B29E4F74400B291CD /* BitArray+ExpressibleByStringLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D9B859529E4F74400B291CD /* BitArray+ExpressibleByStringLiteral.swift */; };
7DB0AE762B6E06B300602A20 /* Specialize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB0AE752B6E06B300602A20 /* Specialize.swift */; };
7DB0AE772B6E06B300602A20 /* Specialize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB0AE752B6E06B300602A20 /* Specialize.swift */; };
7DE91B2F29CA6721004483EB /* Collections.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7DE91B2629CA6721004483EB /* Collections.framework */; };
7DE9200D29CA70F3004483EB /* OrderedDictionary+Equatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DE91E7529CA70F3004483EB /* OrderedDictionary+Equatable.swift */; };
7DE9200E29CA70F3004483EB /* OrderedDictionary+ExpressibleByDictionaryLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DE91E7629CA70F3004483EB /* OrderedDictionary+ExpressibleByDictionaryLiteral.swift */; };
@@ -353,9 +351,6 @@
7DE9221C29CA8576004483EB /* RangeReplaceableCollectionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DE921F729CA8576004483EB /* RangeReplaceableCollectionTests.swift */; };
7DE9221D29CA8576004483EB /* DequeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DE921F829CA8576004483EB /* DequeTests.swift */; };
7DE9221E29CA8576004483EB /* MutableCollectionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DE921F929CA8576004483EB /* MutableCollectionTests.swift */; };
7DEBDAF229CBEE5300ADC226 /* UnsafeMutableBufferPointer+SE-0370.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DEBDACD29CBEE5200ADC226 /* UnsafeMutableBufferPointer+SE-0370.swift */; };
7DEBDAF429CBEE5300ADC226 /* UnsafeMutablePointer+SE-0370.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DEBDACF29CBEE5200ADC226 /* UnsafeMutablePointer+SE-0370.swift */; };
7DEBDAF529CBEE5300ADC226 /* UnsafeRawPointer extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DEBDAD029CBEE5200ADC226 /* UnsafeRawPointer extensions.swift */; };
7DEBDAF829CBEE5300ADC226 /* UnsafeMutableBufferPointer+Extras.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DEBDAD429CBEE5300ADC226 /* UnsafeMutableBufferPointer+Extras.swift */; };
7DEBDAF929CBEE5300ADC226 /* UnsafeBufferPointer+Extras.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DEBDAD529CBEE5300ADC226 /* UnsafeBufferPointer+Extras.swift */; };
7DEBDAFA29CBEE5300ADC226 /* RandomAccessCollection+Offsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DEBDAD629CBEE5300ADC226 /* RandomAccessCollection+Offsets.swift */; };
@@ -372,9 +367,6 @@
7DEBDB0F29CBF68900ADC226 /* UInt+reversed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DEBDAE829CBEE5300ADC226 /* UInt+reversed.swift */; };
7DEBDB1029CBF68900ADC226 /* UInt+first and last set bit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DEBDAEA29CBEE5300ADC226 /* UInt+first and last set bit.swift */; };
7DEBDB1129CBF68900ADC226 /* FixedWidthInteger+roundUpToPowerOfTwo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DEBDAEB29CBEE5300ADC226 /* FixedWidthInteger+roundUpToPowerOfTwo.swift */; };
7DEBDB1229CBF68D00ADC226 /* UnsafeMutablePointer+SE-0370.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DEBDACF29CBEE5200ADC226 /* UnsafeMutablePointer+SE-0370.swift */; };
7DEBDB1429CBF68D00ADC226 /* UnsafeMutableBufferPointer+SE-0370.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DEBDACD29CBEE5200ADC226 /* UnsafeMutableBufferPointer+SE-0370.swift */; };
7DEBDB1529CBF68D00ADC226 /* UnsafeRawPointer extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DEBDAD029CBEE5200ADC226 /* UnsafeRawPointer extensions.swift */; };
7DEBDB1629CBF69F00ADC226 /* _UnsafeBitSet+Index.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DEBDADF29CBEE5300ADC226 /* _UnsafeBitSet+Index.swift */; };
7DEBDB1729CBF69F00ADC226 /* _UnsafeBitSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DEBDAE029CBEE5300ADC226 /* _UnsafeBitSet.swift */; };
7DEBDB1829CBF69F00ADC226 /* _UnsafeBitSet+_Word.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DEBDAE129CBEE5300ADC226 /* _UnsafeBitSet+_Word.swift */; };
@@ -447,8 +439,6 @@
7D9B859429E4F74400B291CD /* BitArray+RandomBits.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "BitArray+RandomBits.swift"; sourceTree = "<group>"; };
7D9B859529E4F74400B291CD /* BitArray+ExpressibleByStringLiteral.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "BitArray+ExpressibleByStringLiteral.swift"; sourceTree = "<group>"; };
7D9B859C29E4F77D00B291CD /* Collections.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = Collections.xctestplan; sourceTree = "<group>"; };
7DB0AE712B6E067A00602A20 /* Specialize.swift.gyb */ = {isa = PBXFileReference; lastKnownFileType = text; path = Specialize.swift.gyb; sourceTree = "<group>"; };
7DB0AE752B6E06B300602A20 /* Specialize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Specialize.swift; sourceTree = "<group>"; };
7DE91B2629CA6721004483EB /* Collections.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Collections.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7DE91B2E29CA6721004483EB /* CollectionsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CollectionsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
7DE91E7229CA70F3004483EB /* OrderedCollections.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = OrderedCollections.docc; sourceTree = "<group>"; };
@@ -813,12 +803,6 @@
7DE921F729CA8576004483EB /* RangeReplaceableCollectionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RangeReplaceableCollectionTests.swift; sourceTree = "<group>"; };
7DE921F829CA8576004483EB /* DequeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DequeTests.swift; sourceTree = "<group>"; };
7DE921F929CA8576004483EB /* MutableCollectionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutableCollectionTests.swift; sourceTree = "<group>"; };
7DEBDAC829CBEE5200ADC226 /* UnsafeMutablePointer+SE-0370.swift.gyb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "UnsafeMutablePointer+SE-0370.swift.gyb"; sourceTree = "<group>"; };
7DEBDAC929CBEE5200ADC226 /* UnsafeMutableBufferPointer+SE-0370.swift.gyb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "UnsafeMutableBufferPointer+SE-0370.swift.gyb"; sourceTree = "<group>"; };
7DEBDACB29CBEE5200ADC226 /* UnsafeRawPointer extensions.swift.gyb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "UnsafeRawPointer extensions.swift.gyb"; sourceTree = "<group>"; };
7DEBDACD29CBEE5200ADC226 /* UnsafeMutableBufferPointer+SE-0370.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UnsafeMutableBufferPointer+SE-0370.swift"; sourceTree = "<group>"; };
7DEBDACF29CBEE5200ADC226 /* UnsafeMutablePointer+SE-0370.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UnsafeMutablePointer+SE-0370.swift"; sourceTree = "<group>"; };
7DEBDAD029CBEE5200ADC226 /* UnsafeRawPointer extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UnsafeRawPointer extensions.swift"; sourceTree = "<group>"; };
7DEBDAD129CBEE5200ADC226 /* Descriptions.swift.gyb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Descriptions.swift.gyb; sourceTree = "<group>"; };
7DEBDAD229CBEE5200ADC226 /* RandomAccessCollection+Offsets.swift.gyb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "RandomAccessCollection+Offsets.swift.gyb"; sourceTree = "<group>"; };
7DEBDAD429CBEE5300ADC226 /* UnsafeMutableBufferPointer+Extras.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UnsafeMutableBufferPointer+Extras.swift"; sourceTree = "<group>"; };
@@ -1250,7 +1234,6 @@
isa = PBXGroup;
children = (
7DEBDAD329CBEE5300ADC226 /* autogenerated */,
7DEBDAC729CBEE5200ADC226 /* Compatibility */,
7DEBDAE229CBEE5300ADC226 /* IntegerTricks */,
7DEBDADA29CBEE5300ADC226 /* UnsafeBitSet */,
7DE91F3029CA70F3004483EB /* _SortedCollection.swift */,
@@ -1258,7 +1241,6 @@
7DEBDAED29CBEE5300ADC226 /* Debugging.swift.gyb */,
7DEBDAD129CBEE5200ADC226 /* Descriptions.swift.gyb */,
7DEBDAD229CBEE5200ADC226 /* RandomAccessCollection+Offsets.swift.gyb */,
7DB0AE712B6E067A00602A20 /* Specialize.swift.gyb */,
7DEBDAD929CBEE5300ADC226 /* UnsafeBufferPointer+Extras.swift.gyb */,
7DEBDAEC29CBEE5300ADC226 /* UnsafeMutableBufferPointer+Extras.swift.gyb */,
7DE91F2E29CA70F3004483EB /* CMakeLists.txt */,
@@ -1644,34 +1626,12 @@
path = DequeTests;
sourceTree = "<group>";
};
7DEBDAC729CBEE5200ADC226 /* Compatibility */ = {
isa = PBXGroup;
children = (
7DEBDACC29CBEE5200ADC226 /* autogenerated */,
7DEBDAC929CBEE5200ADC226 /* UnsafeMutableBufferPointer+SE-0370.swift.gyb */,
7DEBDAC829CBEE5200ADC226 /* UnsafeMutablePointer+SE-0370.swift.gyb */,
7DEBDACB29CBEE5200ADC226 /* UnsafeRawPointer extensions.swift.gyb */,
);
path = Compatibility;
sourceTree = "<group>";
};
7DEBDACC29CBEE5200ADC226 /* autogenerated */ = {
isa = PBXGroup;
children = (
7DEBDACD29CBEE5200ADC226 /* UnsafeMutableBufferPointer+SE-0370.swift */,
7DEBDACF29CBEE5200ADC226 /* UnsafeMutablePointer+SE-0370.swift */,
7DEBDAD029CBEE5200ADC226 /* UnsafeRawPointer extensions.swift */,
);
path = autogenerated;
sourceTree = "<group>";
};
7DEBDAD329CBEE5300ADC226 /* autogenerated */ = {
isa = PBXGroup;
children = (
7DEBDAD829CBEE5300ADC226 /* Debugging.swift */,
7DEBDAD729CBEE5300ADC226 /* Descriptions.swift */,
7DEBDAD629CBEE5300ADC226 /* RandomAccessCollection+Offsets.swift */,
7DB0AE752B6E06B300602A20 /* Specialize.swift */,
7DEBDAD529CBEE5300ADC226 /* UnsafeBufferPointer+Extras.swift */,
7DEBDAD429CBEE5300ADC226 /* UnsafeMutableBufferPointer+Extras.swift */,
);
@@ -1867,7 +1827,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1430;
LastUpgradeCheck = 1520;
LastUpgradeCheck = 1600;
TargetAttributes = {
7DE91B2529CA6721004483EB = {
CreatedOnToolsVersion = 14.3;
@@ -1922,7 +1882,6 @@
7DE9214529CA70F4004483EB /* _HashNode+Structural symmetricDifference.swift in Sources */,
7DE9201029CA70F3004483EB /* OrderedDictionary+Deprecations.swift in Sources */,
7DE9205929CA70F3004483EB /* Deque+Descriptions.swift in Sources */,
7DEBDAF529CBEE5300ADC226 /* UnsafeRawPointer extensions.swift in Sources */,
7DE9212729CA70F4004483EB /* TreeSet+Equatable.swift in Sources */,
7DE9213429CA70F4004483EB /* TreeSet+ExpressibleByArrayLiteral.swift in Sources */,
7DE9209729CA70F4004483EB /* _RopePath.swift in Sources */,
@@ -2002,7 +1961,6 @@
7DE9217629CA70F4004483EB /* TreeDictionary+Initializers.swift in Sources */,
7DE9207E29CA70F4004483EB /* BigString+UTF16View.swift in Sources */,
7DEBDAFA29CBEE5300ADC226 /* RandomAccessCollection+Offsets.swift in Sources */,
7DB0AE762B6E06B300602A20 /* Specialize.swift in Sources */,
7DE9216F29CA70F4004483EB /* TreeDictionary+CustomReflectable.swift in Sources */,
7DE920D729CA70F4004483EB /* BitSet+SetAlgebra isSuperset.swift in Sources */,
7DE920F429CA70F4004483EB /* BitArray+Hashable.swift in Sources */,
@@ -2033,7 +1991,6 @@
7DE920B529CA70F4004483EB /* _SortedCollection.swift in Sources */,
7DE9206929CA70F4004483EB /* BigString+Chunk+Indexing by UTF16.swift in Sources */,
7DE9202A29CA70F3004483EB /* OrderedSet+Partial SetAlgebra isSuperset.swift in Sources */,
7DEBDAF229CBEE5300ADC226 /* UnsafeMutableBufferPointer+SE-0370.swift in Sources */,
7DE9207D29CA70F4004483EB /* BigSubstring+UTF16View.swift in Sources */,
7DEBDAF829CBEE5300ADC226 /* UnsafeMutableBufferPointer+Extras.swift in Sources */,
7DE9217229CA70F4004483EB /* TreeDictionary+Sendable.swift in Sources */,
@@ -2164,7 +2121,6 @@
7DE9206729CA70F4004483EB /* BigString+Builder.swift in Sources */,
7DE9208B29CA70F4004483EB /* RopeMetric.swift in Sources */,
7DE9205A29CA70F3004483EB /* Deque+Extras.swift in Sources */,
7DEBDAF429CBEE5300ADC226 /* UnsafeMutablePointer+SE-0370.swift in Sources */,
7DE9205129CA70F3004483EB /* Deque+Hashable.swift in Sources */,
7DE9209929CA70F4004483EB /* Rope+Extract.swift in Sources */,
7DE9202629CA70F3004483EB /* OrderedSet+Partial SetAlgebra isStrictSubset.swift in Sources */,
@@ -2255,7 +2211,6 @@
7DE9221429CA8576004483EB /* OrderedSet Diffing Tests.swift in Sources */,
7DEBDB1D29CBF6B200ADC226 /* RandomAccessCollection+Offsets.swift in Sources */,
7DEBDB8529CCE44A00ADC226 /* AllOnesRandomNumberGenerator.swift in Sources */,
7DEBDB1429CBF68D00ADC226 /* UnsafeMutableBufferPointer+SE-0370.swift in Sources */,
7DE921FD29CA8576004483EB /* CombinatoricsChecks.swift in Sources */,
7DEBDB8B29CCE44A00ADC226 /* _CollectionState.swift in Sources */,
7DE9220229CA8576004483EB /* TreeDictionary Tests.swift in Sources */,
@@ -2284,12 +2239,10 @@
7DEBDB7D29CCE44A00ADC226 /* MinimalRangeReplaceableRandomAccessCollection.swift in Sources */,
7DEBDB8E29CCE44A00ADC226 /* Integer Square Root.swift in Sources */,
7DE9221E29CA8576004483EB /* MutableCollectionTests.swift in Sources */,
7DEBDB1229CBF68D00ADC226 /* UnsafeMutablePointer+SE-0370.swift in Sources */,
7DE9221529CA8576004483EB /* RandomAccessCollection+Extras.swift in Sources */,
7DEBDB7929CCE44A00ADC226 /* LifetimeTracked.swift in Sources */,
7DE921FC29CA8576004483EB /* IndexRangeCollectionTests.swift in Sources */,
7DE9221229CA8576004483EB /* OrderedDictionary+Elements Tests.swift in Sources */,
7DB0AE772B6E06B300602A20 /* Specialize.swift in Sources */,
7DEBDB7629CCE44A00ADC226 /* MinimalIndex.swift in Sources */,
7DE9221329CA8576004483EB /* OrderedSetInternals.swift in Sources */,
7DE9220329CA8576004483EB /* Colliders.swift in Sources */,
@@ -2321,7 +2274,6 @@
7DEBDB1829CBF69F00ADC226 /* _UnsafeBitSet+_Word.swift in Sources */,
7DE921B929CA81DC004483EB /* _SortedCollection.swift in Sources */,
7DEBDB1629CBF69F00ADC226 /* _UnsafeBitSet+Index.swift in Sources */,
7DEBDB1529CBF68D00ADC226 /* UnsafeRawPointer extensions.swift in Sources */,
7DEBDB7B29CCE44A00ADC226 /* IndexRangeCollection.swift in Sources */,
7DE9221929CA8576004483EB /* HeapTests.swift in Sources */,
7DEBDB1729CBF69F00ADC226 /* _UnsafeBitSet.swift in Sources */,
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
LastUpgradeVersion = "1600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"