diff --git a/.swiftci/5_10_ubuntu2204 b/.swiftci/5_10_ubuntu2204 index 3c9e8592..2e1ebb8c 100644 --- a/.swiftci/5_10_ubuntu2204 +++ b/.swiftci/5_10_ubuntu2204 @@ -1,5 +1,5 @@ LinuxSwiftPackageJob { swift_version_tag = "5.10-jammy" repo = "swift-collections" - branch = "release/1.1" + branch = "release/1.2" } diff --git a/.swiftci/5_7_ubuntu2204 b/.swiftci/5_7_ubuntu2204 deleted file mode 100644 index ed36db3f..00000000 --- a/.swiftci/5_7_ubuntu2204 +++ /dev/null @@ -1,5 +0,0 @@ -LinuxSwiftPackageJob { - swift_version_tag = "5.7-jammy" - repo = "swift-collections" - branch = "release/1.1" -} diff --git a/.swiftci/5_8_ubuntu2204 b/.swiftci/5_8_ubuntu2204 deleted file mode 100644 index c9659ea2..00000000 --- a/.swiftci/5_8_ubuntu2204 +++ /dev/null @@ -1,5 +0,0 @@ -LinuxSwiftPackageJob { - swift_version_tag = "5.8-jammy" - repo = "swift-collections" - branch = "release/1.1" -} diff --git a/.swiftci/5_9_ubuntu2204 b/.swiftci/5_9_ubuntu2204 index b2e270b8..f40dcdda 100644 --- a/.swiftci/5_9_ubuntu2204 +++ b/.swiftci/5_9_ubuntu2204 @@ -1,5 +1,5 @@ LinuxSwiftPackageJob { swift_version_tag = "5.9-jammy" repo = "swift-collections" - branch = "release/1.1" + branch = "release/1.2" } diff --git a/.swiftci/nightly_6_0_macos b/.swiftci/nightly_6_0_macos index 49cc88bc..3009d10d 100644 --- a/.swiftci/nightly_6_0_macos +++ b/.swiftci/nightly_6_0_macos @@ -1,5 +1,5 @@ macOSSwiftPackageJob { swift_version = "6.0" repo = "swift-collections" - branch = "release/1.1" + branch = "release/1.2" } diff --git a/.swiftci/nightly_6_0_ubuntu2204 b/.swiftci/nightly_6_0_ubuntu2204 index e4b31178..85238dae 100644 --- a/.swiftci/nightly_6_0_ubuntu2204 +++ b/.swiftci/nightly_6_0_ubuntu2204 @@ -1,5 +1,5 @@ LinuxSwiftPackageJob { nightly_docker_tag = "nightly-6.0-jammy" repo = "swift-collections" - branch = "release/1.1" + branch = "release/1.2" } diff --git a/.swiftci/nightly_main_macos b/.swiftci/nightly_main_macos index 94d74889..85deef45 100644 --- a/.swiftci/nightly_main_macos +++ b/.swiftci/nightly_main_macos @@ -1,5 +1,5 @@ macOSSwiftPackageJob { swift_version = "main" repo = "swift-collections" - branch = "release/1.1" + branch = "release/1.2" } diff --git a/.swiftci/nightly_main_ubuntu2204 b/.swiftci/nightly_main_ubuntu2204 index fa84f4e9..1682b567 100644 --- a/.swiftci/nightly_main_ubuntu2204 +++ b/.swiftci/nightly_main_ubuntu2204 @@ -1,5 +1,5 @@ LinuxSwiftPackageJob { nightly_docker_tag = "nightly-jammy" repo = "swift-collections" - branch = "release/1.1" + branch = "release/1.2" } diff --git a/Package.swift b/Package.swift index 449364ce..9fe302b9 100644 --- a/Package.swift +++ b/Package.swift @@ -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", diff --git a/README.md b/README.md index cfcd106c..89edc883 100644 --- a/README.md +++ b/README.md @@ -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. + + ### Code of Conduct diff --git a/Sources/DequeModule/_DequeBuffer.swift b/Sources/DequeModule/_DequeBuffer.swift index cb17d1dc..0ee1f27c 100644 --- a/Sources/DequeModule/_DequeBuffer.swift +++ b/Sources/DequeModule/_DequeBuffer.swift @@ -39,11 +39,22 @@ extension _DequeBuffer: CustomStringConvertible { } } +#if compiler(>=5.10) /// The type-punned empty singleton storage instance. @usableFromInline -internal let _emptyDequeStorage = _DequeBuffer.create( - minimumCapacity: 0, - makingHeaderWith: { _ in - _DequeBufferHeader(capacity: 0, count: 0, startSlot: .init(at: 0)) - }) - +nonisolated(unsafe) internal let _emptyDequeStorage + = _DequeBuffer.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.create( + minimumCapacity: 0, + makingHeaderWith: { _ in + _DequeBufferHeader(capacity: 0, count: 0, startSlot: .init(at: 0)) + }) +#endif diff --git a/Sources/HashTreeCollections/HashNode/_HashNode+Storage.swift b/Sources/HashTreeCollections/HashNode/_HashNode+Storage.swift index 0aefeb84..62780b8d 100644 --- a/Sources/HashTreeCollections/HashNode/_HashNode+Storage.swift +++ b/Sources/HashTreeCollections/HashNode/_HashNode+Storage.swift @@ -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 diff --git a/Sources/HashTreeCollections/HashNode/_HashStack.swift b/Sources/HashTreeCollections/HashNode/_HashStack.swift index caefce01..9fbbc427 100644 --- a/Sources/HashTreeCollections/HashNode/_HashStack.swift +++ b/Sources/HashTreeCollections/HashNode/_HashStack.swift @@ -14,7 +14,7 @@ @usableFromInline @frozen internal struct _HashStack { -#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 ) -#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 ) +#else +#error("Unexpected pointer bit width") #endif @usableFromInline @@ -46,18 +48,20 @@ internal struct _HashStack { @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 } diff --git a/Sources/InternalCollectionsUtilities/CMakeLists.txt b/Sources/InternalCollectionsUtilities/CMakeLists.txt index 808e36c2..0adb28f1 100644 --- a/Sources/InternalCollectionsUtilities/CMakeLists.txt +++ b/Sources/InternalCollectionsUtilities/CMakeLists.txt @@ -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" diff --git a/Sources/InternalCollectionsUtilities/Compatibility/UnsafeMutableBufferPointer+SE-0370.swift.gyb b/Sources/InternalCollectionsUtilities/Compatibility/UnsafeMutableBufferPointer+SE-0370.swift.gyb deleted file mode 100644 index 8e4f6deb..00000000 --- a/Sources/InternalCollectionsUtilities/Compatibility/UnsafeMutableBufferPointer+SE-0370.swift.gyb +++ /dev/null @@ -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.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( - 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) -> 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( - fromContentsOf source: C - ) -> Index where Base == UnsafeMutableBufferPointer { - 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( - fromContentsOf source: UnsafeMutableBufferPointer - ) -> Index where Base == UnsafeMutableBufferPointer { - 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( - fromContentsOf source: Slice> - ) -> Index where Base == UnsafeMutableBufferPointer { - 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() -> UnsafeMutableRawBufferPointer - where Base == UnsafeMutableBufferPointer { - 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(at index: Int, to value: Element) - where Base == UnsafeMutableBufferPointer { - 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(repeating repeatedValue: Element) - where Base == UnsafeMutableBufferPointer { - Base(rebasing: self).update(repeating: repeatedValue) - } -} -#endif -% end -${visibility_boilerplate("end")} diff --git a/Sources/InternalCollectionsUtilities/Compatibility/UnsafeMutablePointer+SE-0370.swift.gyb b/Sources/InternalCollectionsUtilities/Compatibility/UnsafeMutablePointer+SE-0370.swift.gyb deleted file mode 100644 index d95199cf..00000000 --- a/Sources/InternalCollectionsUtilities/Compatibility/UnsafeMutablePointer+SE-0370.swift.gyb +++ /dev/null @@ -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")} diff --git a/Sources/InternalCollectionsUtilities/Compatibility/UnsafeRawPointer extensions.swift.gyb b/Sources/InternalCollectionsUtilities/Compatibility/UnsafeRawPointer extensions.swift.gyb deleted file mode 100644 index 68c2eedc..00000000 --- a/Sources/InternalCollectionsUtilities/Compatibility/UnsafeRawPointer extensions.swift.gyb +++ /dev/null @@ -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(for type: T.Type) -> Self { - let mask = UInt(MemoryLayout.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(for type: T.Type) -> Self { - let mask = UInt(MemoryLayout.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(for type: T.Type) -> Self { - let mask = UInt(MemoryLayout.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(for type: T.Type) -> Self { - let mask = UInt(MemoryLayout.alignment) &- 1 - let bits = UInt(bitPattern: self) & ~mask - return Self(bitPattern: bits)! - } -} -#endif -% end -${visibility_boilerplate("end")} diff --git a/Sources/InternalCollectionsUtilities/Compatibility/autogenerated/UnsafeMutableBufferPointer+SE-0370.swift b/Sources/InternalCollectionsUtilities/Compatibility/autogenerated/UnsafeMutableBufferPointer+SE-0370.swift deleted file mode 100644 index 9068f8b9..00000000 --- a/Sources/InternalCollectionsUtilities/Compatibility/autogenerated/UnsafeMutableBufferPointer+SE-0370.swift +++ /dev/null @@ -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.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( - 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) -> 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( - fromContentsOf source: C - ) -> Index where Base == UnsafeMutableBufferPointer { - 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( - fromContentsOf source: UnsafeMutableBufferPointer - ) -> Index where Base == UnsafeMutableBufferPointer { - 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( - fromContentsOf source: Slice> - ) -> Index where Base == UnsafeMutableBufferPointer { - 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() -> UnsafeMutableRawBufferPointer - where Base == UnsafeMutableBufferPointer { - 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(at index: Int, to value: Element) - where Base == UnsafeMutableBufferPointer { - 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(repeating repeatedValue: Element) - where Base == UnsafeMutableBufferPointer { - 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.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( - 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) -> 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( - fromContentsOf source: C - ) -> Index where Base == UnsafeMutableBufferPointer { - 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( - fromContentsOf source: UnsafeMutableBufferPointer - ) -> Index where Base == UnsafeMutableBufferPointer { - 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( - fromContentsOf source: Slice> - ) -> Index where Base == UnsafeMutableBufferPointer { - 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() -> UnsafeMutableRawBufferPointer - where Base == UnsafeMutableBufferPointer { - 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(at index: Int, to value: Element) - where Base == UnsafeMutableBufferPointer { - 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(repeating repeatedValue: Element) - where Base == UnsafeMutableBufferPointer { - Base(rebasing: self).update(repeating: repeatedValue) - } -} -#endif -#endif // COLLECTIONS_SINGLE_MODULE diff --git a/Sources/InternalCollectionsUtilities/Compatibility/autogenerated/UnsafeMutablePointer+SE-0370.swift b/Sources/InternalCollectionsUtilities/Compatibility/autogenerated/UnsafeMutablePointer+SE-0370.swift deleted file mode 100644 index 2e89d5aa..00000000 --- a/Sources/InternalCollectionsUtilities/Compatibility/autogenerated/UnsafeMutablePointer+SE-0370.swift +++ /dev/null @@ -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 diff --git a/Sources/InternalCollectionsUtilities/Compatibility/autogenerated/UnsafeRawPointer extensions.swift b/Sources/InternalCollectionsUtilities/Compatibility/autogenerated/UnsafeRawPointer extensions.swift deleted file mode 100644 index c389967e..00000000 --- a/Sources/InternalCollectionsUtilities/Compatibility/autogenerated/UnsafeRawPointer extensions.swift +++ /dev/null @@ -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(for type: T.Type) -> Self { - let mask = UInt(MemoryLayout.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(for type: T.Type) -> Self { - let mask = UInt(MemoryLayout.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(for type: T.Type) -> Self { - let mask = UInt(MemoryLayout.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(for type: T.Type) -> Self { - let mask = UInt(MemoryLayout.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(for type: T.Type) -> Self { - let mask = UInt(MemoryLayout.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(for type: T.Type) -> Self { - let mask = UInt(MemoryLayout.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(for type: T.Type) -> Self { - let mask = UInt(MemoryLayout.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(for type: T.Type) -> Self { - let mask = UInt(MemoryLayout.alignment) &- 1 - let bits = UInt(bitPattern: self) & ~mask - return Self(bitPattern: bits)! - } -} -#endif -#endif // COLLECTIONS_SINGLE_MODULE diff --git a/Sources/InternalCollectionsUtilities/Specialize.swift.gyb b/Sources/InternalCollectionsUtilities/Specialize.swift.gyb deleted file mode 100644 index c654d78c..00000000 --- a/Sources/InternalCollectionsUtilities/Specialize.swift.gyb +++ /dev/null @@ -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(_ 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")} diff --git a/Sources/InternalCollectionsUtilities/UnsafeBitSet/_UnsafeBitSet.swift.gyb b/Sources/InternalCollectionsUtilities/UnsafeBitSet/_UnsafeBitSet.swift.gyb index a88c8457..108b3c62 100644 --- a/Sources/InternalCollectionsUtilities/UnsafeBitSet/_UnsafeBitSet.swift.gyb +++ b/Sources/InternalCollectionsUtilities/UnsafeBitSet/_UnsafeBitSet.swift.gyb @@ -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 } } diff --git a/Sources/InternalCollectionsUtilities/UnsafeBitSet/autogenerated/_UnsafeBitSet.swift b/Sources/InternalCollectionsUtilities/UnsafeBitSet/autogenerated/_UnsafeBitSet.swift index a18b3a54..6da0c4ef 100644 --- a/Sources/InternalCollectionsUtilities/UnsafeBitSet/autogenerated/_UnsafeBitSet.swift +++ b/Sources/InternalCollectionsUtilities/UnsafeBitSet/autogenerated/_UnsafeBitSet.swift @@ -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 } } diff --git a/Sources/InternalCollectionsUtilities/UnsafeMutableBufferPointer+Extras.swift.gyb b/Sources/InternalCollectionsUtilities/UnsafeMutableBufferPointer+Extras.swift.gyb index c7c6ee0f..4d7cdde7 100644 --- a/Sources/InternalCollectionsUtilities/UnsafeMutableBufferPointer+Extras.swift.gyb +++ b/Sources/InternalCollectionsUtilities/UnsafeMutableBufferPointer+Extras.swift.gyb @@ -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) -> Index { + ${modifier} func initialize(fromContentsOf source: Slice) -> 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( + ${modifier} func initialize( fromContentsOf source: UnsafeMutableBufferPointer ) -> Index where Base == UnsafeMutableBufferPointer @@ -56,7 +56,7 @@ extension Slice { } @inlinable @inline(__always) - public func initialize( + ${modifier} func initialize( fromContentsOf source: Slice> ) -> Index where Base == UnsafeMutableBufferPointer @@ -69,7 +69,7 @@ extension Slice { extension UnsafeMutableBufferPointer { @inlinable @inline(__always) - public func initializeAll( + ${modifier} func initializeAll( 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) { + ${modifier} func initializeAll(fromContentsOf source: Slice) { 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) { + ${modifier} func moveInitializeAll(fromContentsOf source: Slice) { let i = self.moveInitialize(fromContentsOf: source) assert(i == self.endIndex) } @@ -103,7 +103,7 @@ extension UnsafeMutableBufferPointer { extension Slice { @inlinable @inline(__always) - public func initializeAll( + ${modifier} func initializeAll( fromContentsOf source: C ) where Base == UnsafeMutableBufferPointer { let i = self.initialize(fromContentsOf: source) @@ -111,7 +111,7 @@ extension Slice { } @inlinable @inline(__always) - public func initializeAll( + ${modifier} func initializeAll( fromContentsOf source: UnsafeMutableBufferPointer ) where Base == UnsafeMutableBufferPointer { let target = UnsafeMutableBufferPointer(rebasing: self) @@ -119,7 +119,7 @@ extension Slice { } @inlinable @inline(__always) - public func initializeAll( + ${modifier} func initializeAll( fromContentsOf source: Slice> ) where Base == UnsafeMutableBufferPointer { let target = UnsafeMutableBufferPointer(rebasing: self) @@ -127,7 +127,7 @@ extension Slice { } @inlinable @inline(__always) - public func moveInitializeAll( + ${modifier} func moveInitializeAll( fromContentsOf source: UnsafeMutableBufferPointer ) where Base == UnsafeMutableBufferPointer { let target = UnsafeMutableBufferPointer(rebasing: self) @@ -135,7 +135,7 @@ extension Slice { } @inlinable @inline(__always) - public func moveInitializeAll( + ${modifier} func moveInitializeAll( fromContentsOf source: Slice> ) where Base == UnsafeMutableBufferPointer { let target = UnsafeMutableBufferPointer(rebasing: self) diff --git a/Sources/InternalCollectionsUtilities/autogenerated/Specialize.swift b/Sources/InternalCollectionsUtilities/autogenerated/Specialize.swift deleted file mode 100644 index 07087af2..00000000 --- a/Sources/InternalCollectionsUtilities/autogenerated/Specialize.swift +++ /dev/null @@ -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(_ 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(_ 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 diff --git a/Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift b/Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift index 2661d8ca..be578b23 100644 --- a/Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift +++ b/Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift @@ -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) -> Index { + internal func initialize(fromContentsOf source: Slice) -> 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( + internal func initialize( fromContentsOf source: UnsafeMutableBufferPointer ) -> Index where Base == UnsafeMutableBufferPointer @@ -62,7 +62,7 @@ extension Slice { } @inlinable @inline(__always) - public func initialize( + internal func initialize( fromContentsOf source: Slice> ) -> Index where Base == UnsafeMutableBufferPointer @@ -75,7 +75,7 @@ extension Slice { extension UnsafeMutableBufferPointer { @inlinable @inline(__always) - public func initializeAll( + internal func initializeAll( 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) { + internal func initializeAll(fromContentsOf source: Slice) { 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) { + internal func moveInitializeAll(fromContentsOf source: Slice) { let i = self.moveInitialize(fromContentsOf: source) assert(i == self.endIndex) } @@ -109,7 +109,7 @@ extension UnsafeMutableBufferPointer { extension Slice { @inlinable @inline(__always) - public func initializeAll( + internal func initializeAll( fromContentsOf source: C ) where Base == UnsafeMutableBufferPointer { let i = self.initialize(fromContentsOf: source) @@ -117,7 +117,7 @@ extension Slice { } @inlinable @inline(__always) - public func initializeAll( + internal func initializeAll( fromContentsOf source: UnsafeMutableBufferPointer ) where Base == UnsafeMutableBufferPointer { let target = UnsafeMutableBufferPointer(rebasing: self) @@ -125,7 +125,7 @@ extension Slice { } @inlinable @inline(__always) - public func initializeAll( + internal func initializeAll( fromContentsOf source: Slice> ) where Base == UnsafeMutableBufferPointer { let target = UnsafeMutableBufferPointer(rebasing: self) @@ -133,7 +133,7 @@ extension Slice { } @inlinable @inline(__always) - public func moveInitializeAll( + internal func moveInitializeAll( fromContentsOf source: UnsafeMutableBufferPointer ) where Base == UnsafeMutableBufferPointer { let target = UnsafeMutableBufferPointer(rebasing: self) @@ -141,7 +141,7 @@ extension Slice { } @inlinable @inline(__always) - public func moveInitializeAll( + internal func moveInitializeAll( fromContentsOf source: Slice> ) where Base == UnsafeMutableBufferPointer { let target = UnsafeMutableBufferPointer(rebasing: self) diff --git a/Sources/RopeModule/BigString/Basics/BigString+Builder.swift b/Sources/RopeModule/BigString/Basics/BigString+Builder.swift index 730e39e2..d5b4f089 100644 --- a/Sources/RopeModule/BigString/Basics/BigString+Builder.swift +++ b/Sources/RopeModule/BigString/Basics/BigString+Builder.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Basics/BigString+Contents.swift b/Sources/RopeModule/BigString/Basics/BigString+Contents.swift index af1141aa..ee9ae542 100644 --- a/Sources/RopeModule/BigString/Basics/BigString+Contents.swift +++ b/Sources/RopeModule/BigString/Basics/BigString+Contents.swift @@ -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[..=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 diff --git a/Sources/RopeModule/BigString/Basics/BigString+Index.swift b/Sources/RopeModule/BigString/Basics/BigString+Index.swift index d8608177..dd922ed7 100644 --- a/Sources/RopeModule/BigString/Basics/BigString+Index.swift +++ b/Sources/RopeModule/BigString/Basics/BigString+Index.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Basics/BigString+Ingester.swift b/Sources/RopeModule/BigString/Basics/BigString+Ingester.swift index 95b962a6..1ef926aa 100644 --- a/Sources/RopeModule/BigString/Basics/BigString+Ingester.swift +++ b/Sources/RopeModule/BigString/Basics/BigString+Ingester.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Basics/BigString+Invariants.swift b/Sources/RopeModule/BigString/Basics/BigString+Invariants.swift index 0cb99ec8..b455b978 100644 --- a/Sources/RopeModule/BigString/Basics/BigString+Invariants.swift +++ b/Sources/RopeModule/BigString/Basics/BigString+Invariants.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Basics/BigString+Iterators.swift b/Sources/RopeModule/BigString/Basics/BigString+Iterators.swift index 0b799558..94484e72 100644 --- a/Sources/RopeModule/BigString/Basics/BigString+Iterators.swift +++ b/Sources/RopeModule/BigString/Basics/BigString+Iterators.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Basics/BigString+Metrics.swift b/Sources/RopeModule/BigString/Basics/BigString+Metrics.swift index eb335b40..502eb2e9 100644 --- a/Sources/RopeModule/BigString/Basics/BigString+Metrics.swift +++ b/Sources/RopeModule/BigString/Basics/BigString+Metrics.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Basics/BigString+Summary.swift b/Sources/RopeModule/BigString/Basics/BigString+Summary.swift index f11bb18f..aeac6206 100644 --- a/Sources/RopeModule/BigString/Basics/BigString+Summary.swift +++ b/Sources/RopeModule/BigString/Basics/BigString+Summary.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Basics/BigString.swift b/Sources/RopeModule/BigString/Basics/BigString.swift index fe782f27..220c7631 100644 --- a/Sources/RopeModule/BigString/Basics/BigString.swift +++ b/Sources/RopeModule/BigString/Basics/BigString.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Append and Insert.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Append and Insert.swift index 20da42a8..f72dd07a 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Append and Insert.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Append and Insert.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Breaks.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Breaks.swift index ba4c3261..bf66b206 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Breaks.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Breaks.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Counts.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Counts.swift index 5b3a30ea..f0354d9b 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Counts.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Counts.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Description.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Description.swift index c44a3766..d22dff93 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Description.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Description.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Indexing by Characters.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Indexing by Characters.swift index 5e6f54bb..ff71ce60 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Indexing by Characters.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Indexing by Characters.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Indexing by UTF16.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Indexing by UTF16.swift index cc60346f..916a89d0 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Indexing by UTF16.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Indexing by UTF16.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+RopeElement.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+RopeElement.swift index 37bb4ad5..668c127e 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+RopeElement.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+RopeElement.swift @@ -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[..=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 diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk.swift index ad240eda..13395119 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Conformances/BigString+BidirectionalCollection.swift b/Sources/RopeModule/BigString/Conformances/BigString+BidirectionalCollection.swift index 5ae9f221..4dd092c1 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+BidirectionalCollection.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+BidirectionalCollection.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Conformances/BigString+Comparable.swift b/Sources/RopeModule/BigString/Conformances/BigString+Comparable.swift index a649cddf..07ec6d1c 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+Comparable.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+Comparable.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Conformances/BigString+CustomDebugStringConvertible.swift b/Sources/RopeModule/BigString/Conformances/BigString+CustomDebugStringConvertible.swift index 4925c4a4..5ea0d203 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+CustomDebugStringConvertible.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+CustomDebugStringConvertible.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Conformances/BigString+CustomStringConvertible.swift b/Sources/RopeModule/BigString/Conformances/BigString+CustomStringConvertible.swift index bc4ef036..5fd0007f 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+CustomStringConvertible.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+CustomStringConvertible.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Conformances/BigString+Equatable.swift b/Sources/RopeModule/BigString/Conformances/BigString+Equatable.swift index 49edaf57..95f47fd0 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+Equatable.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+Equatable.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Conformances/BigString+ExpressibleByStringLiteral.swift b/Sources/RopeModule/BigString/Conformances/BigString+ExpressibleByStringLiteral.swift index 0c434eaf..8ee2e95c 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+ExpressibleByStringLiteral.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+ExpressibleByStringLiteral.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Conformances/BigString+Hashing.swift b/Sources/RopeModule/BigString/Conformances/BigString+Hashing.swift index e9403717..baacc382 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+Hashing.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+Hashing.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Conformances/BigString+LosslessStringConvertible.swift b/Sources/RopeModule/BigString/Conformances/BigString+LosslessStringConvertible.swift index 2dba1158..0133be29 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+LosslessStringConvertible.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+LosslessStringConvertible.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Conformances/BigString+RangeReplaceableCollection.swift b/Sources/RopeModule/BigString/Conformances/BigString+RangeReplaceableCollection.swift index 11ae4e4c..653cb6a0 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+RangeReplaceableCollection.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+RangeReplaceableCollection.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Conformances/BigString+Sequence.swift b/Sources/RopeModule/BigString/Conformances/BigString+Sequence.swift index 722ceead..8aa334e4 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+Sequence.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+Sequence.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Conformances/BigString+TextOutputStream.swift b/Sources/RopeModule/BigString/Conformances/BigString+TextOutputStream.swift index 54bd673b..33c847f3 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+TextOutputStream.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+TextOutputStream.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Operations/BigString+Append.swift b/Sources/RopeModule/BigString/Operations/BigString+Append.swift index 6176dfc0..2e57db96 100644 --- a/Sources/RopeModule/BigString/Operations/BigString+Append.swift +++ b/Sources/RopeModule/BigString/Operations/BigString+Append.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Operations/BigString+Initializers.swift b/Sources/RopeModule/BigString/Operations/BigString+Initializers.swift index 1cb9be46..41477c41 100644 --- a/Sources/RopeModule/BigString/Operations/BigString+Initializers.swift +++ b/Sources/RopeModule/BigString/Operations/BigString+Initializers.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Operations/BigString+Insert.swift b/Sources/RopeModule/BigString/Operations/BigString+Insert.swift index a0bf26ed..14911c9d 100644 --- a/Sources/RopeModule/BigString/Operations/BigString+Insert.swift +++ b/Sources/RopeModule/BigString/Operations/BigString+Insert.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Operations/BigString+Managing Breaks.swift b/Sources/RopeModule/BigString/Operations/BigString+Managing Breaks.swift index 1b225626..9ad24dd3 100644 --- a/Sources/RopeModule/BigString/Operations/BigString+Managing Breaks.swift +++ b/Sources/RopeModule/BigString/Operations/BigString+Managing Breaks.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Operations/BigString+RemoveSubrange.swift b/Sources/RopeModule/BigString/Operations/BigString+RemoveSubrange.swift index bf78f31a..68936c2f 100644 --- a/Sources/RopeModule/BigString/Operations/BigString+RemoveSubrange.swift +++ b/Sources/RopeModule/BigString/Operations/BigString+RemoveSubrange.swift @@ -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) { @@ -44,5 +42,3 @@ extension BigString { return scalar } } - -#endif diff --git a/Sources/RopeModule/BigString/Operations/BigString+ReplaceSubrange.swift b/Sources/RopeModule/BigString/Operations/BigString+ReplaceSubrange.swift index 40d16ae1..3e14bf43 100644 --- a/Sources/RopeModule/BigString/Operations/BigString+ReplaceSubrange.swift +++ b/Sources/RopeModule/BigString/Operations/BigString+ReplaceSubrange.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Operations/BigString+Split.swift b/Sources/RopeModule/BigString/Operations/BigString+Split.swift index 9869e6b4..a8bad19c 100644 --- a/Sources/RopeModule/BigString/Operations/BigString+Split.swift +++ b/Sources/RopeModule/BigString/Operations/BigString+Split.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Operations/Range+BigString.swift b/Sources/RopeModule/BigString/Operations/Range+BigString.swift index f800ff97..e784f2f2 100644 --- a/Sources/RopeModule/BigString/Operations/Range+BigString.swift +++ b/Sources/RopeModule/BigString/Operations/Range+BigString.swift @@ -9,13 +9,9 @@ // //===----------------------------------------------------------------------===// -#if swift(>=5.8) - @available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *) extension Range { internal var _isEmptyUTF8: Bool { lowerBound.utf8Offset == upperBound.utf8Offset } } - -#endif diff --git a/Sources/RopeModule/BigString/Views/BigString+UTF16View.swift b/Sources/RopeModule/BigString/Views/BigString+UTF16View.swift index db1d8742..da9d9823 100644 --- a/Sources/RopeModule/BigString/Views/BigString+UTF16View.swift +++ b/Sources/RopeModule/BigString/Views/BigString+UTF16View.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Views/BigString+UTF8View.swift b/Sources/RopeModule/BigString/Views/BigString+UTF8View.swift index dc122058..d751b3e4 100644 --- a/Sources/RopeModule/BigString/Views/BigString+UTF8View.swift +++ b/Sources/RopeModule/BigString/Views/BigString+UTF8View.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Views/BigString+UnicodeScalarView.swift b/Sources/RopeModule/BigString/Views/BigString+UnicodeScalarView.swift index a68bebec..17d382a2 100644 --- a/Sources/RopeModule/BigString/Views/BigString+UnicodeScalarView.swift +++ b/Sources/RopeModule/BigString/Views/BigString+UnicodeScalarView.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Views/BigSubstring+UTF16View.swift b/Sources/RopeModule/BigString/Views/BigSubstring+UTF16View.swift index 7e58fed1..c1af2c46 100644 --- a/Sources/RopeModule/BigString/Views/BigSubstring+UTF16View.swift +++ b/Sources/RopeModule/BigString/Views/BigSubstring+UTF16View.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Views/BigSubstring+UTF8View.swift b/Sources/RopeModule/BigString/Views/BigSubstring+UTF8View.swift index 1c6223bd..c2bb610c 100644 --- a/Sources/RopeModule/BigString/Views/BigSubstring+UTF8View.swift +++ b/Sources/RopeModule/BigString/Views/BigSubstring+UTF8View.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Views/BigSubstring+UnicodeScalarView.swift b/Sources/RopeModule/BigString/Views/BigSubstring+UnicodeScalarView.swift index e7da61ca..49ab2656 100644 --- a/Sources/RopeModule/BigString/Views/BigSubstring+UnicodeScalarView.swift +++ b/Sources/RopeModule/BigString/Views/BigSubstring+UnicodeScalarView.swift @@ -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 diff --git a/Sources/RopeModule/BigString/Views/BigSubstring.swift b/Sources/RopeModule/BigString/Views/BigSubstring.swift index 427b5e55..ee9a40c1 100644 --- a/Sources/RopeModule/BigString/Views/BigSubstring.swift +++ b/Sources/RopeModule/BigString/Views/BigSubstring.swift @@ -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 diff --git a/Sources/RopeModule/Rope/Basics/Rope+_Node.swift b/Sources/RopeModule/Rope/Basics/Rope+_Node.swift index 87525063..d60b9c02 100644 --- a/Sources/RopeModule/Rope/Basics/Rope+_Node.swift +++ b/Sources/RopeModule/Rope/Basics/Rope+_Node.swift @@ -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 diff --git a/Sources/RopeModule/Utilities/String Utilities.swift b/Sources/RopeModule/Utilities/String Utilities.swift index a571016d..8e6ddd7f 100644 --- a/Sources/RopeModule/Utilities/String Utilities.swift +++ b/Sources/RopeModule/Utilities/String Utilities.swift @@ -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 diff --git a/Sources/RopeModule/Utilities/_CharacterRecognizer.swift b/Sources/RopeModule/Utilities/_CharacterRecognizer.swift index 12b34d53..5be57bcb 100644 --- a/Sources/RopeModule/Utilities/_CharacterRecognizer.swift +++ b/Sources/RopeModule/Utilities/_CharacterRecognizer.swift @@ -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 diff --git a/Tests/HashTreeCollectionsTests/TreeHashedCollections Fixtures.swift b/Tests/HashTreeCollectionsTests/TreeHashedCollections Fixtures.swift index f2ee7b2b..c61dc868 100644 --- a/Tests/HashTreeCollectionsTests/TreeHashedCollections Fixtures.swift +++ b/Tests/HashTreeCollectionsTests/TreeHashedCollections Fixtures.swift @@ -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.size == 8, "Unknown platform") reject = .small +#else +#error("Unexpected pointer bit width") #endif return self != reject } diff --git a/Tests/RopeModuleTests/Availability.swift b/Tests/RopeModuleTests/Availability.swift index 66234e4a..8105c96e 100644 --- a/Tests/RopeModuleTests/Availability.swift +++ b/Tests/RopeModuleTests/Availability.swift @@ -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 diff --git a/Tests/RopeModuleTests/TestBigString.swift b/Tests/RopeModuleTests/TestBigString.swift index fa4cf605..df19a26a 100644 --- a/Tests/RopeModuleTests/TestBigString.swift +++ b/Tests/RopeModuleTests/TestBigString.swift @@ -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 diff --git a/Xcode/Collections.xcodeproj/project.pbxproj b/Xcode/Collections.xcodeproj/project.pbxproj index 2be6b556..4573a53b 100644 --- a/Xcode/Collections.xcodeproj/project.pbxproj +++ b/Xcode/Collections.xcodeproj/project.pbxproj @@ -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 = ""; }; 7D9B859529E4F74400B291CD /* BitArray+ExpressibleByStringLiteral.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "BitArray+ExpressibleByStringLiteral.swift"; sourceTree = ""; }; 7D9B859C29E4F77D00B291CD /* Collections.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = Collections.xctestplan; sourceTree = ""; }; - 7DB0AE712B6E067A00602A20 /* Specialize.swift.gyb */ = {isa = PBXFileReference; lastKnownFileType = text; path = Specialize.swift.gyb; sourceTree = ""; }; - 7DB0AE752B6E06B300602A20 /* Specialize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Specialize.swift; sourceTree = ""; }; 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 = ""; }; @@ -813,12 +803,6 @@ 7DE921F729CA8576004483EB /* RangeReplaceableCollectionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RangeReplaceableCollectionTests.swift; sourceTree = ""; }; 7DE921F829CA8576004483EB /* DequeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DequeTests.swift; sourceTree = ""; }; 7DE921F929CA8576004483EB /* MutableCollectionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutableCollectionTests.swift; sourceTree = ""; }; - 7DEBDAC829CBEE5200ADC226 /* UnsafeMutablePointer+SE-0370.swift.gyb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "UnsafeMutablePointer+SE-0370.swift.gyb"; sourceTree = ""; }; - 7DEBDAC929CBEE5200ADC226 /* UnsafeMutableBufferPointer+SE-0370.swift.gyb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "UnsafeMutableBufferPointer+SE-0370.swift.gyb"; sourceTree = ""; }; - 7DEBDACB29CBEE5200ADC226 /* UnsafeRawPointer extensions.swift.gyb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "UnsafeRawPointer extensions.swift.gyb"; sourceTree = ""; }; - 7DEBDACD29CBEE5200ADC226 /* UnsafeMutableBufferPointer+SE-0370.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UnsafeMutableBufferPointer+SE-0370.swift"; sourceTree = ""; }; - 7DEBDACF29CBEE5200ADC226 /* UnsafeMutablePointer+SE-0370.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UnsafeMutablePointer+SE-0370.swift"; sourceTree = ""; }; - 7DEBDAD029CBEE5200ADC226 /* UnsafeRawPointer extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UnsafeRawPointer extensions.swift"; sourceTree = ""; }; 7DEBDAD129CBEE5200ADC226 /* Descriptions.swift.gyb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Descriptions.swift.gyb; sourceTree = ""; }; 7DEBDAD229CBEE5200ADC226 /* RandomAccessCollection+Offsets.swift.gyb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "RandomAccessCollection+Offsets.swift.gyb"; sourceTree = ""; }; 7DEBDAD429CBEE5300ADC226 /* UnsafeMutableBufferPointer+Extras.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UnsafeMutableBufferPointer+Extras.swift"; sourceTree = ""; }; @@ -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 = ""; }; - 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 = ""; - }; - 7DEBDACC29CBEE5200ADC226 /* autogenerated */ = { - isa = PBXGroup; - children = ( - 7DEBDACD29CBEE5200ADC226 /* UnsafeMutableBufferPointer+SE-0370.swift */, - 7DEBDACF29CBEE5200ADC226 /* UnsafeMutablePointer+SE-0370.swift */, - 7DEBDAD029CBEE5200ADC226 /* UnsafeRawPointer extensions.swift */, - ); - path = autogenerated; - sourceTree = ""; - }; 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 */, diff --git a/Xcode/Collections.xcodeproj/xcshareddata/xcschemes/Collections.xcscheme b/Xcode/Collections.xcodeproj/xcshareddata/xcschemes/Collections.xcscheme index 3266c5aa..88230e52 100644 --- a/Xcode/Collections.xcodeproj/xcshareddata/xcschemes/Collections.xcscheme +++ b/Xcode/Collections.xcodeproj/xcshareddata/xcschemes/Collections.xcscheme @@ -1,6 +1,6 @@