From 537bf9cbfbe861df40ebcb08f0896486c3eb5b16 Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Mon, 21 Sep 2026 13:32:17 -0700 Subject: [PATCH] Drop support for Swift 6.0 and 6.1 This allows the use of Span types without `#if compiler` guards. --- Package@swift-6.0.swift | 339 ------------------ .../HashTable/_HTable+Bitmap.swift | 4 +- .../HashTable/_HTable+Bucket.swift | 11 +- .../HashTable/_HTable+Consumption.swift | 4 - .../HashTable/_HTable+Debug.swift | 12 +- .../HashTable/_HTable+Deprecated.swift | 4 - .../HashTable/_HTable+Find.swift | 2 - .../HashTable/_HTable+Insert.swift | 8 +- .../HashTable/_HTable+Iteration.swift | 14 +- .../HashTable/_HTable+Removal.swift | 6 +- .../HashTable/_HTable+Resizing.swift | 10 +- .../HashTable/_HTable+Sizing.swift | 24 +- .../BasicContainers/HashTable/_HTable.swift | 22 +- .../RigidArray/RigidArray+Append.swift | 5 +- .../RigidArray/RigidArray+Consumption.swift | 16 +- .../RigidArray+ContainerOperations.swift | 4 - .../RigidArray/RigidArray+Deprecated.swift | 10 +- .../RigidArray/RigidArray+Descriptions.swift | 5 - .../RigidArray/RigidArray+Equatable.swift | 4 - .../RigidArray/RigidArray+Experimental.swift | 2 +- .../RigidArray/RigidArray+Hashable.swift | 4 - .../RigidArray/RigidArray+Initializers.swift | 14 +- .../RigidArray/RigidArray+Insertions.swift | 4 - .../RigidArray/RigidArray+Iterable.swift | 4 - .../RigidArray/RigidArray+Removals.swift | 4 - .../RigidArray/RigidArray+Replacements.swift | 6 +- .../UniqueArray/UniqueArray+Append.swift | 8 +- .../UniqueArray/UniqueArray+Consumption.swift | 4 - .../UniqueArray+ContainerOperations.swift | 4 - .../UniqueArray/UniqueArray+Deprecated.swift | 8 +- .../UniqueArray+Descriptions.swift | 4 - .../UniqueArray/UniqueArray+Equatable.swift | 4 - .../UniqueArray+Experimental.swift | 2 +- .../UniqueArray/UniqueArray+Hashable.swift | 4 - .../UniqueArray+Initializers.swift | 8 +- .../UniqueArray/UniqueArray+Insertions.swift | 4 - .../UniqueArray/UniqueArray+Removals.swift | 4 - .../UniqueArray+Replacements.swift | 5 +- .../Conformances/InputSpan+Container.swift | 2 +- .../Conformances/MutableSpan+Container.swift | 4 +- .../Conformances/Span+Container.swift | 2 - Sources/ContainersPreview/Types/Shared.swift | 3 - .../RigidDeque/RigidDeque+Append.swift | 22 +- .../RigidDeque/RigidDeque+Consumption.swift | 12 +- .../RigidDeque+ContainerOperations.swift | 4 - .../RigidDeque/RigidDeque+Deprecations.swift | 4 - .../RigidDeque/RigidDeque+Descriptions.swift | 4 - .../RigidDeque/RigidDeque+Equatable.swift | 4 - .../RigidDeque/RigidDeque+Hashable.swift | 4 - .../RigidDeque/RigidDeque+Initializers.swift | 8 +- .../RigidDeque/RigidDeque+Insertions.swift | 4 - .../RigidDeque/RigidDeque+Prepend.swift | 19 +- .../RigidDeque/RigidDeque+Removals.swift | 10 +- .../RigidDeque/RigidDeque+Replacements.swift | 8 +- .../RigidDeque/RigidDeque+Testing.swift | 6 +- .../UniqueDeque/UniqueDeque+Append.swift | 10 +- .../UniqueDeque/UniqueDeque+Consumption.swift | 8 +- .../UniqueDeque+ContainerOperations.swift | 4 - .../UniqueDeque+Deprecations.swift | 4 - .../UniqueDeque+Descriptions.swift | 4 - .../UniqueDeque/UniqueDeque+Equatable.swift | 4 - .../UniqueDeque/UniqueDeque+Hashable.swift | 4 - .../UniqueDeque+Initializers.swift | 6 +- .../UniqueDeque/UniqueDeque+Insertions.swift | 4 - .../UniqueDeque/UniqueDeque+Prepend.swift | 17 +- .../UniqueDeque/UniqueDeque+Removals.swift | 16 +- .../UniqueDeque+Replacements.swift | 8 +- Sources/DequeModule/_UnsafeDequeHandle.swift | 48 ++- .../LifetimeOverride.swift | 3 - .../MutableSpan+Extras.swift | 4 - .../OutputSpan+Extras.swift | 5 - .../Span+Extras.swift | 4 - .../TemporaryAllocation.swift | 4 - .../UnsafeMutableBufferPointer+Extras.swift | 4 - .../BigString/Basics/BigString+Builder.swift | 4 +- .../BigString/Basics/BigString+Contents.swift | 4 +- .../Basics/BigString+Debugging.swift | 4 +- .../BigString/Basics/BigString+Index.swift | 4 +- .../BigString/Basics/BigString+Ingester.swift | 4 +- .../Basics/BigString+Invariants.swift | 4 +- .../BigString/Basics/BigString+Metrics.swift | 4 +- .../BigString/Basics/BigString+Summary.swift | 4 +- .../BigString/Basics/BigString.swift | 4 +- .../BigString+Chunk+Append and Insert.swift | 4 +- .../Chunk/BigString+Chunk+Breaks.swift | 4 +- .../Chunk/BigString+Chunk+Character.swift | 4 +- .../Chunk/BigString+Chunk+Counts.swift | 4 +- .../Chunk/BigString+Chunk+Description.swift | 4 +- .../Chunk/BigString+Chunk+Index.swift | 4 +- .../Chunk/BigString+Chunk+RopeElement.swift | 4 +- .../Chunk/BigString+Chunk+Splitting.swift | 4 +- .../Chunk/BigString+Chunk+UTF16.swift | 4 +- .../Chunk/BigString+Chunk+UTF8.swift | 4 +- .../Chunk/BigString+Chunk+UnicodeScalar.swift | 4 +- .../BigString/Chunk/BigString+Chunk.swift | 4 +- .../BigString+BidirectionalCollection.swift | 4 +- .../Conformances/BigString+Comparable.swift | 4 +- ...gString+CustomDebugStringConvertible.swift | 4 +- .../BigString+CustomStringConvertible.swift | 4 +- .../Conformances/BigString+Equatable.swift | 4 +- ...BigString+ExpressibleByStringLiteral.swift | 4 +- .../Conformances/BigString+Hashing.swift | 4 +- .../BigString+LosslessStringConvertible.swift | 4 +- ...BigString+RangeReplaceableCollection.swift | 4 +- .../Conformances/BigString+Sequence.swift | 4 +- .../BigString+TextOutputStream.swift | 4 +- .../Operations/BigString+Append.swift | 4 +- .../Operations/BigString+Initializers.swift | 4 +- .../Operations/BigString+Insert.swift | 4 +- .../BigString+Managing Breaks.swift | 4 +- .../Operations/BigString+RemoveSubrange.swift | 4 +- .../BigString+ReplaceSubrange.swift | 4 +- .../Operations/BigString+Split.swift | 4 +- .../Operations/Range+BigString.swift | 4 +- .../BigString/Views/BigString+UTF16View.swift | 4 +- .../BigString/Views/BigString+UTF8View.swift | 4 +- .../Views/BigString+UnicodeScalarView.swift | 4 +- .../Views/BigSubstring+UTF16View.swift | 4 +- .../Views/BigSubstring+UTF8View.swift | 4 +- .../BigSubstring+UnicodeScalarView.swift | 4 +- .../BigString/Views/BigSubstring.swift | 4 +- .../Utilities/String Utilities.swift | 4 +- .../Utilities/_CharacterRecognizer.swift | 4 +- Sources/SpanPreview/InputSpan.swift | 2 +- .../OutputSpan+InputSpanHelpers.swift | 2 +- .../TrailingArray.swift | 80 ++--- .../TrailingElements.swift | 6 +- .../TrailingPadding.swift | 30 +- Tests/BasicContainersTests/ArrayLayout.swift | 10 +- .../RigidArrayTests.swift | 3 - .../UniqueArrayTests.swift | 3 - Tests/ContainersTests/UniqueBoxTests.swift | 3 - Tests/DequeTests/DequeInternals.swift | 18 +- Tests/DequeTests/RigidDequeCrashTests.swift | 16 +- Tests/DequeTests/RigidDequeTests.swift | 2 - Tests/DequeTests/UniqueDequeTests.swift | 21 +- Tests/RopeModuleTests/TestBigString.swift | 3 - Tests/SpanPreviewTests/InputSpanTests.swift | 4 +- .../TrailingElementsTests.swift | 44 ++- .../Assertions+Containers.swift | 2 - .../AssertionContexts/Assertions.swift | 52 --- .../Utilities/LifetimeTracked.swift | 2 - .../Utilities/LifetimeTrackedStruct.swift | 2 - .../Utilities/LifetimeTracker.swift | 2 - .../Utilities/TestPrintable.swift | 4 - 145 files changed, 342 insertions(+), 1047 deletions(-) delete mode 100644 Package@swift-6.0.swift diff --git a/Package@swift-6.0.swift b/Package@swift-6.0.swift deleted file mode 100644 index 6b13d20a..00000000 --- a/Package@swift-6.0.swift +++ /dev/null @@ -1,339 +0,0 @@ -// swift-tools-version:6.0 -//===----------------------------------------------------------------------===// -// -// This source file is part of the Swift Collections open source project -// -// Copyright (c) 2021 - 2026 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// -// SPDX-License-Identifier: Apache-2.0 WITH Swift-exception -// -//===----------------------------------------------------------------------===// - -import PackageDescription - -// This package recognizes the conditional compilation flags listed below. -// To use enable them, uncomment the corresponding lines or define them -// from the package manager command line: -// -// swift build -Xswiftc -DCOLLECTIONS_INTERNAL_CHECKS -var defines: [String] = [ - - // Enables internal consistency checks at the end of initializers and - // mutating operations. This can have very significant overhead, so enabling - // this setting invalidates all documented performance guarantees. - // - // This is mostly useful while debugging an issue with the implementation of - // the hash table itself. This setting should never be enabled in production - // code. -// "COLLECTIONS_INTERNAL_CHECKS", - - // Hashing collections provided by this package usually seed their hash - // function with the address of the memory location of their storage, - // to prevent some common hash table merge/copy operations from regressing to - // quadratic behavior. This setting turns off this mechanism, seeding - // the hash function with the table's size instead. - // - // When used in conjunction with the SWIFT_DETERMINISTIC_HASHING environment - // variable, this enables reproducible hashing behavior. - // - // This is mostly useful while debugging an issue with the implementation of - // the hash table itself. This setting should never be enabled in production - // code. -// "COLLECTIONS_DETERMINISTIC_HASHING", - - // Enables randomized testing of some data structure implementations. - "COLLECTIONS_RANDOMIZED_TESTING", - - // Enable this to build the sources as a single, large module. - // This removes the distinct modules for each data structure, instead - // putting them all directly into the `Collections` module. - // Note: This is a source-incompatible variation of the default configuration. -// "COLLECTIONS_SINGLE_MODULE", - - // Enables longer, more exhaustive tests. -// "COLLECTIONS_LONG_TESTS", -] - -let availabilityMacros: KeyValuePairs = [ - "SwiftStdlib 5.0": "macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2", - "SwiftStdlib 5.1": "macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0", - "SwiftStdlib 5.6": "macOS 12.3, iOS 15.4, watchOS 8.5, tvOS 15.4", - "SwiftStdlib 5.8": "macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4", - "SwiftStdlib 5.9": "macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0", - "SwiftStdlib 5.10": "macOS 14.4, iOS 17.4, watchOS 10.4, tvOS 17.4, visionOS 1.1", - "SwiftStdlib 6.0": "macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0", - "SwiftStdlib 6.1": "macOS 15.4, iOS 18.4, watchOS 11.4, tvOS 18.4, visionOS 2.4", - "SwiftStdlib 6.2": "macOS 26.0, iOS 26.0, watchOS 26.0, tvOS 26.0, visionOS 26.0", - "SwiftStdlib 6.3": "macOS 26.4, iOS 26.4, watchOS 26.4, tvOS 26.4, visionOS 26.4", - "SwiftStdlib 6.4": "macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0", - "SwiftStdlib 6.5": "macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999", - // Note: if you touch these, please make sure to also update the similar lists in - // CMakeLists.txt and Xcode/Shared.xcconfig. -] - -let extraSettings: [SwiftSetting] = [ - .enableUpcomingFeature("MemberImportVisibility"), - .enableExperimentalFeature("BuiltinModule"), -] - -let _baseSettings: [SwiftSetting] = ( - defines.map { .define($0) } - + availabilityMacros.map { name, value in - .enableExperimentalFeature("AvailabilityMacro=\(name): \(value)") - } -) - -let _sharedSettings: [SwiftSetting] = _baseSettings + extraSettings -let _settings: [SwiftSetting] = _sharedSettings + [] -let _testSettings: [SwiftSetting] = _sharedSettings + [] - -struct CustomTarget { - enum Kind { - case exported - case hidden - case test - case testSupport - } - - var kind: Kind - var name: String - var dependencies: [Target.Dependency] - var directory: String - var exclude: [String] - var sources: [String]? - var settings: [SwiftSetting] -} - -extension CustomTarget.Kind { - func path(for name: String) -> String { - switch self { - case .exported, .hidden: return "Sources/\(name)" - case .test, .testSupport: return "Tests/\(name)" - } - } - - var isTest: Bool { - switch self { - case .exported, .hidden: return false - case .test, .testSupport: return true - } - } -} - -extension CustomTarget { - static func target( - kind: Kind, - name: String, - dependencies: [Target.Dependency] = [], - directory: String? = nil, - exclude: [String] = [], - sources: [String]? = nil, - settings: [SwiftSetting]? = nil - ) -> CustomTarget { - CustomTarget( - kind: kind, - name: name, - dependencies: dependencies, - directory: directory ?? name, - exclude: exclude, - sources: sources, - settings: settings ?? (kind.isTest ? _testSettings : _settings)) - } - - func toTarget() -> Target { - var linkerSettings: [LinkerSetting] = [] - if kind == .testSupport { - linkerSettings.append( - .linkedFramework("XCTest", .when(platforms: [.macOS, .iOS, .watchOS, .tvOS]))) - } - switch kind { - case .exported, .hidden, .testSupport: - return Target.target( - name: name, - dependencies: dependencies, - path: kind.path(for: directory), - exclude: exclude, - sources: sources, - swiftSettings: settings, - linkerSettings: linkerSettings) - case .test: - return Target.testTarget( - name: name, - dependencies: dependencies, - path: kind.path(for: directory), - exclude: exclude, - swiftSettings: settings, - linkerSettings: linkerSettings) - } - } -} - -let targets: [CustomTarget] = [ - .target( - kind: .testSupport, - name: "_CollectionsTestSupport", - dependencies: [ - "InternalCollectionsUtilities", - "ContainersPreview", - "BasicContainers", - "SpanPreview", - ]), - .target( - kind: .test, - name: "CollectionsTestSupportTests", - dependencies: ["_CollectionsTestSupport"]), - .target( - kind: .hidden, - name: "InternalCollectionsUtilities", - exclude: [ - "CMakeLists.txt", - ]), - - .target( - kind: .exported, - name: "BasicContainers", - dependencies: ["InternalCollectionsUtilities", "SpanPreview"], - exclude: ["CMakeLists.txt"] - ), - .target( - kind: .test, - name: "BasicContainersTests", - dependencies: [ - "BasicContainers", "_CollectionsTestSupport" - ]), - - .target( - kind: .exported, - name: "BitCollections", - dependencies: ["InternalCollectionsUtilities"], - exclude: ["CMakeLists.txt"]), - .target( - kind: .test, - name: "BitCollectionsTests", - dependencies: [ - "BitCollections", "_CollectionsTestSupport", "OrderedCollections" - ]), - - .target( - kind: .exported, - name: "ContainersPreview", - dependencies: [ - "InternalCollectionsUtilities", - "BasicContainers", - "DequeModule", - "SpanPreview", - ], - exclude: ["CMakeLists.txt"]), - .target( - kind: .test, - name: "ContainersTests", - dependencies: [ - "ContainersPreview", "_CollectionsTestSupport" - ]), - - .target( - kind: .exported, - name: "DequeModule", - dependencies: ["InternalCollectionsUtilities", "SpanPreview"], - exclude: ["CMakeLists.txt"]), - .target( - kind: .test, - name: "DequeTests", - dependencies: ["DequeModule", "_CollectionsTestSupport"]), - - .target( - kind: .exported, - name: "HashTreeCollections", - dependencies: ["InternalCollectionsUtilities"], - exclude: ["CMakeLists.txt"]), - .target( - kind: .test, - name: "HashTreeCollectionsTests", - dependencies: ["HashTreeCollections", "_CollectionsTestSupport"]), - - .target( - kind: .exported, - name: "HeapModule", - dependencies: ["InternalCollectionsUtilities"], - exclude: ["CMakeLists.txt"]), - .target( - kind: .test, - name: "HeapTests", - dependencies: ["HeapModule", "_CollectionsTestSupport"]), - - .target( - kind: .exported, - name: "OrderedCollections", - dependencies: ["InternalCollectionsUtilities"], - exclude: ["CMakeLists.txt"]), - .target( - kind: .test, - name: "OrderedCollectionsTests", - dependencies: ["OrderedCollections", "_CollectionsTestSupport"]), - - .target( - kind: .exported, - name: "_RopeModule", - dependencies: ["InternalCollectionsUtilities"], - directory: "RopeModule", - exclude: ["CMakeLists.txt"], - // FIXME: _modify accessors in RopeModule seem to be broken in Swift 6 mode - settings: _sharedSettings + [.swiftLanguageMode(.v5)]), - .target( - kind: .test, - name: "RopeModuleTests", - dependencies: ["_RopeModule", "_CollectionsTestSupport"]), - - .target( - kind: .exported, - name: "SpanPreview", - dependencies: ["InternalCollectionsUtilities"], - exclude: ["CMakeLists.txt"]), - .target( - kind: .test, - name: "SpanPreviewTests", - dependencies: ["SpanPreview", "_CollectionsTestSupport"]), - - .target( - kind: .exported, - name: "TrailingElementsModule", - exclude: ["CMakeLists.txt"]), - .target( - kind: .test, - name: "TrailingElementsTests", - dependencies: ["TrailingElementsModule"]), - - .target( - kind: .exported, - name: "Collections", - dependencies: [ - "BitCollections", - "DequeModule", - "HashTreeCollections", - "HeapModule", - "OrderedCollections", - "_RopeModule", - //"SortedCollections", - ], - exclude: ["CMakeLists.txt"]), - .target( - kind: .test, - name: "CollectionsModuleTests", - dependencies: ["Collections", "_CollectionsTestSupport"], - settings: _baseSettings), -] - -let _products: [Product] = targets.compactMap { t in - guard t.kind == .exported else { return nil } - return .library(name: t.name, targets: [t.name]) -} -let _targets: [Target] = targets.map { $0.toTarget() } - -let package = Package( - name: "swift-collections", - products: _products, - targets: _targets -) diff --git a/Sources/BasicContainers/HashTable/_HTable+Bitmap.swift b/Sources/BasicContainers/HashTable/_HTable+Bitmap.swift index 75779880..e1a0e9f6 100644 --- a/Sources/BasicContainers/HashTable/_HTable+Bitmap.swift +++ b/Sources/BasicContainers/HashTable/_HTable+Bitmap.swift @@ -15,7 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) extension _HTable { @usableFromInline @frozen @@ -70,7 +69,7 @@ extension _HTable.Bitmap { package func clearAll() { _words.update(repeating: .empty) } - + @_alwaysEmitIntoClient package func occupiedCount() -> Int { var c = 0 @@ -197,4 +196,3 @@ extension _HTable.Bitmap { return result } } -#endif diff --git a/Sources/BasicContainers/HashTable/_HTable+Bucket.swift b/Sources/BasicContainers/HashTable/_HTable+Bucket.swift index 31bcc7a0..076f0e4c 100644 --- a/Sources/BasicContainers/HashTable/_HTable+Bucket.swift +++ b/Sources/BasicContainers/HashTable/_HTable+Bucket.swift @@ -15,7 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) extension _HTable { /// Identifies a particular bucket within a hash table by its offset. /// Having a dedicated wrapper type for this prevents passing a bucket number @@ -102,7 +101,7 @@ extension _HTable.Bucket { package var word: Int { Int(truncatingIfNeeded: offset &>> Word.wordShift) } - + @_alwaysEmitIntoClient @_transparent package var bit: UInt { @@ -135,7 +134,7 @@ extension UnsafeMutableBufferPointer where Element: ~Copyable { return _ptr(at: bucket.offset) } } - + @_alwaysEmitIntoClient @_transparent package func _ptr( @@ -143,7 +142,7 @@ extension UnsafeMutableBufferPointer where Element: ~Copyable { ) -> UnsafeMutablePointer { _ptr(at: bucket.offset) } - + @_alwaysEmitIntoClient @_transparent package func _initializeElement( @@ -152,7 +151,7 @@ extension UnsafeMutableBufferPointer where Element: ~Copyable { ) { initializeElement(at: bucket.offset, to: value) } - + @_alwaysEmitIntoClient @_transparent package func _extracting(_ buckets: Range<_HTable.Bucket>) -> Self { @@ -171,5 +170,3 @@ extension Range where Bound == _HTable.Bucket { } } } - -#endif diff --git a/Sources/BasicContainers/HashTable/_HTable+Consumption.swift b/Sources/BasicContainers/HashTable/_HTable+Consumption.swift index ed4090e0..a6b9decb 100644 --- a/Sources/BasicContainers/HashTable/_HTable+Consumption.swift +++ b/Sources/BasicContainers/HashTable/_HTable+Consumption.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - extension _HTable { @usableFromInline package mutating func consumeAll( @@ -25,5 +23,3 @@ extension _HTable { clear() } } - -#endif diff --git a/Sources/BasicContainers/HashTable/_HTable+Debug.swift b/Sources/BasicContainers/HashTable/_HTable+Debug.swift index 60b9aa80..5320739c 100644 --- a/Sources/BasicContainers/HashTable/_HTable+Debug.swift +++ b/Sources/BasicContainers/HashTable/_HTable+Debug.swift @@ -15,7 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) extension _HTable { package func maxOccupiedRun() -> Int { if isSmall { return self.count } @@ -61,7 +60,7 @@ extension _HTable { } return str } - + package func describe( bitmap: Bool = false, ) -> String { @@ -78,11 +77,11 @@ extension _HTable { } return s } - + package var description: String { describe() } - + package func checkInvariants( failureHandler: (String) -> Void, hashGenerator: (Bucket) -> Int @@ -104,13 +103,13 @@ extension _HTable { } return } - + // large let c = bitmap.occupiedCount() if c != self.count { failureHandler("Count does not match bitmap count (count: \(self.count), bitmap: \(c))") } - + guard c > 0 else { return } // Start iterating from the first empty bucket, wrapping around once var it = self.makeBucketIterator() @@ -167,4 +166,3 @@ extension _HTable { #endif } } -#endif diff --git a/Sources/BasicContainers/HashTable/_HTable+Deprecated.swift b/Sources/BasicContainers/HashTable/_HTable+Deprecated.swift index 449d93db..f4d86079 100644 --- a/Sources/BasicContainers/HashTable/_HTable+Deprecated.swift +++ b/Sources/BasicContainers/HashTable/_HTable+Deprecated.swift @@ -13,7 +13,6 @@ #if COLLECTIONS_SINGLE_MODULE -#if compiler(>=6.2) extension _HTable.BucketIterator { // FIXME: Remove after 27.0 releases @available(*, deprecated, renamed: "advanceToOccupied(maxCount:)") @@ -58,6 +57,3 @@ extension _HTable.BucketIterator { } } #endif - -#endif - diff --git a/Sources/BasicContainers/HashTable/_HTable+Find.swift b/Sources/BasicContainers/HashTable/_HTable+Find.swift index 5c5ec108..fc2bc9e1 100644 --- a/Sources/BasicContainers/HashTable/_HTable+Find.swift +++ b/Sources/BasicContainers/HashTable/_HTable+Find.swift @@ -15,7 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) extension _HTable { @usableFromInline internal func find_Small( @@ -63,4 +62,3 @@ extension _HTable { #endif } } -#endif diff --git a/Sources/BasicContainers/HashTable/_HTable+Insert.swift b/Sources/BasicContainers/HashTable/_HTable+Insert.swift index c74ebf89..bda1d380 100644 --- a/Sources/BasicContainers/HashTable/_HTable+Insert.swift +++ b/Sources/BasicContainers/HashTable/_HTable+Insert.swift @@ -11,7 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) extension _HTable { @usableFromInline internal mutating func insertNew_Small( @@ -27,8 +26,8 @@ extension _HTable { _maxProbeLength = _count return r } - - + + @usableFromInline internal mutating func insertNew_Large( hashValue: Int, @@ -37,7 +36,7 @@ extension _HTable { ) -> Bucket { assert(!isSmall) assert(!isFull) - + #if COLLECTIONS_NO_ROBIN_HOOD_HASHING let ideal = idealBucket(forHashValue: hashValue) let bitmap = self.bitmap @@ -84,4 +83,3 @@ extension _HTable { #endif } } -#endif diff --git a/Sources/BasicContainers/HashTable/_HTable+Iteration.swift b/Sources/BasicContainers/HashTable/_HTable+Iteration.swift index bd7970c3..8636adf8 100644 --- a/Sources/BasicContainers/HashTable/_HTable+Iteration.swift +++ b/Sources/BasicContainers/HashTable/_HTable+Iteration.swift @@ -15,7 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) extension _HTable { @usableFromInline @_lifetime(borrow self) @@ -53,7 +52,7 @@ extension _HTable { @_alwaysEmitIntoClient package var _bucket: Bucket - + /// Remaining bits not yet processed from the last word read. @_alwaysEmitIntoClient package var _nextBits: Word @@ -98,13 +97,13 @@ extension _HTable.BucketIterator { package var currentBucket: Bucket { _bucket } - + @usableFromInline @_transparent package var isAtEnd: Bool { _bucket >= _endBucket } - + @usableFromInline @_transparent package var isOccupied: Bool { @@ -112,7 +111,7 @@ extension _HTable.BucketIterator { if _words == nil { return true } return _nextBits.contains(0) } - + @_transparent @_lifetime(self: copy self) package mutating func restart() { @@ -123,7 +122,7 @@ extension _HTable.BucketIterator { _nextBitCount = UInt8(Swift.min(Word._capacity, _endBucket._offset)) } } - + @_transparent @_lifetime(self: copy self) package mutating func _wrap() { @@ -266,7 +265,7 @@ extension _HTable.BucketIterator { } return true } - + @usableFromInline @_lifetime(self: copy self) package mutating func wrapToOccupied() { @@ -392,4 +391,3 @@ extension _HTable.BucketIterator { return Range(uncheckedBounds: (start, end)) } } -#endif diff --git a/Sources/BasicContainers/HashTable/_HTable+Removal.swift b/Sources/BasicContainers/HashTable/_HTable+Removal.swift index e2836207..ac604e0c 100644 --- a/Sources/BasicContainers/HashTable/_HTable+Removal.swift +++ b/Sources/BasicContainers/HashTable/_HTable+Removal.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - extension _HTable { /// Create a hole at the specified occupied bucket without marking it as /// unoccupied or restoring the hash table's other invariants. After a hole @@ -25,7 +23,7 @@ extension _HTable { assert(isOccupied(bucket)) _count &-= 1 } - + /// Restore hash table invariants after a hole was created by `createHole`. /// This works by swapping items as needed to move the hole forward until we /// reach the end of the affected chain of occupied buckets. @@ -120,5 +118,3 @@ extension _HTable { return bucket } } - -#endif diff --git a/Sources/BasicContainers/HashTable/_HTable+Resizing.swift b/Sources/BasicContainers/HashTable/_HTable+Resizing.swift index d5ef0051..2e211be8 100644 --- a/Sources/BasicContainers/HashTable/_HTable+Resizing.swift +++ b/Sources/BasicContainers/HashTable/_HTable+Resizing.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - extension _HTable { @usableFromInline package mutating func migrateItems_Small( @@ -23,7 +21,7 @@ extension _HTable { assert(self.isSmall) assert(source.count <= self.capacity) guard !source.isEmpty else { return } - + // Let's reverse the order of members, to emphasize that this is not an // ordered container. let c = source.count @@ -41,7 +39,7 @@ extension _HTable { } source.clear() } - + @usableFromInline package mutating func migrateItems_Large( from source: inout _HTable, @@ -54,7 +52,7 @@ extension _HTable { assert(!self.isSmall) assert(source.count <= self.capacity) guard !source.isEmpty else { return } - + // Move & rehash items one by one. var it = source.makeBucketIterator() while let next = it.nextOccupiedRegion() { @@ -72,5 +70,3 @@ extension _HTable { source.clear() } } - -#endif diff --git a/Sources/BasicContainers/HashTable/_HTable+Sizing.swift b/Sources/BasicContainers/HashTable/_HTable+Sizing.swift index 2904769d..6afede12 100644 --- a/Sources/BasicContainers/HashTable/_HTable+Sizing.swift +++ b/Sources/BasicContainers/HashTable/_HTable+Sizing.swift @@ -15,7 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) extension _HTable { /// The minimum hash table scale. @_alwaysEmitIntoClient @@ -26,7 +25,7 @@ extension _HTable { 4 } } - + /// The maximum hash table scale. @_alwaysEmitIntoClient package static var maximumScale: UInt8 { @@ -36,7 +35,7 @@ extension _HTable { Swift.min(UInt8(truncatingIfNeeded: Int.bitWidth) &- 1, 56) } } - + /// The maximum number of items for which we do not create a hash table. @usableFromInline package static var maximumUnhashedCount: Int { @@ -45,7 +44,7 @@ extension _HTable { maximumCapacity(forScale: 0) } } - + @inlinable @inline(__always) package static func wordCount(forScale scale: UInt8) -> Int { @@ -72,24 +71,24 @@ extension _HTable { // away. This provides hysteresis for storage capacities, preventing hash // tables from repeatedly shrinking/growing when only a handful of items are // added/removed in a loop. - + /// The numerator of the maximum hash table load factor. @_transparent internal static var _maxLFNum: UInt { 7 } - + /// The denominator of the maximum hash table load factor. @_transparent internal static var _maxLFDenom: UInt { 8 } - + /// The numerator of the minimum hash table load factor. @_transparent internal static var _minLFNum: UInt { 1 } - + /// The denominator of minimum hash table load factor. @_alwaysEmitIntoClient @_transparent internal static var _minLFDenom: UInt { 8 } - + /// The minimum number of items that can be held in a hash table of the given scale. @usableFromInline @_effects(readnone) @@ -99,7 +98,7 @@ extension _HTable { let bucketCount: UInt = 1 &<< scale return Int(bucketCount * _minLFNum / _minLFDenom) } - + /// The maximum number of items that can be held in a hash table of the given scale. @usableFromInline @_effects(readnone) @@ -108,8 +107,8 @@ extension _HTable { let bucketCount: UInt = 1 &<< scale return Int(bucketCount * _maxLFNum / _maxLFDenom) } - - + + /// The minimum hash table scale that can hold the specified number of elements. @usableFromInline @_effects(readnone) @@ -151,4 +150,3 @@ extension _HTable { return (scale, capacity) } } -#endif diff --git a/Sources/BasicContainers/HashTable/_HTable.swift b/Sources/BasicContainers/HashTable/_HTable.swift index 4d6509f7..acf98f42 100644 --- a/Sources/BasicContainers/HashTable/_HTable.swift +++ b/Sources/BasicContainers/HashTable/_HTable.swift @@ -15,7 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) @usableFromInline @frozen package struct _HTable: ~Copyable { @@ -30,13 +29,13 @@ package struct _HTable: ~Copyable { @_alwaysEmitIntoClient package let _bitmap: UnsafeMutablePointer? - + @_alwaysEmitIntoClient package var _maxProbeLength: Int @_alwaysEmitIntoClient package let scale: UInt8 - + // FIXME: Add a reservedScale for UniqueSet/UniqueDictonary @inlinable @@ -61,7 +60,7 @@ package struct _HTable: ~Copyable { self._bitmap = bitmap } } - + @inlinable internal init(capacity: Int) { assert(capacity >= 0) @@ -69,7 +68,7 @@ package struct _HTable: ~Copyable { _capacity: capacity, scale: Self.minimumScale(forCapacity: capacity)) } - + @inlinable internal init(minimumCapacity: Int) { precondition(minimumCapacity >= 0, "Capacity must be nonnegative") @@ -77,7 +76,7 @@ package struct _HTable: ~Copyable { self.init(_capacity: p.capacity, scale: p.scale) } - + @_alwaysEmitIntoClient deinit { _bitmap?.deallocate() @@ -115,7 +114,7 @@ extension _HTable { _count == capacity } - + @_alwaysEmitIntoClient @_transparent package var wordCount: Int { @@ -130,7 +129,7 @@ extension _HTable { package var startBucket: Bucket { Bucket(offset: 0) } - + @_alwaysEmitIntoClient @_transparent package var endBucket: Bucket { @@ -149,13 +148,13 @@ extension _HTable { package var bucketCount: UInt { UInt(bitPattern: storageCapacity) } - + @_transparent @inlinable package func isValid(_ bucket: Bucket) -> Bool { bucket._offset < bucketCount } - + @_transparent @inlinable package func wrapBucket(after bucket: inout Bucket) { @@ -180,7 +179,7 @@ extension _HTable { Bitmap(table: self) } } - + @_transparent @inlinable package func isOccupied(_ bucket: Bucket) -> Bool { @@ -236,4 +235,3 @@ extension _HTable { && self.scale == other.scale } } -#endif diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Append.swift b/Sources/BasicContainers/RigidArray/RigidArray+Append.swift index 8ed3b386..85af5f81 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Append.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Append.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidArray where Element: ~Copyable { @_alwaysEmitIntoClient @@ -348,7 +346,7 @@ extension RigidArray { var it = self._append(prefixOf: newElements) precondition(it.next() == nil, "RigidArray capacity overflow") } - + #if compiler(>=6.4) /// Copies the elements of a borrowing sequence to the end of this array. /// @@ -372,4 +370,3 @@ extension RigidArray { } #endif } -#endif diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Consumption.swift b/Sources/BasicContainers/RigidArray/RigidArray+Consumption.swift index 54ba8264..fc5fc1b8 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Consumption.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Consumption.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - #if UnstableContainersPreview @available(SwiftStdlib 5.0, *) extension RigidArray where Element: ~Copyable { @@ -30,7 +28,7 @@ extension RigidArray where Element: ~Copyable { initializedCount: buffer.count) return _overrideLifetime(result, mutating: &self) } - + /// Remove the specified subrange of items from this array, /// passing an input span to the given function to consume them in place. /// @@ -57,7 +55,7 @@ extension RigidArray where Element: ~Copyable { } let buffer = unsafe _storage.extracting(subrange) var span = InputSpan(buffer: buffer, initializedCount: buffer.count) - + consumer(&span) _ = consume span @@ -167,15 +165,15 @@ extension RigidArray where Element: ~Copyable { @usableFromInline internal var _offsetRange: Range - + @usableFromInline internal var _remainder: UnsafeMutableBufferPointer - + @_alwaysEmitIntoClient @inline(__always) @_lifetime(&_base) internal init(_base: inout RigidArray, offsetRange: Range) { - + self._remainder = _base._storage._extracting(unchecked: offsetRange) self._base = _MutableRef(&_base) self._offsetRange = offsetRange @@ -184,7 +182,7 @@ extension RigidArray where Element: ~Copyable { @inlinable deinit { self._remainder.deinitialize() - + // FIXME: This needs to be written as // self._base.value.closeGap(offsets: self._offsetRange) // but unfortunately we cannot mutate self in deinit yet. @@ -225,5 +223,3 @@ extension RigidArray.SubrangeConsumer where Element: ~Copyable { } } #endif - -#endif diff --git a/Sources/BasicContainers/RigidArray/RigidArray+ContainerOperations.swift b/Sources/BasicContainers/RigidArray/RigidArray+ContainerOperations.swift index 51316e49..13c4f7eb 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+ContainerOperations.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+ContainerOperations.swift @@ -15,8 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidArray where Element: ~Copyable { /// A Boolean value indicating whether this array contains no elements. @@ -442,5 +440,3 @@ extension RigidArray where Element: ~Copyable { return _span(in: Range(uncheckedBounds: (start, index))) } } - -#endif diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Deprecated.swift b/Sources/BasicContainers/RigidArray/RigidArray+Deprecated.swift index 79c3bb46..eae0a943 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Deprecated.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Deprecated.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidArray where Element: ~Copyable { @available(*, deprecated, renamed: "nextSpan(after:maxCount:)") @@ -76,7 +74,7 @@ extension RigidArray where Element: ~Copyable { } return result.take()! } - + /// Inserts a given number of new items into this array at the specified /// position, using a callback to directly initialize array storage by /// populating an output span. @@ -140,8 +138,8 @@ extension RigidArray { public func copy() -> Self { clone() } - - + + /// Copy the contents of this array into a newly allocated rigid array /// instance with the specified capacity. /// @@ -240,5 +238,3 @@ extension RigidArray { } } - -#endif diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Descriptions.swift b/Sources/BasicContainers/RigidArray/RigidArray+Descriptions.swift index 5043d4cd..536d723a 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Descriptions.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Descriptions.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - // FIXME: Add this when/if SE-0499 gets implemented. //#if compiler(>=6.x) //@available(SwiftStdlib 5.0, *) @@ -42,6 +40,3 @@ extension RigidArray where Element: ~Copyable { "<\(count) items>" } } - - -#endif diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Equatable.swift b/Sources/BasicContainers/RigidArray/RigidArray+Equatable.swift index fcb8a698..f2677916 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Equatable.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Equatable.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - #if !COLLECTIONS_SINGLE_MODULE import InternalCollectionsUtilities #endif @@ -52,5 +50,3 @@ extension RigidArray /*: Equatable */ where Element: Equatable /* & ~Copyable */ } } #endif - -#endif diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Experimental.swift b/Sources/BasicContainers/RigidArray/RigidArray+Experimental.swift index cf27bdae..80e73cd5 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Experimental.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Experimental.swift @@ -15,7 +15,7 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) && UnstableContainersPreview +#if UnstableContainersPreview #if false // FIXME @available(SwiftStdlib 5.0, *) diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Hashable.swift b/Sources/BasicContainers/RigidArray/RigidArray+Hashable.swift index 7cab7841..00090dd5 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Hashable.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Hashable.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - #if !COLLECTIONS_SINGLE_MODULE import InternalCollectionsUtilities #endif @@ -40,5 +38,3 @@ extension RigidArray where Element: Hashable { } } #endif - -#endif diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Initializers.swift b/Sources/BasicContainers/RigidArray/RigidArray+Initializers.swift index 519cd165..f068a023 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Initializers.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Initializers.swift @@ -15,8 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidArray where Element: ~Copyable { /// Initializes a new rigid array with zero capacity and no elements. @@ -28,7 +26,7 @@ extension RigidArray where Element: ~Copyable { _capacity = 0 _count = 0 } - + /// Initializes a new rigid array with the specified capacity and no elements. @inlinable public init(capacity: Int) { @@ -114,7 +112,7 @@ extension RigidArray /*where Element: Copyable*/ { self.init(capacity: capacity) self.append(copying: contents) } - + #if compiler(>=6.4) /// Creates a new array with the specified capacity, holding a copy /// of the contents of a given container. @@ -135,9 +133,9 @@ extension RigidArray /*where Element: Copyable*/ { self.init(capacity: capacity) try self.append(copying: contents) } - + #endif - + #if compiler(>=6.4) /// Creates a new array with the specified capacity, holding a copy /// of the contents of a given container. @@ -159,7 +157,7 @@ extension RigidArray /*where Element: Copyable*/ { try self.append(copying: contents) } #endif - + /// Creates a new array with the specified capacity, holding a copy /// of the contents of a given collection. /// @@ -196,5 +194,3 @@ extension RigidArray /*where Element: Copyable*/ { self.append(copying: span) } } - -#endif diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Insertions.swift b/Sources/BasicContainers/RigidArray/RigidArray+Insertions.swift index 4ef074c9..811dc09c 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Insertions.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Insertions.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidArray where Element: ~Copyable { /// Inserts a new element into the array at the specified position. @@ -403,5 +401,3 @@ extension RigidArray { _insertCollection(addingCount: items.count, copying: items, at: index) } } - -#endif diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Iterable.swift b/Sources/BasicContainers/RigidArray/RigidArray+Iterable.swift index 1f662046..1695cdd9 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Iterable.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Iterable.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidArray where Element: ~Copyable { @inlinable @@ -36,5 +34,3 @@ extension RigidArray: Iterable where Element: ~Copyable { } } #endif - -#endif diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Removals.swift b/Sources/BasicContainers/RigidArray/RigidArray+Removals.swift index 59fa501c..2acc3030 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Removals.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Removals.swift @@ -15,8 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidArray where Element: ~Copyable { /// Removes all elements from the array, preserving its allocated capacity. @@ -157,5 +155,3 @@ extension RigidArray where Element: ~Copyable { return removeLast() } } - -#endif diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Replacements.swift b/Sources/BasicContainers/RigidArray/RigidArray+Replacements.swift index 4b91f35d..ba7fd185 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Replacements.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Replacements.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidArray where Element: ~Copyable { /// Replaces the specified range of elements by a given count of new items, @@ -251,7 +249,7 @@ extension RigidArray where Element: ~Copyable { } } } - + #if UnstableContainersPreview /// Replaces the specified range of elements by moving the contents of an /// input span into their place. On return, the span is left empty. @@ -595,5 +593,3 @@ extension RigidArray { newCount: newElements.count) } } - -#endif diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Append.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Append.swift index 015ee2f1..9d073e85 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Append.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Append.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueArray where Element: ~Copyable { /// Adds an element to the end of the array. @@ -93,7 +91,7 @@ extension UniqueArray where Element: ~Copyable { _ensureFreeCapacity(items.count) return _storage._appendUnchecked(moving: items) } - + #if UnstableContainersPreview /// Moves the elements of a input span to the end of this array, leaving the /// span empty. @@ -309,7 +307,7 @@ extension UniqueArray { self.append(item) } } - + #if compiler(>=6.4) /// Copies the elements of a container to the end of this array. /// @@ -334,5 +332,3 @@ extension UniqueArray { } #endif } - -#endif diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Consumption.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Consumption.swift index 5d17eb6a..c9867fc6 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Consumption.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Consumption.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - #if UnstableContainersPreview @available(SwiftStdlib 5.0, *) extension UniqueArray where Element: ~Copyable { @@ -128,5 +126,3 @@ extension UniqueArray where Element: ~Copyable { } } #endif - -#endif diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+ContainerOperations.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+ContainerOperations.swift index 86f09b23..efbf9f72 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+ContainerOperations.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+ContainerOperations.swift @@ -15,8 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueArray where Element: ~Copyable { /// A Boolean value indicating whether this array contains no elements. @@ -380,5 +378,3 @@ extension UniqueArray where Element: ~Copyable { _storage.previousSpan(before: &index, maxCount: maxCount) } } - -#endif diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Deprecated.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Deprecated.swift index 20e28695..2c3cd53b 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Deprecated.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Deprecated.swift @@ -15,8 +15,6 @@ import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueArray where Element: ~Copyable { @available(*, deprecated, renamed: "nextSpan(after:maxCount:)") @@ -99,7 +97,7 @@ extension UniqueArray where Element: ~Copyable { } return result.take()! } - + /// Inserts a given number of new items into this array at the specified /// position, using a callback to directly initialize array storage by /// populating an output span. @@ -240,7 +238,7 @@ extension UniqueArray { public func copy() -> Self { self.clone() } - + /// Copy the contents of this array into a newly allocated unique array /// instance with the specified capacity. /// @@ -290,5 +288,3 @@ extension UniqueArray { replaceSubrange(subrange, copying: newElements) } } - -#endif diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Descriptions.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Descriptions.swift index 9fbf1124..45ab4d1a 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Descriptions.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Descriptions.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueArray /*: CustomStringConvertible */ where Element: ~Copyable { public var description: String { @@ -28,5 +26,3 @@ extension UniqueArray /*: CustomDebugStringConvertible */ where Element: ~Copyab "<\(count) items>" } } - -#endif diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Equatable.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Equatable.swift index c61d4f85..902736f0 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Equatable.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Equatable.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - #if !COLLECTIONS_SINGLE_MODULE import InternalCollectionsUtilities #endif @@ -51,5 +49,3 @@ extension UniqueArray where Element: Equatable { } } #endif - -#endif diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Experimental.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Experimental.swift index 6d3f3381..d7b35b9a 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Experimental.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Experimental.swift @@ -15,7 +15,7 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) && UnstableContainersPreview +#if UnstableContainersPreview #if false // TODO extension UniqueArray /*where Element: Copyable*/ { diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Hashable.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Hashable.swift index 646cbc12..f14d7f3f 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Hashable.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Hashable.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - #if !COLLECTIONS_SINGLE_MODULE import InternalCollectionsUtilities #endif @@ -38,5 +36,3 @@ extension UniqueArray where Element: Hashable { } } #endif - -#endif diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Initializers.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Initializers.swift index 6ab781e0..86f8c0a6 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Initializers.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Initializers.swift @@ -15,8 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueArray where Element: ~Copyable { /// Initializes a new unique array with no elements. @@ -24,7 +22,7 @@ extension UniqueArray where Element: ~Copyable { public init() { _storage = .init(capacity: 0) } - + /// Initializes a new unique array with the specified capacity and no elements. @inlinable public init(minimumCapacity: Int) { @@ -122,7 +120,7 @@ extension UniqueArray /*where Element: Copyable*/ { self.init(minimumCapacity: capacity ?? 0) self.append(copying: contents) } - + #if compiler(>=6.4) /// Creates a new array with the specified initial capacity, holding a copy /// of the contents of a given container. @@ -162,5 +160,3 @@ extension UniqueArray /*where Element: Copyable*/ { self.append(copying: span) } } - -#endif diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Insertions.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Insertions.swift index 89947c22..149efddc 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Insertions.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Insertions.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueArray where Element: ~Copyable { /// Inserts a new element into the array at the specified position. @@ -335,5 +333,3 @@ extension UniqueArray { addingCount: newCount, copying: newElements, at: index) } } - -#endif diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Removals.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Removals.swift index 459fd7b5..308279b3 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Removals.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Removals.swift @@ -15,8 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueArray where Element: ~Copyable { /// Removes all elements from the array, preserving its @@ -141,5 +139,3 @@ extension UniqueArray where Element: ~Copyable { return removeLast() } } - -#endif diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Replacements.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Replacements.swift index 3a99080a..00009dfd 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Replacements.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Replacements.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueArray where Element: ~Copyable { /// Replaces the specified range of elements by a given count of new items, @@ -468,7 +466,7 @@ extension UniqueArray { _ensureFreeCapacity(newElements.count - subrange.count) return _storage.replaceSubrange(subrange, copying: newElements) } - + /// Replaces the specified subrange of elements by copying the elements of /// the given collection. /// @@ -513,4 +511,3 @@ extension UniqueArray { newCount: c) } } -#endif diff --git a/Sources/ContainersPreview/Conformances/InputSpan+Container.swift b/Sources/ContainersPreview/Conformances/InputSpan+Container.swift index e0edbbf0..72103d8e 100644 --- a/Sources/ContainersPreview/Conformances/InputSpan+Container.swift +++ b/Sources/ContainersPreview/Conformances/InputSpan+Container.swift @@ -40,7 +40,7 @@ where Element: ~Copyable } #endif -#if compiler(>=6.2) && UnstableContainersPreview +#if UnstableContainersPreview @available(SwiftStdlib 5.0, *) extension InputSpan where Element: ~Copyable { @_alwaysEmitIntoClient diff --git a/Sources/ContainersPreview/Conformances/MutableSpan+Container.swift b/Sources/ContainersPreview/Conformances/MutableSpan+Container.swift index b4432051..6faec6ea 100644 --- a/Sources/ContainersPreview/Conformances/MutableSpan+Container.swift +++ b/Sources/ContainersPreview/Conformances/MutableSpan+Container.swift @@ -36,7 +36,7 @@ extension MutableSpan: RandomAccessContainer where Element: ~Copyable { } #endif -#if compiler(>=6.2) && UnstableContainersPreview +#if UnstableContainersPreview @available(SwiftStdlib 5.0, *) extension MutableSpan where Element: ~Copyable { @_alwaysEmitIntoClient @@ -86,7 +86,7 @@ extension MutableSpan where Element: ~Copyable { extension MutableSpan: MutableContainer where Element: ~Copyable {} #endif -#if compiler(>=6.2) && UnstableContainersPreview +#if UnstableContainersPreview @available(SwiftStdlib 5.0, *) extension MutableSpan where Element: ~Copyable { @_alwaysEmitIntoClient diff --git a/Sources/ContainersPreview/Conformances/Span+Container.swift b/Sources/ContainersPreview/Conformances/Span+Container.swift index bdb414ea..01ea4c9e 100644 --- a/Sources/ContainersPreview/Conformances/Span+Container.swift +++ b/Sources/ContainersPreview/Conformances/Span+Container.swift @@ -47,7 +47,6 @@ extension Span: RandomAccessContainer where Element: ~Copyable { } #endif -#if compiler(>=6.2) @available(SwiftStdlib 5.0, *) extension Span where Element: ~Copyable { @_alwaysEmitIntoClient @@ -91,4 +90,3 @@ extension Span where Element: ~Copyable { _spanBoundary(before: index, maxDistance: maxDistance, limitedBy: limit) } } -#endif diff --git a/Sources/ContainersPreview/Types/Shared.swift b/Sources/ContainersPreview/Types/Shared.swift index 80abbaf0..cb0a9de2 100644 --- a/Sources/ContainersPreview/Types/Shared.swift +++ b/Sources/ContainersPreview/Types/Shared.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && UnstableContainersPreview - #if false // TODO import Builtin // For Shared.isIdentical @@ -163,4 +161,3 @@ extension Shared where Storage: ~Copyable { } } #endif -#endif diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Append.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Append.swift index 52072bdd..312f8c43 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Append.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Append.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidDeque where Element: ~Copyable { /// Adds an element to the end of the deque. @@ -137,7 +135,7 @@ extension RigidDeque where Element: ~Copyable { precondition(items.count <= freeCapacity, "RigidDeque capacity overflow") return _handle.uncheckedAppend(moving: items) } - + #if UnstableContainersPreview /// Moves the elements of an input span by appending them to the end of /// this deque, leaving the span empty. @@ -161,7 +159,7 @@ extension RigidDeque where Element: ~Copyable { } } #endif - + /// Moves the elements of an output span by appending them to the end of /// this deque, leaving the span empty. /// @@ -208,7 +206,7 @@ extension RigidDeque /*where Element: Copyable*/ { "RigidDeque capacity overflow") return _handle.uncheckedAppend(copying: items) } - + /// Copies the elements of a buffer and append them to the end of this /// deque. /// @@ -227,7 +225,7 @@ extension RigidDeque /*where Element: Copyable*/ { ) -> Range { unsafe self.append(copying: UnsafeBufferPointer(items)) } - + /// Copies the elements of a span and append them to the end of this deque. /// /// If the deque does not have sufficient capacity to hold all items in the @@ -244,7 +242,7 @@ extension RigidDeque /*where Element: Copyable*/ { unsafe self.append(copying: source) } } - + #if compiler(>=6.4) @available(SwiftStdlib 6.4, *) @_alwaysEmitIntoClient @@ -259,7 +257,7 @@ extension RigidDeque /*where Element: Copyable*/ { self.append(copying: span) } } - + /// Copies the elements of a borrowing sequence and append them to the end of /// this deque. /// @@ -279,7 +277,7 @@ extension RigidDeque /*where Element: Copyable*/ { try self._append(copying: newElements) } #endif - + /// Append the elements of a sequence to the end of this deque by copying /// them. /// @@ -297,11 +295,11 @@ extension RigidDeque /*where Element: Copyable*/ { return } if done != nil { return } - + var it = _handle.uncheckedAppend(copyingPrefixOf: newElements) precondition(it.next() == nil, "RigidDeque capacity overflow") } - + #if compiler(>=6.4) /// Copies the elements of a borrowing sequence to the end of this deque. /// @@ -324,5 +322,3 @@ extension RigidDeque /*where Element: Copyable*/ { } #endif } - -#endif diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Consumption.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Consumption.swift index cb5ad755..b82726ad 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Consumption.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Consumption.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidDeque where Element: ~Copyable { #if UnstableContainersPreview @@ -46,12 +44,12 @@ extension RigidDeque where Element: ~Copyable { ) -> Index { _checkValidBounds(subrange) let segments = self._handle.mutableSegments(forOffsets: subrange) - + var span = InputSpan( buffer: segments.first, initializedCount: segments.first.count) consumer(&span) _ = consume span - + if let second = segments.second { var span = InputSpan(buffer: second, initializedCount: second.count) consumer(&span) @@ -87,7 +85,7 @@ extension RigidDeque where Element: ~Copyable { ) -> Index { consumeSubrange(subrange.relative(to: indices), consumingWith: consumer) } - + /// Remove all items currently in this deque, passing a series of input /// spans to a given callback function to consume them in place. /// @@ -108,7 +106,7 @@ extension RigidDeque where Element: ~Copyable { ) { consumeSubrange(indices, consumingWith: consumer) } - + /// Remove the specified number of items from the end of this deque, /// passing an input span to a given callback function to consume them in /// place. @@ -267,5 +265,3 @@ extension RigidDeque.SubrangeConsumer where Element: ~Copyable { } } #endif - -#endif diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+ContainerOperations.swift b/Sources/DequeModule/RigidDeque/RigidDeque+ContainerOperations.swift index 9c0dd141..210d92ad 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+ContainerOperations.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+ContainerOperations.swift @@ -15,8 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidDeque where Element: ~Copyable { @_alwaysEmitIntoClient @@ -127,5 +125,3 @@ extension RigidDeque where Element: ~Copyable { return _overrideLifetime(Span(_unsafeElements: segment), borrowing: self) } } - -#endif diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Deprecations.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Deprecations.swift index a9a4687d..78a7de0d 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Deprecations.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Deprecations.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidDeque where Element: ~Copyable { /// Grow or shrink the capacity of a rigid deque instance without discarding @@ -303,5 +301,3 @@ extension RigidDeque /* where Element: Copyable */ { replaceSubrange(subrange, copying: items) } } - -#endif diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Descriptions.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Descriptions.swift index 4a3aedf9..532ea9e3 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Descriptions.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Descriptions.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidDeque /*: CustomStringConvertible */ where Element: ~Copyable { public var description: String { @@ -28,5 +26,3 @@ extension RigidDeque /*: CustomDebugStringConvertible */ where Element: ~Copyabl "<\(count) items>" } } - -#endif diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Equatable.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Equatable.swift index 5db11482..b4d630d3 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Equatable.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Equatable.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - #if !COLLECTIONS_SINGLE_MODULE import InternalCollectionsUtilities #endif @@ -65,5 +63,3 @@ extension RigidDeque where Element: Equatable { } } #endif - -#endif diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Hashable.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Hashable.swift index 5a0dbc46..42f03b92 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Hashable.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Hashable.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - #if !COLLECTIONS_SINGLE_MODULE import InternalCollectionsUtilities #endif @@ -48,5 +46,3 @@ extension RigidDeque where Element: Hashable { } } #endif - -#endif diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Initializers.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Initializers.swift index 9b798bea..f21c01d2 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Initializers.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Initializers.swift @@ -15,8 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidDeque where Element: ~Copyable { /// Initializes a new rigid deque with zero capacity and no elements. @@ -32,7 +30,7 @@ extension RigidDeque where Element: ~Copyable { public init(capacity: Int) { self.init(_handle: .allocate(capacity: capacity)) } - + /// Creates a rigid deque with the specified capacity, then calls the given /// closure with an output span covering the deque's uninitialized memory. /// @@ -141,7 +139,7 @@ extension RigidDeque /*where Element: Copyable*/ { self.init(capacity: capacity ?? contents.count) self.append(copying: contents) } - + #if compiler(>=6.4) /// Creates a new deque with the specified capacity, holding a copy /// of the contents of a given sequence. @@ -186,5 +184,3 @@ extension RigidDeque /*where Element: Copyable*/ { } #endif } - -#endif diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Insertions.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Insertions.swift index 96e3b01b..9ad36fd3 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Insertions.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Insertions.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidDeque where Element: ~Copyable { /// Inserts a new element into the deque at the specified position. @@ -368,5 +366,3 @@ extension RigidDeque /* where Element: Copyable */ { at: index, copying: items, newCount: items.count) } } - -#endif diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift index 48b7f458..db98df27 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Prepend.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidDeque where Element: ~Copyable { /// Adds an element to the front of the deque. @@ -34,7 +32,7 @@ extension RigidDeque where Element: ~Copyable { precondition(!isFull, "RigidDeque capacity overflow") _handle.uncheckedPrepend(item) } - + /// Adds an element to the front of the deque, if possible. /// /// If the deque does not have sufficient capacity to hold any more elements, @@ -140,7 +138,7 @@ extension RigidDeque where Element: ~Copyable { precondition(items.count <= freeCapacity, "RigidDeque capacity overflow") return _handle.uncheckedPrepend(moving: items) } - + #if UnstableContainersPreview /// Moves the elements of an input span by prepending them to the front of /// this deque, leaving the span empty. @@ -164,7 +162,7 @@ extension RigidDeque where Element: ~Copyable { } } #endif - + /// Moves the elements of an output span by prepending them to the front of /// this deque, leaving the span empty. /// @@ -212,7 +210,7 @@ extension RigidDeque /*where Element: Copyable*/ { "RigidDeque capacity overflow") return _handle.uncheckedPrepend(copying: items) } - + /// Copies the elements of a buffer and prepend them to the front of this /// deque. /// @@ -232,7 +230,7 @@ extension RigidDeque /*where Element: Copyable*/ { ) -> Range { unsafe self.prepend(copying: UnsafeBufferPointer(items)) } - + /// Copy the elements of a span and prepend them to the front of this deque. /// /// If the deque does not have sufficient capacity to hold all items in the @@ -250,7 +248,7 @@ extension RigidDeque /*where Element: Copyable*/ { unsafe self.prepend(copying: source) } } - + #if compiler(>=6.4) @available(SwiftStdlib 6.4, *) @inlinable @@ -287,7 +285,7 @@ extension RigidDeque /*where Element: Copyable*/ { target._append(copying: span) } } - + /// Copies the elements of a borrowing sequence and prepend them to the front /// of this deque. /// @@ -380,7 +378,7 @@ extension RigidDeque /*where Element: Copyable*/ { precondition(c <= freeCapacity, "RigidDeque capacity overflow") return _handle.uncheckedPrepend(copying: items, exactCount: c) } - + #if compiler(>=6.4) /// Copies the elements of a borrowing sequence to the front of this deque. /// @@ -420,4 +418,3 @@ extension RigidDeque /*where Element: Copyable*/ { } #endif } -#endif diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Removals.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Removals.swift index 4ae2b20e..a2e582a2 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Removals.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Removals.swift @@ -15,8 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidDeque where Element: ~Copyable { /// Removes and returns the element at the specified position. @@ -64,7 +62,7 @@ extension RigidDeque where Element: ~Copyable { public mutating func removeAll() { _handle.uncheckedRemoveAll() } - + /// Removes and returns the first element of the deque. /// /// The deque must not be empty. @@ -98,7 +96,7 @@ extension RigidDeque where Element: ~Copyable { precondition(!isEmpty, "Cannot remove last element of an empty RigidDeque") return _handle.uncheckedRemoveLast() } - + /// Removes and discards the specified number of elements from the start of /// the deque. /// @@ -142,7 +140,7 @@ extension RigidDeque where Element: ~Copyable { precondition(n <= count, "Cannot remove more elements than there are in the container") _handle.uncheckedRemoveLast(n) } - + /// Removes the specified subrange of elements from the deque. /// /// - Parameter bounds: The subrange to remove. The bounds of the @@ -188,5 +186,3 @@ extension RigidDeque where Element: ~Copyable { return _handle.uncheckedRemoveLast() } } - -#endif diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Replacements.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Replacements.swift index a7034356..3ed1f7ac 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Replacements.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Replacements.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidDeque where Element: ~Copyable { /// Replaces the specified range of elements by a given count of new items, @@ -77,7 +75,7 @@ extension RigidDeque where Element: ~Copyable { addingCount: newItemCount, initializingWith: initializer) } - + #if UnstableContainersPreview /// Replaces the specified range of elements by a given count of new items, /// using callbacks to consume old items, and to then insert new ones. @@ -204,7 +202,7 @@ extension RigidDeque where Element: ~Copyable { assert(remainder.isEmpty) return range } - + #if UnstableContainersPreview /// Replaces the specified range of elements by moving the contents of an /// input span into their place. On return, the span is left empty. @@ -466,5 +464,3 @@ extension RigidDeque /* where Element: Copyable */ { _replaceSubrange(subrange, copyingCollection: items, newCount: items.count) } } - -#endif diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Testing.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Testing.swift index e5b0a5ba..7a470fad 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Testing.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Testing.swift @@ -18,8 +18,6 @@ import InternalCollectionsUtilities // This file contains exported but non-public entry points to support clear box // testing. -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension RigidDeque where Element: ~Copyable { /// The number of the storage slot in this deque that holds the first element. @@ -48,7 +46,7 @@ extension RigidDeque { copying contents: some Sequence ) { let contents = Array(contents) - + self.init(capacity: capacity) _handle.startSlot = _handle.slot(_handle.startSlot, offsetBy: startSlot) self.append(copying: contents) @@ -57,5 +55,3 @@ extension RigidDeque { assert(self.count == contents.count) } } - -#endif diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Append.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Append.swift index 79a0766d..d045e066 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Append.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Append.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueDeque where Element: ~Copyable { /// Adds an element to the end of the deque. @@ -121,7 +119,7 @@ extension UniqueDeque where Element: ~Copyable { _ensureFreeCapacity(items.count) return _storage._handle.uncheckedAppend(moving: items) } - + #if UnstableContainersPreview /// Moves the elements of an input span by appending them to the end of /// this deque, leaving the span empty. @@ -147,7 +145,7 @@ extension UniqueDeque where Element: ~Copyable { } } #endif - + /// Moves the elements of an output span by appending them to the end of /// this deque, leaving the span empty. /// @@ -302,7 +300,7 @@ extension UniqueDeque /*where Element: Copyable*/ { _storage.append(item) } } - + #if compiler(>=6.4) /// Copies the elements of a borrowing sequence to the end of this deque. /// @@ -325,5 +323,3 @@ extension UniqueDeque /*where Element: Copyable*/ { } #endif } - -#endif diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Consumption.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Consumption.swift index a4f44a64..dca679aa 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Consumption.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Consumption.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueDeque where Element: ~Copyable { #if UnstableContainersPreview @@ -70,7 +68,7 @@ extension UniqueDeque where Element: ~Copyable { ) { consumeSubrange(subrange.relative(to: indices), consumingWith: consumer) } - + /// Remove all items currently in this deque, passing a series of input /// spans to a given callback function to consume them in place. /// @@ -91,7 +89,7 @@ extension UniqueDeque where Element: ~Copyable { ) { consumeSubrange(indices, consumingWith: consumer) } - + /// Remove the specified number of items from the end of this deque, /// passing an input span to a given callback function to consume them in /// place. @@ -162,5 +160,3 @@ extension UniqueDeque where Element: ~Copyable { } } #endif - -#endif diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+ContainerOperations.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+ContainerOperations.swift index 1d5cb4f1..092168be 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+ContainerOperations.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+ContainerOperations.swift @@ -15,8 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueDeque where Element: ~Copyable { @_alwaysEmitIntoClient @@ -97,5 +95,3 @@ extension UniqueDeque where Element: ~Copyable { _storage.previousSpan(before: &index, maxCount: maxCount) } } - -#endif diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Deprecations.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Deprecations.swift index 06d20d0c..0b8afb37 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Deprecations.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Deprecations.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueDeque where Element: ~Copyable { /// Creates an empty unique deque with the specified capacity. @@ -328,5 +326,3 @@ extension UniqueDeque /* where Element: Copyable */ { } } - -#endif diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Descriptions.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Descriptions.swift index ea563bbd..ff0587db 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Descriptions.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Descriptions.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueDeque /*: CustomStringConvertible */ where Element: ~Copyable { public var description: String { @@ -28,5 +26,3 @@ extension UniqueDeque /*: CustomDebugStringConvertible */ where Element: ~Copyab "<\(count) items>" } } - -#endif diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Equatable.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Equatable.swift index a133988a..a5bd9b11 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Equatable.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Equatable.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - #if !COLLECTIONS_SINGLE_MODULE import InternalCollectionsUtilities #endif @@ -51,5 +49,3 @@ extension UniqueDeque where Element: Equatable { } } #endif - -#endif diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Hashable.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Hashable.swift index 7df61de7..6c9fa66f 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Hashable.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Hashable.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - #if compiler(>=6.4) @available(SwiftStdlib 6.4, *) extension UniqueDeque: Hashable where Element: Hashable & ~Copyable { @@ -34,5 +32,3 @@ extension UniqueDeque where Element: Hashable { } } #endif - -#endif diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Initializers.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Initializers.swift index 2cc39a26..1f33595c 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Initializers.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Initializers.swift @@ -15,8 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueDeque where Element: ~Copyable { /// Initializes a new unique deque with no elements. @@ -122,7 +120,7 @@ extension UniqueDeque /*where Element: Copyable*/ { self.init(minimumCapacity: capacity ?? contents.underestimatedCount) self.append(copying: contents) } - + #if compiler(>=6.4) /// Creates a new deque with the specified capacity, holding a copy /// of the contents of a given sequence. @@ -164,5 +162,3 @@ extension UniqueDeque /*where Element: Copyable*/ { } #endif } - -#endif diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Insertions.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Insertions.swift index 68fd47eb..2b59781f 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Insertions.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Insertions.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueDeque where Element: ~Copyable { /// Inserts a new element into the deque at the specified position. @@ -386,5 +384,3 @@ extension UniqueDeque /* where Element: Copyable */ { at: index, copying: items, newCount: items.count) } } - -#endif diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift index 2190630d..d99c88a3 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Prepend.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueDeque where Element: ~Copyable { /// Adds an element to the front of the deque. @@ -126,7 +124,7 @@ extension UniqueDeque where Element: ~Copyable { _ensureFreeCapacity(items.count) return _storage._handle.uncheckedPrepend(moving: items) } - + #if UnstableContainersPreview /// Moves the elements of an input span by prepending them to the front of /// this deque, leaving the span empty. @@ -152,7 +150,7 @@ extension UniqueDeque where Element: ~Copyable { } } #endif - + /// Moves the elements of an output span by prepending them to the front of /// this deque, leaving the span empty. /// @@ -201,7 +199,7 @@ extension UniqueDeque /*where Element: Copyable*/ { _ensureFreeCapacity(items.count) return _storage._handle.uncheckedPrepend(copying: items) } - + /// Copies the elements of a buffer and prepend them to the front of this /// deque. /// @@ -221,7 +219,7 @@ extension UniqueDeque /*where Element: Copyable*/ { ) -> Range { unsafe self.prepend(copying: UnsafeBufferPointer(items)) } - + /// Copy the elements of a span and prepend them to the front of this deque. /// /// If the deque does not have sufficient capacity to hold all items in the @@ -239,7 +237,7 @@ extension UniqueDeque /*where Element: Copyable*/ { unsafe self.prepend(copying: source) } } - + #if compiler(>=6.4) @available(SwiftStdlib 6.4, *) @inlinable @@ -273,7 +271,7 @@ extension UniqueDeque /*where Element: Copyable*/ { target._append(copying: span) } } - + /// Copies the elements of a borrowing sequence and prepend them to the front /// of this deque. /// @@ -370,7 +368,7 @@ extension UniqueDeque /*where Element: Copyable*/ { _ensureFreeCapacity(c) return _storage._handle.uncheckedPrepend(copying: items, exactCount: c) } - + #if compiler(>=6.4) /// Copies the elements of a borrowing sequence to the end of this deque. /// @@ -412,4 +410,3 @@ extension UniqueDeque /*where Element: Copyable*/ { } #endif } -#endif diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Removals.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Removals.swift index b54a1b29..36faaf73 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Removals.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Removals.swift @@ -15,8 +15,6 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueDeque where Element: ~Copyable { /// Removes and returns the element at the specified position. @@ -36,7 +34,7 @@ extension UniqueDeque where Element: ~Copyable { public mutating func remove(at index: Int) -> Element { _storage.remove(at: index) } - + /// Removes all elements from the deque, preserving its allocated capacity. /// /// - Complexity: O(`count`) @@ -45,7 +43,7 @@ extension UniqueDeque where Element: ~Copyable { public mutating func removeAll() { _storage.removeAll() } - + /// Removes and returns the first element of the deque. /// /// The deque must not be empty. @@ -59,7 +57,7 @@ extension UniqueDeque where Element: ~Copyable { public mutating func removeFirst() -> Element { _storage.removeFirst() } - + /// Removes and returns the last element of the deque. /// /// The deque must not be empty. @@ -73,7 +71,7 @@ extension UniqueDeque where Element: ~Copyable { public mutating func removeLast() -> Element { _storage.removeLast() } - + /// Removes and discards the specified number of elements from the start of /// the deque. /// @@ -90,7 +88,7 @@ extension UniqueDeque where Element: ~Copyable { public mutating func removeFirst(_ k: Int) { _storage.removeFirst(k) } - + /// Removes and discards the specified number of elements from the end of the /// deque. /// @@ -107,7 +105,7 @@ extension UniqueDeque where Element: ~Copyable { public mutating func removeLast(_ k: Int) { _storage.removeLast(k) } - + /// Removes the specified subrange of elements from the deque. /// /// - Parameter bounds: The subrange to remove. The bounds of the @@ -149,5 +147,3 @@ extension UniqueDeque where Element: ~Copyable { _storage.popLast() } } - -#endif diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Replacements.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Replacements.swift index 60788d49..dc39b3ad 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Replacements.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Replacements.swift @@ -16,8 +16,6 @@ import InternalCollectionsUtilities import SpanPreview #endif -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension UniqueDeque where Element: ~Copyable { /// Replaces the specified range of elements by a given count of new items, @@ -89,7 +87,7 @@ extension UniqueDeque where Element: ~Copyable { addingCount: newItemCount, initializingWith: initializer) } - + #if UnstableContainersPreview /// Replaces the specified range of elements by a given count of new items, /// using callbacks to consume old items, and to then insert new ones. @@ -212,7 +210,7 @@ extension UniqueDeque where Element: ~Copyable { assert(remainder.isEmpty) return range } - + #if UnstableContainersPreview /// Replaces the specified range of elements by moving the contents of an /// input span into their place. On return, the span is left empty. @@ -480,5 +478,3 @@ extension UniqueDeque /* where Element: Copyable */ { _replaceSubrange(subrange, copyingCollection: items, newCount: items.count) } } - -#endif diff --git a/Sources/DequeModule/_UnsafeDequeHandle.swift b/Sources/DequeModule/_UnsafeDequeHandle.swift index d3bb4623..ddc853c3 100644 --- a/Sources/DequeModule/_UnsafeDequeHandle.swift +++ b/Sources/DequeModule/_UnsafeDequeHandle.swift @@ -215,13 +215,13 @@ extension _UnsafeDequeHandle where Element: ~Copyable { guard position < capacity else { return Slot(at: position &- capacity) } return Slot(at: position) } - + @_alwaysEmitIntoClient @_transparent internal func distance(from start: Slot, to end: Slot) -> Int { assert(start.position >= 0 && start.position <= capacity) assert(end.position >= 0 && end.position <= capacity) - + if end.position >= start.position { return end.position - start.position } else { @@ -633,7 +633,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable { } self.count = 0 } - + @_alwaysEmitIntoClient @_transparent internal mutating func unsafeConsumePrefix( @@ -666,7 +666,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable { mutablePtr(at: endSlot).initialize(to: element) count &+= 1 } - + /// Prepend `element` to the front of this buffer. The buffer must have enough /// free capacity to insert one new element. /// @@ -683,7 +683,6 @@ extension _UnsafeDequeHandle where Element: ~Copyable { } } -#if compiler(>=6.2) @available(SwiftStdlib 5.0, *) extension UnsafeMutableBufferPointer where Element: ~Copyable { @_alwaysEmitIntoClient @@ -700,7 +699,6 @@ extension UnsafeMutableBufferPointer where Element: ~Copyable { return try body(&span) } } -#endif extension _UnsafeDequeHandle where Element: ~Copyable { @_alwaysEmitIntoClient @@ -727,7 +725,6 @@ extension _UnsafeDequeHandle where Element: ~Copyable { } } -#if compiler(>=6.2) @available(SwiftStdlib 5.0, *) extension _UnsafeDequeHandle where Element: ~Copyable { /// Append a given number of items to the end of this deque by populating @@ -769,7 +766,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable { } return Range(uncheckedBounds: (origCount, count)) } - + /// Prepend a given number of items to the end of this deque by populating /// a series of storage regions through repeated calls of the specified /// callback function. @@ -835,7 +832,6 @@ extension _UnsafeDequeHandle where Element: ~Copyable { return Range(uncheckedBounds: (0, c)) } } -#endif @available(SwiftStdlib 5.0, *) extension _UnsafeDequeHandle where Element: ~Copyable { @@ -858,7 +854,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable { gap.first.moveInitializeAll( fromContentsOf: items._extracting(first: gap.first.count)) - + if let second = gap.second { assert(gap.first.count + second.count == items.count) second.moveInitializeAll( @@ -866,7 +862,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable { } return Range(uncheckedBounds: (count &- items.count, count)) } - + /// Prepends the elements of a buffer to the front of this deque, leaving the /// buffer uninitialized. /// @@ -886,7 +882,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable { gap.first.moveInitializeAll( fromContentsOf: items._extracting(first: gap.first.count)) - + if let second = gap.second { assert(gap.first.count + second.count == items.count) second.moveInitializeAll( @@ -911,7 +907,7 @@ extension _UnsafeDequeHandle { gap.initialize(copying: source) return Range(uncheckedBounds: (count &- source.count, count)) } - + /// Prepend the contents of `source` to this buffer. The buffer must have /// enough free capacity to insert the new elements. /// @@ -941,7 +937,7 @@ extension _UnsafeDequeHandle { self.count += c return it } - + @_alwaysEmitIntoClient @inline(__always) internal mutating func uncheckedPrepend>( @@ -1259,7 +1255,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable { if gapSize > 0 { _ = openGap(ofSize: gapSize, atOffset: newStart) } - + // With the prefix and suffix swapped, update the starting slot and // restore the count. startSlot = slot(startSlot, offsetBy: newStart - oldCount) @@ -1291,7 +1287,6 @@ extension _UnsafeDequeHandle where Element: ~Copyable { } } -#if compiler(>=6.2) @available(SwiftStdlib 5.0, *) extension _UnsafeDequeHandle where Element: ~Copyable { @_alwaysEmitIntoClient @@ -1302,7 +1297,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable { ) throws(E) -> Range { guard newItemCount > 0 else { return offset ..< offset } let gap = self.openGap(ofSize: newItemCount, atOffset: offset) - + var c = 0 defer { if c < newItemCount { @@ -1316,7 +1311,6 @@ extension _UnsafeDequeHandle where Element: ~Copyable { return Range(uncheckedBounds: (offset, offset &+ c)) } } -#endif extension _UnsafeDequeHandle { /// Insert all elements from `newElements` into this deque, starting at @@ -1355,7 +1349,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable { closeGap(offsets: Range(uncheckedBounds: (offset, offset + 1))) return result } - + @_alwaysEmitIntoClient @_transparent internal mutating func uncheckedRemoveFirst() -> Element { @@ -1365,7 +1359,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable { count -= 1 return result } - + @_alwaysEmitIntoClient @_transparent internal mutating func uncheckedRemoveLast() -> Element { @@ -1375,7 +1369,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable { count -= 1 return result } - + @_alwaysEmitIntoClient @_transparent internal mutating func uncheckedRemoveFirst(_ n: Int) { @@ -1386,7 +1380,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable { startSlot = slot(startSlot, offsetBy: n) count -= n } - + @_alwaysEmitIntoClient @_transparent internal mutating func uncheckedRemoveLast(_ n: Int) { @@ -1396,7 +1390,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable { target.deinitialize() count -= n } - + /// Remove all elements stored in this instance, deinitializing their storage. /// /// This method does not ensure that the storage buffer is uniquely @@ -1410,7 +1404,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable { count = 0 startSlot = .zero } - + /// Remove all elements in `bounds`, deinitializing their storage and sliding /// remaining elements to close the resulting gap. /// @@ -1420,7 +1414,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable { @_transparent internal mutating func uncheckedRemove(offsets bounds: Range) -> Int { assert(bounds.lowerBound >= 0 && bounds.upperBound <= self.count) - + // Deinitialize elements in `bounds`. mutableSegments(forOffsets: bounds).deinitialize() closeGap(offsets: bounds) @@ -1430,7 +1424,6 @@ extension _UnsafeDequeHandle where Element: ~Copyable { // MARK: Replacement -#if compiler(>=6.2) @available(SwiftStdlib 5.0, *) extension _UnsafeDequeHandle where Element: ~Copyable { @_alwaysEmitIntoClient @@ -1456,7 +1449,7 @@ extension _UnsafeDequeHandle where Element: ~Copyable { subrange.lowerBound, subrange.lowerBound &+ newItemCount)) let gap = self.mutableSegments(forOffsets: newRange) - + var c = 0 defer { if c < newItemCount { @@ -1519,4 +1512,3 @@ extension _UnsafeDequeHandle where Element: ~Copyable { } #endif } -#endif diff --git a/Sources/InternalCollectionsUtilities/LifetimeOverride.swift b/Sources/InternalCollectionsUtilities/LifetimeOverride.swift index 51f3a6c6..f9ad6aff 100644 --- a/Sources/InternalCollectionsUtilities/LifetimeOverride.swift +++ b/Sources/InternalCollectionsUtilities/LifetimeOverride.swift @@ -11,7 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) /// Unsafely discard any lifetime dependency on the `dependent` argument. /// Return a value identical to `dependent` with an immortal lifetime. @unsafe @@ -90,5 +89,3 @@ public func _overrideLifetime< >( _ dependent: inout T, borrowing source: borrowing U ) {} - -#endif diff --git a/Sources/InternalCollectionsUtilities/MutableSpan+Extras.swift b/Sources/InternalCollectionsUtilities/MutableSpan+Extras.swift index 5a6c8d4e..e5b440d3 100644 --- a/Sources/InternalCollectionsUtilities/MutableSpan+Extras.swift +++ b/Sources/InternalCollectionsUtilities/MutableSpan+Extras.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) extension MutableSpan where Element: ~Copyable { // FIXME: Replace with stdlib implementation when it becomes available @@ -146,5 +144,3 @@ extension MutableSpan /* where Element: Copyable */ { precondition(i == self.count) } } - -#endif diff --git a/Sources/InternalCollectionsUtilities/OutputSpan+Extras.swift b/Sources/InternalCollectionsUtilities/OutputSpan+Extras.swift index 7065c72d..0eb01bed 100644 --- a/Sources/InternalCollectionsUtilities/OutputSpan+Extras.swift +++ b/Sources/InternalCollectionsUtilities/OutputSpan+Extras.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - @available(SwiftStdlib 5.0, *) @_alwaysEmitIntoClient package func withTemporaryOutputSpan( @@ -168,6 +166,3 @@ extension OutputSpan where Element: ~Copyable { } } } - -#endif - diff --git a/Sources/InternalCollectionsUtilities/Span+Extras.swift b/Sources/InternalCollectionsUtilities/Span+Extras.swift index a4f61784..cb59b9f3 100644 --- a/Sources/InternalCollectionsUtilities/Span+Extras.swift +++ b/Sources/InternalCollectionsUtilities/Span+Extras.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - @_frozen @usableFromInline package struct _ShamSpanIterator { @@ -238,5 +236,3 @@ extension Span where Element: ~Copyable { } } #endif - -#endif diff --git a/Sources/InternalCollectionsUtilities/TemporaryAllocation.swift b/Sources/InternalCollectionsUtilities/TemporaryAllocation.swift index 70dd9b18..6cd82464 100644 --- a/Sources/InternalCollectionsUtilities/TemporaryAllocation.swift +++ b/Sources/InternalCollectionsUtilities/TemporaryAllocation.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - /// A polyfill of the typed-throws supporting `withUnsafeTemporaryAllocation` in the 6.3 stdlib. @_alwaysEmitIntoClient @_transparent package func _withUnsafeTemporaryAllocation< @@ -34,5 +32,3 @@ package func _withUnsafeTemporaryAllocation< return try r.get() #endif } - -#endif diff --git a/Sources/InternalCollectionsUtilities/UnsafeMutableBufferPointer+Extras.swift b/Sources/InternalCollectionsUtilities/UnsafeMutableBufferPointer+Extras.swift index 65b6cb44..61ea9fbb 100644 --- a/Sources/InternalCollectionsUtilities/UnsafeMutableBufferPointer+Extras.swift +++ b/Sources/InternalCollectionsUtilities/UnsafeMutableBufferPointer+Extras.swift @@ -214,7 +214,6 @@ extension UnsafeMutableBufferPointer { _initializePrefix(copying: UnsafeBufferPointer(source)) } -#if compiler(>=6.2) /// Initialize slots at the start of this buffer by copying data from `source`. /// /// If `Element` is not bitwise copyable, then the memory region addressed by `self` must be @@ -228,7 +227,6 @@ extension UnsafeMutableBufferPointer { package func _initializePrefix(copying source: Span) -> Int { source.withUnsafeBufferPointer { self._initializePrefix(copying: $0) } } -#endif /// Initialize slots at the start of this buffer by copying data from `buffer`, then /// shrink `self` to drop all initialized items from its front, leaving it addressing the @@ -244,7 +242,6 @@ extension UnsafeMutableBufferPointer { self = self.extracting(i...) } -#if compiler(>=6.2) /// Initialize slots at the start of this buffer by copying data from `span`, then /// shrink `self` to drop all initialized items from its front, leaving it addressing the /// uninitialized remainder. @@ -260,7 +257,6 @@ extension UnsafeMutableBufferPointer { self._initializeAndDropPrefix(copying: buffer) } } -#endif } extension UnsafeMutableBufferPointer { diff --git a/Sources/RopeModule/BigString/Basics/BigString+Builder.swift b/Sources/RopeModule/BigString/Basics/BigString+Builder.swift index c9f980c3..dead54a5 100644 --- a/Sources/RopeModule/BigString/Basics/BigString+Builder.swift +++ b/Sources/RopeModule/BigString/Basics/BigString+Builder.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -148,4 +148,4 @@ extension BigString.Builder { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Basics/BigString+Contents.swift b/Sources/RopeModule/BigString/Basics/BigString+Contents.swift index 07be13c0..c53cb7be 100644 --- a/Sources/RopeModule/BigString/Basics/BigString+Contents.swift +++ b/Sources/RopeModule/BigString/Basics/BigString+Contents.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -560,4 +560,4 @@ extension BigString { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Basics/BigString+Debugging.swift b/Sources/RopeModule/BigString/Basics/BigString+Debugging.swift index 6a516ac6..4b2f1a8f 100644 --- a/Sources/RopeModule/BigString/Basics/BigString+Debugging.swift +++ b/Sources/RopeModule/BigString/Basics/BigString+Debugging.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -20,4 +20,4 @@ extension BigString { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Basics/BigString+Index.swift b/Sources/RopeModule/BigString/Basics/BigString+Index.swift index 7ce00e42..3f6faed8 100644 --- a/Sources/RopeModule/BigString/Basics/BigString+Index.swift +++ b/Sources/RopeModule/BigString/Basics/BigString+Index.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -238,4 +238,4 @@ extension BigString { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Basics/BigString+Ingester.swift b/Sources/RopeModule/BigString/Basics/BigString+Ingester.swift index a1493fe8..2bca9819 100644 --- a/Sources/RopeModule/BigString/Basics/BigString+Ingester.swift +++ b/Sources/RopeModule/BigString/Basics/BigString+Ingester.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -172,4 +172,4 @@ extension BigString._Chunk { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Basics/BigString+Invariants.swift b/Sources/RopeModule/BigString/Basics/BigString+Invariants.swift index a1234621..5c579bbd 100644 --- a/Sources/RopeModule/BigString/Basics/BigString+Invariants.swift +++ b/Sources/RopeModule/BigString/Basics/BigString+Invariants.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -38,4 +38,4 @@ extension BigString { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Basics/BigString+Metrics.swift b/Sources/RopeModule/BigString/Basics/BigString+Metrics.swift index abcba84b..060bda4e 100644 --- a/Sources/RopeModule/BigString/Basics/BigString+Metrics.swift +++ b/Sources/RopeModule/BigString/Basics/BigString+Metrics.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) internal protocol _StringMetric: RopeMetric where Element == BigString._Chunk { @@ -296,4 +296,4 @@ extension BigString { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Basics/BigString+Summary.swift b/Sources/RopeModule/BigString/Basics/BigString+Summary.swift index f09e06bc..14e1d940 100644 --- a/Sources/RopeModule/BigString/Basics/BigString+Summary.swift +++ b/Sources/RopeModule/BigString/Basics/BigString+Summary.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -81,4 +81,4 @@ extension BigString.Summary: RopeSummary { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Basics/BigString.swift b/Sources/RopeModule/BigString/Basics/BigString.swift index b87abf75..dc335785 100644 --- a/Sources/RopeModule/BigString/Basics/BigString.swift +++ b/Sources/RopeModule/BigString/Basics/BigString.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded /// The core of a B-tree based String implementation. @available(SwiftStdlib 6.2, *) @@ -26,4 +26,4 @@ public struct BigString: Sendable { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded 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 b9d7e1e1..eb6b62f2 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Append and Insert.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Append and Insert.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString._Chunk { @@ -242,4 +242,4 @@ extension BigString._Chunk { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Breaks.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Breaks.swift index d33763d4..aeaf56b9 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Breaks.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Breaks.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString._Chunk { @@ -78,4 +78,4 @@ extension BigString._Chunk { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Character.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Character.swift index c179fa17..153d77a1 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Character.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Character.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString._Chunk { @@ -301,4 +301,4 @@ extension BigString._Chunk { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Counts.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Counts.swift index f9aa3338..f867fd79 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Counts.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Counts.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString._Chunk { @@ -151,4 +151,4 @@ extension BigString._Chunk.Counts { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Description.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Description.swift index d86f1d6c..c4564f09 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Description.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Description.swift @@ -15,7 +15,7 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString._Chunk: CustomStringConvertible { @@ -70,4 +70,4 @@ extension BigString._Chunk: CustomStringConvertible { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Index.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Index.swift index ef22fc38..3b9fbb4f 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Index.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Index.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString._Chunk { @@ -142,4 +142,4 @@ extension BigString._Chunk.Index: CustomStringConvertible { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+RopeElement.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+RopeElement.swift index 683fc26f..9d4a85e2 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+RopeElement.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+RopeElement.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString._Chunk: RopeElement { @@ -155,4 +155,4 @@ extension BigString._Chunk { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Splitting.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Splitting.swift index aea9261d..c8e27aca 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Splitting.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+Splitting.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString._Chunk { @@ -144,4 +144,4 @@ extension BigString._Chunk { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+UTF16.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+UTF16.swift index c5792a02..787bda0a 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+UTF16.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+UTF16.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString._Chunk { @@ -178,4 +178,4 @@ extension BigString._Chunk { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+UTF8.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+UTF8.swift index 8f767530..61a0b46f 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+UTF8.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+UTF8.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString._Chunk { @@ -25,4 +25,4 @@ extension BigString._Chunk { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+UnicodeScalar.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+UnicodeScalar.swift index 1d5fe7f1..6a52e954 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk+UnicodeScalar.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk+UnicodeScalar.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString._Chunk { @@ -139,4 +139,4 @@ extension BigString._Chunk { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Chunk/BigString+Chunk.swift b/Sources/RopeModule/BigString/Chunk/BigString+Chunk.swift index 8fb5e477..dab502c2 100644 --- a/Sources/RopeModule/BigString/Chunk/BigString+Chunk.swift +++ b/Sources/RopeModule/BigString/Chunk/BigString+Chunk.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -195,4 +195,4 @@ extension BigString._Chunk { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Conformances/BigString+BidirectionalCollection.swift b/Sources/RopeModule/BigString/Conformances/BigString+BidirectionalCollection.swift index 7923a3b3..72db4a34 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+BidirectionalCollection.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+BidirectionalCollection.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString: BidirectionalCollection { @@ -74,4 +74,4 @@ extension BigString { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Conformances/BigString+Comparable.swift b/Sources/RopeModule/BigString/Conformances/BigString+Comparable.swift index ba93181b..5cb595d3 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+Comparable.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+Comparable.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString: Comparable { @@ -38,4 +38,4 @@ extension BigString: Comparable { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Conformances/BigString+CustomDebugStringConvertible.swift b/Sources/RopeModule/BigString/Conformances/BigString+CustomDebugStringConvertible.swift index e24dd264..ca80353f 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+CustomDebugStringConvertible.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+CustomDebugStringConvertible.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString: CustomDebugStringConvertible { @@ -20,4 +20,4 @@ extension BigString: CustomDebugStringConvertible { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Conformances/BigString+CustomStringConvertible.swift b/Sources/RopeModule/BigString/Conformances/BigString+CustomStringConvertible.swift index b8645a52..90fab3ee 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+CustomStringConvertible.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+CustomStringConvertible.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString: CustomStringConvertible { @@ -20,4 +20,4 @@ extension BigString: CustomStringConvertible { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Conformances/BigString+Equatable.swift b/Sources/RopeModule/BigString/Conformances/BigString+Equatable.swift index 8d61e7e4..76e50d63 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+Equatable.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+Equatable.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -104,4 +104,4 @@ extension BigString { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Conformances/BigString+ExpressibleByStringLiteral.swift b/Sources/RopeModule/BigString/Conformances/BigString+ExpressibleByStringLiteral.swift index 35c3eb2e..429e7efc 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+ExpressibleByStringLiteral.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+ExpressibleByStringLiteral.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString: ExpressibleByStringLiteral { @@ -20,4 +20,4 @@ extension BigString: ExpressibleByStringLiteral { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Conformances/BigString+Hashing.swift b/Sources/RopeModule/BigString/Conformances/BigString+Hashing.swift index b6b438ec..0cf8d3c0 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+Hashing.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+Hashing.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString: Hashable { @@ -54,4 +54,4 @@ extension BigString { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Conformances/BigString+LosslessStringConvertible.swift b/Sources/RopeModule/BigString/Conformances/BigString+LosslessStringConvertible.swift index 6c26a75b..262f2fad 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+LosslessStringConvertible.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+LosslessStringConvertible.swift @@ -11,11 +11,11 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString: LosslessStringConvertible { // init?(_: String) is implemented by RangeReplaceableCollection.init(_:) } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Conformances/BigString+RangeReplaceableCollection.swift b/Sources/RopeModule/BigString/Conformances/BigString+RangeReplaceableCollection.swift index 6bc0ae1f..ca9e7c1b 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+RangeReplaceableCollection.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+RangeReplaceableCollection.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded #if !COLLECTIONS_SINGLE_MODULE import InternalCollectionsUtilities @@ -221,4 +221,4 @@ extension BigString: RangeReplaceableCollection { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Conformances/BigString+Sequence.swift b/Sources/RopeModule/BigString/Conformances/BigString+Sequence.swift index f9101195..ef3097b1 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+Sequence.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+Sequence.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString: Sequence { @@ -234,4 +234,4 @@ extension BigString.Iterator { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Conformances/BigString+TextOutputStream.swift b/Sources/RopeModule/BigString/Conformances/BigString+TextOutputStream.swift index 466e2b2a..b46d9bfb 100644 --- a/Sources/RopeModule/BigString/Conformances/BigString+TextOutputStream.swift +++ b/Sources/RopeModule/BigString/Conformances/BigString+TextOutputStream.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString: TextOutputStream { @@ -33,4 +33,4 @@ extension BigString: TextOutputStreamable { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Operations/BigString+Append.swift b/Sources/RopeModule/BigString/Operations/BigString+Append.swift index 04fa89d4..53f4df34 100644 --- a/Sources/RopeModule/BigString/Operations/BigString+Append.swift +++ b/Sources/RopeModule/BigString/Operations/BigString+Append.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -197,4 +197,4 @@ extension BigString { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Operations/BigString+Initializers.swift b/Sources/RopeModule/BigString/Operations/BigString+Initializers.swift index c7a5e33e..0844eecb 100644 --- a/Sources/RopeModule/BigString/Operations/BigString+Initializers.swift +++ b/Sources/RopeModule/BigString/Operations/BigString+Initializers.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -163,4 +163,4 @@ extension String { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Operations/BigString+Insert.swift b/Sources/RopeModule/BigString/Operations/BigString+Insert.swift index f21b9b0f..58a72156 100644 --- a/Sources/RopeModule/BigString/Operations/BigString+Insert.swift +++ b/Sources/RopeModule/BigString/Operations/BigString+Insert.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -99,4 +99,4 @@ extension BigString { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Operations/BigString+Managing Breaks.swift b/Sources/RopeModule/BigString/Operations/BigString+Managing Breaks.swift index c788fe5e..d6e7a0db 100644 --- a/Sources/RopeModule/BigString/Operations/BigString+Managing Breaks.swift +++ b/Sources/RopeModule/BigString/Operations/BigString+Managing Breaks.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -275,4 +275,4 @@ extension BigString._Chunk { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Operations/BigString+RemoveSubrange.swift b/Sources/RopeModule/BigString/Operations/BigString+RemoveSubrange.swift index d8a1b28f..9e02c65f 100644 --- a/Sources/RopeModule/BigString/Operations/BigString+RemoveSubrange.swift +++ b/Sources/RopeModule/BigString/Operations/BigString+RemoveSubrange.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -47,4 +47,4 @@ extension BigString { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Operations/BigString+ReplaceSubrange.swift b/Sources/RopeModule/BigString/Operations/BigString+ReplaceSubrange.swift index ed75a9e0..e4ace0e5 100644 --- a/Sources/RopeModule/BigString/Operations/BigString+ReplaceSubrange.swift +++ b/Sources/RopeModule/BigString/Operations/BigString+ReplaceSubrange.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -87,4 +87,4 @@ extension BigString { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Operations/BigString+Split.swift b/Sources/RopeModule/BigString/Operations/BigString+Split.swift index 666844f6..18b6b3f7 100644 --- a/Sources/RopeModule/BigString/Operations/BigString+Split.swift +++ b/Sources/RopeModule/BigString/Operations/BigString+Split.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -41,4 +41,4 @@ extension BigString { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Operations/Range+BigString.swift b/Sources/RopeModule/BigString/Operations/Range+BigString.swift index 7d1c1f90..56b13222 100644 --- a/Sources/RopeModule/BigString/Operations/Range+BigString.swift +++ b/Sources/RopeModule/BigString/Operations/Range+BigString.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension Range { @@ -20,4 +20,4 @@ extension Range { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Views/BigString+UTF16View.swift b/Sources/RopeModule/BigString/Views/BigString+UTF16View.swift index 8d22b5f9..57f47d67 100644 --- a/Sources/RopeModule/BigString/Views/BigString+UTF16View.swift +++ b/Sources/RopeModule/BigString/Views/BigString+UTF16View.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -151,4 +151,4 @@ extension BigString.UTF16View { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Views/BigString+UTF8View.swift b/Sources/RopeModule/BigString/Views/BigString+UTF8View.swift index 00670bac..46a9bb20 100644 --- a/Sources/RopeModule/BigString/Views/BigString+UTF8View.swift +++ b/Sources/RopeModule/BigString/Views/BigString+UTF8View.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigString { @@ -187,4 +187,4 @@ extension BigString.UTF8View { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Views/BigString+UnicodeScalarView.swift b/Sources/RopeModule/BigString/Views/BigString+UnicodeScalarView.swift index fcf7d305..7fd4647e 100644 --- a/Sources/RopeModule/BigString/Views/BigString+UnicodeScalarView.swift +++ b/Sources/RopeModule/BigString/Views/BigString+UnicodeScalarView.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded #if !COLLECTIONS_SINGLE_MODULE import InternalCollectionsUtilities @@ -397,4 +397,4 @@ extension BigString.UnicodeScalarView: RangeReplaceableCollection { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Views/BigSubstring+UTF16View.swift b/Sources/RopeModule/BigString/Views/BigSubstring+UTF16View.swift index 323c30b7..3a18ecca 100644 --- a/Sources/RopeModule/BigString/Views/BigSubstring+UTF16View.swift +++ b/Sources/RopeModule/BigString/Views/BigSubstring+UTF16View.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigSubstring { @@ -204,4 +204,4 @@ extension BigSubstring.UTF16View { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Views/BigSubstring+UTF8View.swift b/Sources/RopeModule/BigString/Views/BigSubstring+UTF8View.swift index 583fe46c..381a5088 100644 --- a/Sources/RopeModule/BigString/Views/BigSubstring+UTF8View.swift +++ b/Sources/RopeModule/BigString/Views/BigSubstring+UTF8View.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigSubstring { @@ -176,4 +176,4 @@ extension BigSubstring.UTF8View { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Views/BigSubstring+UnicodeScalarView.swift b/Sources/RopeModule/BigString/Views/BigSubstring+UnicodeScalarView.swift index 2978718e..dbace149 100644 --- a/Sources/RopeModule/BigString/Views/BigSubstring+UnicodeScalarView.swift +++ b/Sources/RopeModule/BigString/Views/BigSubstring+UnicodeScalarView.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) extension BigSubstring { @@ -323,4 +323,4 @@ extension BigSubstring.UnicodeScalarView: RangeReplaceableCollection { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/BigString/Views/BigSubstring.swift b/Sources/RopeModule/BigString/Views/BigSubstring.swift index af5eadc3..a23cf55a 100644 --- a/Sources/RopeModule/BigString/Views/BigSubstring.swift +++ b/Sources/RopeModule/BigString/Views/BigSubstring.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) public struct BigSubstring: Sendable { @@ -362,4 +362,4 @@ extension BigSubstring: RangeReplaceableCollection { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/Utilities/String Utilities.swift b/Sources/RopeModule/Utilities/String Utilities.swift index 8d0d4d03..4f53b19e 100644 --- a/Sources/RopeModule/Utilities/String Utilities.swift +++ b/Sources/RopeModule/Utilities/String Utilities.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded extension StringProtocol { @inline(__always) @@ -133,4 +133,4 @@ extension String { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/RopeModule/Utilities/_CharacterRecognizer.swift b/Sources/RopeModule/Utilities/_CharacterRecognizer.swift index 694d773b..dac1d3c7 100644 --- a/Sources/RopeModule/Utilities/_CharacterRecognizer.swift +++ b/Sources/RopeModule/Utilities/_CharacterRecognizer.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && !$Embedded +#if !$Embedded @available(SwiftStdlib 6.2, *) internal typealias _CharacterRecognizer = Unicode._CharacterRecognizer @@ -197,4 +197,4 @@ extension _CharacterRecognizer { } } -#endif // compiler(>=6.2) && !$Embedded +#endif // !$Embedded diff --git a/Sources/SpanPreview/InputSpan.swift b/Sources/SpanPreview/InputSpan.swift index 73ad5eeb..5e3e118a 100644 --- a/Sources/SpanPreview/InputSpan.swift +++ b/Sources/SpanPreview/InputSpan.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && UnstableContainersPreview +#if UnstableContainersPreview #if !COLLECTIONS_SINGLE_MODULE import InternalCollectionsUtilities diff --git a/Sources/SpanPreview/OutputSpan+InputSpanHelpers.swift b/Sources/SpanPreview/OutputSpan+InputSpanHelpers.swift index a469db9e..4d543b9f 100644 --- a/Sources/SpanPreview/OutputSpan+InputSpanHelpers.swift +++ b/Sources/SpanPreview/OutputSpan+InputSpanHelpers.swift @@ -15,7 +15,7 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) && UnstableContainersPreview +#if UnstableContainersPreview @available(SwiftStdlib 5.0, *) extension OutputSpan where Element: ~Copyable { @inlinable diff --git a/Sources/TrailingElementsModule/TrailingArray.swift b/Sources/TrailingElementsModule/TrailingArray.swift index 021e0145..46b74f6a 100644 --- a/Sources/TrailingElementsModule/TrailingArray.swift +++ b/Sources/TrailingElementsModule/TrailingArray.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - /// A value that manages a contiguous block of memory starting with a header /// value and then followed by a contiguous array of elements. Values of this /// type own the underlying memory, and are non-copyable to ensure that @@ -30,16 +28,16 @@ where Header: ~Copyable /// of the Header and we have overallocated to compensate. @usableFromInline var _storage: UnsafeMutableRawPointer - + /// Pointer to the header. @_alwaysEmitIntoClient var _pointer: UnsafeMutablePointer
{ Self.headerPointer(fromStorage: _storage) } - + /// The element type stored within the buffer. public typealias Element = Header.Element - + /// Allocate storage and initialize only the header, leaving the trailing /// elements uninitialized. This is private because it can compromise /// memory safety. @@ -50,10 +48,10 @@ where Header: ~Copyable byteCount: bytes, alignment: alignment ) - + _pointer.initialize(to: header) } - + @available(SwiftStdlib 5.1, *) @_alwaysEmitIntoClient mutating func _initializeTrailingElements( @@ -64,7 +62,7 @@ where Header: ~Copyable let initialized = unsafe output.finalize(for: rawElements) precondition(count == initialized, "TrailingArray initialization underflow") } - + /// Allocate an intrusive managed buffer with the given header and calling /// the initializer to fill in the trailing elements. @available(SwiftStdlib 5.1, *) @@ -76,7 +74,7 @@ where Header: ~Copyable self.init(_headerOnly: header) try _initializeTrailingElements(initializer: initializer) } - + /// Allocate an intrusive managed buffer with the given header and /// initializing each trailing element with the given `element`. @_alwaysEmitIntoClient @@ -84,7 +82,7 @@ where Header: ~Copyable self.init(_headerOnly: header) rawElements.initialize(repeating: element) } - + /// Deinitialize each of the trailing elements, then the header, then /// deallocate the underlying storage. @_alwaysEmitIntoClient @@ -93,7 +91,7 @@ where Header: ~Copyable _pointer.deinitialize(count: 1) _storage.deallocate() } - + /// Take ownership over a pointer to memory containing the header followed /// by the trailing elements. /// @@ -117,7 +115,7 @@ where Header: ~Copyable "header pointer does not account for the alignment of the elements" ) } - + /// Return the pointer to the underlying memory, including ownership over /// that memory. The underlying storage will not be freed by this buffer; /// it is the responsibility of the caller. The header pointer and @@ -133,35 +131,35 @@ where Header: ~Copyable discard self return (pointer, storage) } - + /// Access the header portion of the buffer. @_alwaysEmitIntoClient public var header: Header { unsafeAddress { UnsafePointer(_pointer) } - + unsafeMutableAddress { _pointer } } - + /// The number of trailing elements in the value. @_alwaysEmitIntoClient public var count: Int { header.trailingCount } - + /// Starting index for accessing the trailing elements. Always 0 @_alwaysEmitIntoClient public var startIndex: Int { 0 } - + /// Ending index for accessing the trailing elements. Always `count`. @_alwaysEmitIntoClient public var endIndex: Int { count } - + /// Indices covering all of the trailing elements. Always `0.. { 0.. Element { @@ -169,13 +167,13 @@ where Header: ~Copyable precondition(index >= 0 && index < count) return rawElements[index] } - + set { precondition(index >= 0 && index < count) rawElements[index] = newValue } } - + /// Access the flexible array elements. @_alwaysEmitIntoClient var rawElements: UnsafeMutableBufferPointer { @@ -185,7 +183,7 @@ where Header: ~Copyable count: header.trailingCount ) } - + /// Accesses the trailing elements following the header. @available(SwiftStdlib 5.1, *) @_alwaysEmitIntoClient @@ -195,7 +193,7 @@ where Header: ~Copyable _overrideLifetime(rawElements.span, borrowing: self) } } - + /// Accesses the trailing elements following the header, allowing mutation /// of those elements. @available(SwiftStdlib 5.1, *) @@ -207,7 +205,7 @@ where Header: ~Copyable return _overrideLifetime(elements, mutating: &self) } } - + /// Execute the given closure, providing it with an unsafe buffer pointer /// referencing the header. @_alwaysEmitIntoClient @@ -216,7 +214,7 @@ where Header: ~Copyable ) throws(E) -> R { return try body(_pointer) } - + /// Execute the given closure, providing it with an unsafe buffer pointer /// referencing the trailing elements. @_alwaysEmitIntoClient @@ -225,7 +223,7 @@ where Header: ~Copyable ) throws(E) -> R { return try body(rawElements) } - + /// Execute the given closure, providing it with unsafe pointers to the /// header and trailing elements, respectively. @_alwaysEmitIntoClient @@ -234,7 +232,7 @@ where Header: ~Copyable ) throws(E) -> R { return try body(_pointer, rawElements) } - + /// Determine the allocation size and alignment needed for the given header /// value along with its trailing elements. /// @@ -246,16 +244,16 @@ where Header: ~Copyable // The number of bytes needed to contain the header and elements, // assuming that there are no alignment issues. let numBytes = MemoryLayout
.stride + MemoryLayout.stride * header.trailingCount - + let headerAlignment = MemoryLayout
.alignment let elementAlignment = MemoryLayout.alignment - + // If the header provides sufficient alignment for the elements, // we're done. if elementAlignment <= headerAlignment { return (numBytes, MemoryLayout
.alignment) } - + // We may have to slide an allocation by up to the difference between // the element and header alignments to ensure that the elements are // appropriately aligned. @@ -263,20 +261,20 @@ where Header: ~Copyable numBytes + elementAlignment - headerAlignment, MemoryLayout.alignment) } - + /// Given storage that is large enough to accommodate padding + the header /// + the elements, return the header pointer from the storage pointer. @_alwaysEmitIntoClient static func headerPointer(fromStorage storage: UnsafeMutableRawPointer) -> UnsafeMutablePointer
{ let headerAlignment = MemoryLayout
.alignment let elementAlignment = MemoryLayout.alignment - + // Normal case: the header has sufficient alignment to include the // elements, so the storage refers directly to the header. if elementAlignment <= headerAlignment { return storage.assumingMemoryBound(to: Header.self) } - + // The header is stored right before the elements, with padding bytes // between the start of the allocation and up to the header. return storage.advanced(by: MemoryLayout
.stride) @@ -315,7 +313,7 @@ extension TrailingArray where Header: Copyable { return try body(&value) } } - + /// Create a temporary intrusive managed buffer for the given header, whose /// trailing elements are initialized with the given `initializer` function. /// That instance is provided to the given `body` to operate on for the @@ -351,7 +349,7 @@ extension TrailingArray { body: (inout TrailingArray
) throws(E) -> R ) throws(E) -> R { let (numBytes, alignment) = allocationSize(header: header) - + // Allocate temporary storage large enough for the value we need. let result: Result = withUnsafeTemporaryAllocation( byteCount: numBytes, @@ -361,7 +359,7 @@ extension TrailingArray { let storagePointer = buffer.baseAddress! let headerPointer = TrailingArray.headerPointer(fromStorage: storagePointer) headerPointer.initialize(to: header) - + /// Create a trailing array over that temporary storage. var managedBuffer = TrailingArray(consuming: headerPointer, storage: storagePointer) @@ -371,19 +369,19 @@ extension TrailingArray { } catch { resultOrError = .failure(error) } - + // Deinitialize the elements and header. managedBuffer.rawElements.deinitialize() managedBuffer._pointer.deinitialize(count: 1) - + // Tell the trailing buffer not to free the storage. let (finalPointer, finalStorage) = managedBuffer.leakStorage() precondition(finalPointer == headerPointer) precondition(finalStorage == storagePointer) - + return resultOrError } - + return try result.get() } } @@ -408,5 +406,3 @@ extension TrailingArray where Header.Element: BitwiseCopyable { } } } - -#endif diff --git a/Sources/TrailingElementsModule/TrailingElements.swift b/Sources/TrailingElementsModule/TrailingElements.swift index b6aad2bd..649f8884 100644 --- a/Sources/TrailingElementsModule/TrailingElements.swift +++ b/Sources/TrailingElementsModule/TrailingElements.swift @@ -11,17 +11,13 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - /// Describes a type that has some number of elements following it directly /// in memory. Such types are generally used with the `TrailingArray` /// type, which manages storage for the header and its trailing elements. public protocol TrailingElements: ~Copyable { /// The element type of the data that follows the header in memory. associatedtype Element - + /// The number of elements following the header. var trailingCount: Int { get } } - -#endif diff --git a/Sources/TrailingElementsModule/TrailingPadding.swift b/Sources/TrailingElementsModule/TrailingPadding.swift index 72a2105d..eac52f0c 100644 --- a/Sources/TrailingElementsModule/TrailingPadding.swift +++ b/Sources/TrailingElementsModule/TrailingPadding.swift @@ -11,8 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) - /// Represents memory containing a header value followed by some extra padding /// following it. Values of this type own the underlying memory, and are /// non-copyable to ensure that ownership of that memory is unique. Memory @@ -33,7 +31,7 @@ public struct TrailingPadding: ~Copyable { /// Pointer to the header, followed by the padding. @usableFromInline let _pointer: UnsafeMutablePointer
- + /// Create a new instance with the given header and total size. The total /// size includes the storage for the header itself, so it must be at least /// as large as the header. @@ -46,7 +44,7 @@ public struct TrailingPadding: ~Copyable { .assumingMemoryBound(to: Header.self) _pointer.initialize(to: header) } - + /// Take ownership over a pointer to memory containing the header followed /// by the trailing elements. /// @@ -56,26 +54,26 @@ public struct TrailingPadding: ~Copyable { public init(consuming pointer: UnsafeMutablePointer
) { self._pointer = pointer } - + /// Deinitializes the header, then deallocates the underlying memory. @_alwaysEmitIntoClient deinit { _pointer.deinitialize(count: 1) _pointer.deallocate() } - + /// Access the header portion of the value. @_alwaysEmitIntoClient public var header: Header { unsafeAddress { UnsafePointer(_pointer) } - + unsafeMutableAddress { _pointer } } - + /// Executes the given closure with the pointer to the header itself. @_alwaysEmitIntoClient public func withUnsafeMutablePointerToHeader( @@ -83,7 +81,7 @@ public struct TrailingPadding: ~Copyable { ) throws(E) -> R { return try body(_pointer) } - + /// Take ownership over the stored memory, returning its pointer. The /// underlying storage will not be freed by the `TrailingPadding` instance, /// as it is the responsibility of the caller. @@ -112,7 +110,7 @@ extension TrailingPadding where Header: Copyable { ) throws(E) -> R { precondition(size >= MemoryLayout
.size, "must allocate enough storage for the underlying stored type") - + // Allocate temporary storage large enough for the value we need. let result: Result = withUnsafeTemporaryAllocation( byteCount: size, @@ -122,26 +120,24 @@ extension TrailingPadding where Header: Copyable { let pointer = buffer.baseAddress!.assumingMemoryBound(to: Header.self) pointer.initialize(to: header) var tailAllocated = TrailingPadding(consuming: pointer) - + do throws(E) { let result = try body(&tailAllocated) - + // Tell the tail-allocated buffer not to free the storage. let finalPointer = tailAllocated.leakStorage() precondition(finalPointer == pointer) - + return .success(result) } catch { // Tell the tail-allocated buffer not to free the storage. let finalPointer = tailAllocated.leakStorage() precondition(finalPointer == pointer) - + return .failure(error) } } - + return try result.get() } } - -#endif diff --git a/Tests/BasicContainersTests/ArrayLayout.swift b/Tests/BasicContainersTests/ArrayLayout.swift index 2523ef91..e95ac66c 100644 --- a/Tests/BasicContainersTests/ArrayLayout.swift +++ b/Tests/BasicContainersTests/ArrayLayout.swift @@ -30,7 +30,7 @@ struct ArrayLayout { self.capacity = capacity self.count = count } - + var isFull: Bool { count == capacity } var isEmpty: Bool { count == 0 } var freeCapacity: Int { capacity - count } @@ -74,7 +74,6 @@ func withSomeArrayLayouts( } } -#if compiler(>=6.2) extension RigidArray where Element: ~Copyable { init(layout: ArrayLayout, using generator: (Int) -> Element) { self.init(capacity: layout.capacity) { span in @@ -98,7 +97,7 @@ extension LifetimeTracker { ) -> RigidArray> { RigidArray(layout: layout, using: { self.instance(for: generator($0)) }) } - + func uniqueArray( layout: ArrayLayout, using generator: (Int) -> Element = { $0 } @@ -108,7 +107,7 @@ extension LifetimeTracker { } return UniqueArray(consuming: contents) } - + #if UnstableContainersPreview func withInputSpan( layout: ArrayLayout, @@ -128,7 +127,7 @@ extension LifetimeTracker { buffer.deallocate() } #endif - + func withOutputSpan( layout: ArrayLayout, using generator: (Int) -> Element, @@ -140,4 +139,3 @@ extension LifetimeTracker { contents.edit(body) } } -#endif diff --git a/Tests/BasicContainersTests/RigidArrayTests.swift b/Tests/BasicContainersTests/RigidArrayTests.swift index 8982eb7b..172325f6 100644 --- a/Tests/BasicContainersTests/RigidArrayTests.swift +++ b/Tests/BasicContainersTests/RigidArrayTests.swift @@ -21,8 +21,6 @@ import ContainersPreview import BasicContainers #endif -#if compiler(>=6.2) - /// Check if `left` and `right` contain equal elements in the same order. @available(SwiftStdlib 5.0, *) internal func expectRigidArrayContents< @@ -1528,4 +1526,3 @@ class RigidArrayTests: CollectionTestCase { } #endif } -#endif diff --git a/Tests/BasicContainersTests/UniqueArrayTests.swift b/Tests/BasicContainersTests/UniqueArrayTests.swift index 6d2e8264..def99899 100644 --- a/Tests/BasicContainersTests/UniqueArrayTests.swift +++ b/Tests/BasicContainersTests/UniqueArrayTests.swift @@ -20,8 +20,6 @@ import InternalCollectionsUtilities import BasicContainers #endif -#if compiler(>=6.2) - /// Check if `left` and `right` contain equal elements in the same order. @available(SwiftStdlib 5.0, *) public func expectUniqueArrayContents< @@ -1056,4 +1054,3 @@ class UniqueArrayTests: CollectionTestCase { #endif #endif } -#endif diff --git a/Tests/ContainersTests/UniqueBoxTests.swift b/Tests/ContainersTests/UniqueBoxTests.swift index 32c25ba7..164458f7 100644 --- a/Tests/ContainersTests/UniqueBoxTests.swift +++ b/Tests/ContainersTests/UniqueBoxTests.swift @@ -21,7 +21,6 @@ import _CollectionsTestSupport import ContainersPreview #endif -#if compiler(>=6.2) final class UniqueBoxTests: CollectionTestCase { struct NoncopyablePayload: ~Copyable { var value: Int @@ -298,5 +297,3 @@ final class UniqueBoxTests: CollectionTestCase { #endif } #endif - -#endif diff --git a/Tests/DequeTests/DequeInternals.swift b/Tests/DequeTests/DequeInternals.swift index 909ecc1f..dba7519a 100644 --- a/Tests/DequeTests/DequeInternals.swift +++ b/Tests/DequeTests/DequeInternals.swift @@ -18,21 +18,20 @@ import _CollectionsTestSupport @_spi(Testing) import DequeModule #endif -#if compiler(>=6.2) @available(SwiftStdlib 5.0, *) internal struct RigidTestData: ~Copyable { var deque: RigidDeque var contents: [Element] - + init(_ deque: consuming RigidDeque, _ contents: [Element]) { self.deque = deque self.contents = contents } - + mutating func take() -> RigidDeque { exchange(&self.deque, with: .init()) } - + consuming func consume() -> RigidDeque { exchange(&self.deque, with: .init()) } @@ -42,7 +41,7 @@ internal struct RigidTestData: ~Copyable { internal struct UniqueTestData: ~Copyable { var deque: UniqueDeque var contents: [Element] - + init(_ deque: consuming RigidDeque, _ contents: [Element]) { self.init(UniqueDeque(consuming: deque), contents) } @@ -52,7 +51,6 @@ internal struct UniqueTestData: ~Copyable { self.contents = contents } } -#endif internal struct DequeLayout: Hashable, CustomStringConvertible { let capacity: Int @@ -91,7 +89,6 @@ extension Deque { } } -#if compiler(>=6.2) @available(SwiftStdlib 5.0, *) extension RigidDeque { init(layout: DequeLayout, contents: C) where C.Element == Element { @@ -99,7 +96,6 @@ extension RigidDeque { self.init(_capacity: layout.capacity, startSlot: layout.startSlot, copying: contents) } } -#endif extension LifetimeTracker { func deque( @@ -109,8 +105,7 @@ extension LifetimeTracker { let deque = Deque(layout: layout, contents: contents) return (deque, contents) } - -#if compiler(>=6.2) + @available(SwiftStdlib 5.0, *) func rigidDeque( with layout: DequeLayout @@ -119,7 +114,7 @@ extension LifetimeTracker { let deque = RigidDeque(layout: layout, contents: contents) return RigidTestData(deque, contents) } - + @available(SwiftStdlib 5.0, *) func uniqueDeque( with layout: DequeLayout @@ -128,7 +123,6 @@ extension LifetimeTracker { let deque = RigidDeque(layout: layout, contents: contents) return UniqueTestData(deque, contents) } -#endif } func withEveryDeque( diff --git a/Tests/DequeTests/RigidDequeCrashTests.swift b/Tests/DequeTests/RigidDequeCrashTests.swift index 2151213c..5887f839 100644 --- a/Tests/DequeTests/RigidDequeCrashTests.swift +++ b/Tests/DequeTests/RigidDequeCrashTests.swift @@ -19,37 +19,36 @@ import DequeModule import ContainersPreview #endif -#if compiler(>=6.2) #if !os(Android) // Exit tests are not available on this platform @Suite("RigidDeque Crash Tests") struct RigidDequeCrashTests { - + // MARK: - Edge Cases and Error Conditions - + @Test("Append to full deque fails") func appendToFullDequeFails() async { await #expect(processExitsWith: .failure) { var deque = RigidDeque(capacity: 2) deque.append(1) deque.append(2) - + #expect(deque.isFull == true) deque.append(3) // Traps with "RigidDeque is full" } } - + @Test("Prepend to full deque fails") func prependToFullDequeFails() async { await #expect(processExitsWith: .failure) { var deque = RigidDeque(capacity: 2) deque.append(1) deque.append(2) - + #expect(deque.isFull == true) deque.prepend(0) // Traps with "RigidDeque is full" } } - + @Test("Invalid index access") func invalidIndexAccess() async { await #expect(processExitsWith: .failure) { @@ -67,7 +66,7 @@ struct RigidDequeCrashTests { } #endif } - + @Test("Remove from empty deque") func removeFromEmptyDeque() async { await #expect(processExitsWith: .failure) { @@ -109,4 +108,3 @@ struct RigidDequeCrashTests { } } #endif -#endif diff --git a/Tests/DequeTests/RigidDequeTests.swift b/Tests/DequeTests/RigidDequeTests.swift index 64974716..73797dac 100644 --- a/Tests/DequeTests/RigidDequeTests.swift +++ b/Tests/DequeTests/RigidDequeTests.swift @@ -22,7 +22,6 @@ import BasicContainers import ContainersPreview #endif -#if compiler(>=6.2) /// Check if `left` and `right` contain equal elements in the same order. @available(SwiftStdlib 5.0, *) internal func expectRigidDequeContents< @@ -1624,4 +1623,3 @@ final class RigidDequeTests: CollectionTestCase { } #endif } -#endif diff --git a/Tests/DequeTests/UniqueDequeTests.swift b/Tests/DequeTests/UniqueDequeTests.swift index 40e6dc2d..6127a7db 100644 --- a/Tests/DequeTests/UniqueDequeTests.swift +++ b/Tests/DequeTests/UniqueDequeTests.swift @@ -21,7 +21,6 @@ import BasicContainers import ContainersPreview #endif -#if compiler(>=6.2) /// Check if `left` and `right` contain equal elements in the same order. @available(SwiftStdlib 5.0, *) internal func expectUniqueDequeContents< @@ -116,7 +115,7 @@ final class UniqueDequeTests: CollectionTestCase { let value: Int init(_ value: Int) { self.value = value } } - + #if compiler(>=6.4) && UnstableContainersPreview @available(SwiftStdlib 6.4, *) func test_validate_Container() { @@ -132,7 +131,7 @@ final class UniqueDequeTests: CollectionTestCase { func test_basicProperties() { var deque = UniqueDeque() - + // Empty deque expectEqual(deque.isEmpty, true) expectEqual(deque._isFull, true) @@ -142,11 +141,11 @@ final class UniqueDequeTests: CollectionTestCase { expectEqual(deque.startIndex, 0) expectEqual(deque.endIndex, 0) expectEqual(deque.indices, 0 ..< 0) - + deque.append(1) deque.append(2) deque.append(3) - + expectEqual(deque.isEmpty, false) expectEqual(deque._isFull, true) expectEqual(deque.count, 3) @@ -155,18 +154,18 @@ final class UniqueDequeTests: CollectionTestCase { expectEqual(deque.startIndex, 0) expectEqual(deque.endIndex, 3) expectEqual(deque.indices, 0 ..< 3) - + for i in 4...10 { deque.prepend(i) } - + expectEqual(deque.isEmpty, false) expectEqual(deque.count, 10) expectEqual(deque.capacity, 12) expectEqual(deque.freeCapacity, 2) expectEqual(deque.indices, 0 ..< 10) } - + func test_subscriptBorrow() { withEveryDeque("layout", ofCapacities: [0, 1, 2, 3, 5, 10]) { layout in withLifetimeTracking { tracker in @@ -177,7 +176,7 @@ final class UniqueDequeTests: CollectionTestCase { } } } - + func test_subscriptMutate() { withEveryDeque("layout", ofCapacities: [0, 1, 2, 3, 5, 10]) { layout in withEvery("i", in: 0 ..< layout.count) { i in @@ -191,7 +190,7 @@ final class UniqueDequeTests: CollectionTestCase { } } } - + func test_swapAt() { withEveryDeque("layout", ofCapacities: [0, 1, 2, 3, 5]) { layout in withEvery("i", in: 0 ..< layout.count) { i in @@ -244,5 +243,3 @@ final class UniqueDequeTests: CollectionTestCase { expectEqualElements(actualCapacities.sorted(), expectedCapacities) } } - -#endif diff --git a/Tests/RopeModuleTests/TestBigString.swift b/Tests/RopeModuleTests/TestBigString.swift index 7ef34a57..dec41cd5 100644 --- a/Tests/RopeModuleTests/TestBigString.swift +++ b/Tests/RopeModuleTests/TestBigString.swift @@ -11,7 +11,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) @preconcurrency import XCTest #if COLLECTIONS_SINGLE_MODULE import Collections @@ -1159,5 +1158,3 @@ class TestBigString: CollectionTestCase { } } } - -#endif // compiler(>=6.2) diff --git a/Tests/SpanPreviewTests/InputSpanTests.swift b/Tests/SpanPreviewTests/InputSpanTests.swift index b2eff527..b2e8fb2d 100644 --- a/Tests/SpanPreviewTests/InputSpanTests.swift +++ b/Tests/SpanPreviewTests/InputSpanTests.swift @@ -18,11 +18,11 @@ import _CollectionsTestSupport import SpanPreview #endif -#if compiler(>=6.2) && UnstableContainersPreview +#if UnstableContainersPreview final class InputSpanTests: CollectionTestCase { // FIXME func test_dummy() { - + } } #endif diff --git a/Tests/TrailingElementsTests/TrailingElementsTests.swift b/Tests/TrailingElementsTests/TrailingElementsTests.swift index 833ec5da..9546468c 100644 --- a/Tests/TrailingElementsTests/TrailingElementsTests.swift +++ b/Tests/TrailingElementsTests/TrailingElementsTests.swift @@ -19,8 +19,6 @@ import Collections import TrailingElementsModule #endif -#if compiler(>=6.2) - struct Point { var x: Int var y: Int @@ -37,11 +35,11 @@ extension Coordinates: TrailingElements { struct OneByteWithPointers: TrailingElements { var byte: UInt8 - + init(count: Int) { self.byte = UInt8(count) } - + typealias Element = OpaquePointer var trailingCount: Int { Int(byte) } } @@ -51,12 +49,12 @@ struct ManyBytesWithPointers: TrailingElements { UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8) - + init(count: Int) { self.bytes = ( UInt8(count), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) } - + typealias Element = OpaquePointer var trailingCount: Int { Int(bytes.0) } } @@ -71,29 +69,29 @@ struct TrailingElementsTests { outputSpan.append(Point(x: 2, y: 3)) outputSpan.append(Point(x: 3, y: 4)) } - + #expect(coords[0].x == 1) #expect(coords[1].x == 2) #expect(coords[2].x == 3) - + coords[1].y = 17 #expect(coords[1].y == 17) } - + @Test func repeatingInit() { var coords = TrailingArray( header: Coordinates(numCoordinates: 3), repeating: Point(x: 1, y: 1)) - + #expect(coords[0].x == 1) #expect(coords[1].x == 1) #expect(coords[2].x == 1) - + coords[1].x = 17 #expect(coords[0].x == 1) #expect(coords[1].x == 17) #expect(coords[2].x == 1) } - + @Test func temporaryCoordinates() { TrailingArray.withTemporaryValue( header: Coordinates(numCoordinates: 3) @@ -107,7 +105,7 @@ struct TrailingElementsTests { #expect(coords[2].x == 3) } } - + @Test(arguments: 0 ... 10) func underalignedByteOnHeap(count: Int) { var pointers = TrailingArray( @@ -117,18 +115,18 @@ struct TrailingElementsTests { outputSpan.append(OpaquePointer(bitPattern: i+1)!) } } - + for i in 0...stride) let p2 = elementsPtr.baseAddress #expect(UnsafeMutableRawPointer(p1) == UnsafeMutableRawPointer(p2)) } } - + @Test(arguments: 0 ... 10) func underalignedByteOnStack(count: Int) { TrailingArray.withTemporaryValue(header: OneByteWithPointers(count: count)) { outputSpan in @@ -139,7 +137,7 @@ struct TrailingElementsTests { for i in 0...stride) let p2 = elementsPtr.baseAddress @@ -147,7 +145,7 @@ struct TrailingElementsTests { } } } - + @Test(arguments: 0 ... 10) func underalignedBytesOnHeap(count: Int) { var pointers = TrailingArray(header: ManyBytesWithPointers(count: count)) { outputSpan in @@ -155,18 +153,18 @@ struct TrailingElementsTests { outputSpan.append(OpaquePointer(bitPattern: i+1)!) } } - + for i in 0...stride) let p2 = elementsPtr.baseAddress #expect(UnsafeMutableRawPointer(p1) == UnsafeMutableRawPointer(p2)) } } - + @Test(arguments: 0 ... 10) func underalignedBytesOnStack(count: Int) { TrailingArray.withTemporaryValue(header: ManyBytesWithPointers(count: count)) { outputSpan in @@ -177,7 +175,7 @@ struct TrailingElementsTests { for i in 0...stride) let p2 = elementsPtr.baseAddress @@ -186,5 +184,3 @@ struct TrailingElementsTests { } } } - -#endif diff --git a/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift b/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift index cb9ec074..b015f0a3 100644 --- a/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift +++ b/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift @@ -18,7 +18,6 @@ import InternalCollectionsUtilities import ContainersPreview #endif -#if compiler(>=6.2) /// Check if `left` and `right` contain equal elements in the same order. @available(SwiftStdlib 5.0, *) public func expectIterableContents< @@ -358,4 +357,3 @@ public func expectIterableContents< } } #endif -#endif diff --git a/Tests/_CollectionsTestSupport/AssertionContexts/Assertions.swift b/Tests/_CollectionsTestSupport/AssertionContexts/Assertions.swift index b6b9d3a5..2815ed5c 100644 --- a/Tests/_CollectionsTestSupport/AssertionContexts/Assertions.swift +++ b/Tests/_CollectionsTestSupport/AssertionContexts/Assertions.swift @@ -75,7 +75,6 @@ public func expectFalse( message, trapping: trapping, file: file, line: line) } -#if compiler(>=6.2) public func expectNil( _ value: borrowing Optional, _ message: @autoclosure () -> String = "", @@ -88,22 +87,7 @@ public func expectNil( "value is not nil", message, trapping: trapping, file: file, line: line) } -#else -public func expectNil( - _ value: Optional, - _ message: @autoclosure () -> String = "", - trapping: Bool = false, - file: StaticString = #filePath, - line: UInt = #line -) { - if value == nil { return } - _expectFailure( - "'\(value!)' is not nil", - message, trapping: trapping, file: file, line: line) -} -#endif -#if compiler(>=6.2) public func expectNotNil( _ value: borrowing Optional, _ message: @autoclosure () -> String = "", @@ -116,22 +100,7 @@ public func expectNotNil( "value is nil", message, trapping: trapping, file: file, line: line) } -#else -public func expectNotNil( - _ value: Optional, - _ message: @autoclosure () -> String = "", - trapping: Bool = false, - file: StaticString = #filePath, - line: UInt = #line -) { - if value != nil { return } - _expectFailure( - "value is nil", - message, trapping: trapping, file: file, line: line) -} -#endif -#if compiler(>=6.2) public func expectNotNil( _ value: consuming Optional, _ message: @autoclosure () -> String = "", @@ -149,25 +118,6 @@ public func expectNotNil( message, trapping: trapping, file: file, line: line) } } -#else -public func expectNotNil( - _ value: Optional, - _ message: @autoclosure () -> String = "", - trapping: Bool = false, - file: StaticString = #filePath, - line: UInt = #line, - _ handler: (consuming T) throws -> Void = { _ in } -) rethrows { - switch value { - case let value?: - try handler(value) - case nil: - _expectFailure( - "value is nil", - message, trapping: trapping, file: file, line: line) - } -} -#endif public func expectIdentical( _ left: T?, _ right: T?, @@ -211,7 +161,6 @@ public func expectEquivalent( message, trapping: trapping, file: file, line: line) } -#if compiler(>=6.2) // FIXME: Remove when CustomStringConvertible starts supporting // noncopyable/nonescapable types. public func expectEquivalent< @@ -248,7 +197,6 @@ public func expectEquivalent< "'\(printer(left))' is not equivalent to '\(right)'", message, trapping: trapping, file: file, line: line) } -#endif public func expectEquivalent( _ left: A?, _ right: B?, diff --git a/Tests/_CollectionsTestSupport/Utilities/LifetimeTracked.swift b/Tests/_CollectionsTestSupport/Utilities/LifetimeTracked.swift index b2f26e3a..eadda87f 100644 --- a/Tests/_CollectionsTestSupport/Utilities/LifetimeTracked.swift +++ b/Tests/_CollectionsTestSupport/Utilities/LifetimeTracked.swift @@ -57,9 +57,7 @@ extension LifetimeTracked: CustomStringConvertible { public var description: String { "\(payload)" } } -#if compiler(>=6.2) extension LifetimeTracked: TestPrintable {} -#endif extension LifetimeTracked: Equatable where Payload: Equatable { public static func == (left: LifetimeTracked, right: LifetimeTracked) -> Bool { diff --git a/Tests/_CollectionsTestSupport/Utilities/LifetimeTrackedStruct.swift b/Tests/_CollectionsTestSupport/Utilities/LifetimeTrackedStruct.swift index 9346ecdf..735d1d89 100644 --- a/Tests/_CollectionsTestSupport/Utilities/LifetimeTrackedStruct.swift +++ b/Tests/_CollectionsTestSupport/Utilities/LifetimeTrackedStruct.swift @@ -61,14 +61,12 @@ public struct LifetimeTrackedStruct: ~Copyable { } } -#if compiler(>=6.2) extension LifetimeTrackedStruct: TestPrintable where Payload: TestPrintable & ~Copyable { public var testDescription: String { "\(payload.testDescription)" } } -#endif #if compiler(>=6.4) extension LifetimeTrackedStruct: Equatable where Payload: Equatable & ~Copyable { diff --git a/Tests/_CollectionsTestSupport/Utilities/LifetimeTracker.swift b/Tests/_CollectionsTestSupport/Utilities/LifetimeTracker.swift index ebc319cd..56bf2ea4 100644 --- a/Tests/_CollectionsTestSupport/Utilities/LifetimeTracker.swift +++ b/Tests/_CollectionsTestSupport/Utilities/LifetimeTracker.swift @@ -72,7 +72,6 @@ public class LifetimeTracker { } } -#if compiler(>=6.2) @available(SwiftStdlib 5.0, *) public func structInstances( count: Int, @@ -98,7 +97,6 @@ public class LifetimeTracker { } return r } -#endif public func instances( for items: S, by transform: (S.Element) -> T diff --git a/Tests/_CollectionsTestSupport/Utilities/TestPrintable.swift b/Tests/_CollectionsTestSupport/Utilities/TestPrintable.swift index 0892e3a6..89e6a4f3 100644 --- a/Tests/_CollectionsTestSupport/Utilities/TestPrintable.swift +++ b/Tests/_CollectionsTestSupport/Utilities/TestPrintable.swift @@ -18,7 +18,6 @@ import ContainersPreview import SpanPreview #endif -#if compiler(>=6.2) /// A silly variant of `CustomDebugStringConvertible` that supports noncopyable /// and nonescapable conforming types. /// @@ -110,7 +109,6 @@ extension MutableSpan: TestPrintable where Element: ~Copyable { } } } -#if compiler(>=6.2) @available(SwiftStdlib 5.0, *) extension OutputSpan: TestPrintable where Element: ~Copyable { public var testDescription: String { @@ -125,7 +123,6 @@ extension OutputSpan: TestPrintable where Element: ~Copyable { } } } -#endif #if UnstableContainersPreview @available(SwiftStdlib 5.0, *) @@ -143,4 +140,3 @@ extension InputSpan: TestPrintable where Element: ~Copyable { } } #endif -#endif