From 8f88cce7c7f3f748ab79be7cf16d3714e7e270ef Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Tue, 17 Mar 2026 15:26:45 -0700 Subject: [PATCH] =?UTF-8?q?[BasicContainers,=20ContainersPreview]=20Make?= =?UTF-8?q?=20sure=20package=20traits=20=E2=80=9Cwork=E2=80=9D=20on=206.2?= =?UTF-8?q?=20toolchains?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit “Work” in this case means that they can be enabled without breaking the build — not necessarily that all features are available. Swift 6.2 is highly prone to runtime crashes in `swift_getTypeByMangledName` in generic code that uses ownership features. Swift 6.3 will resolve that. --- .../RigidArray/RigidArray+Consumption.swift | 2 +- .../RigidArray/RigidArray+Container.swift | 2 ++ .../UniqueArray/UniqueArray+Consumption.swift | 2 +- .../UniqueArray/UniqueArray+Container.swift | 2 ++ .../Protocols/BorrowingIteratorProtocol+Copy.swift | 2 +- .../Protocols/BorrowingIteratorProtocol+Map.swift | 2 +- .../Protocols/Container/Container+Filter.swift | 6 +++++- .../Protocols/Container/DynamicContainer.swift | 2 +- .../Protocols/Container/RangeReplaceableContainer.swift | 2 +- Sources/ContainersPreview/Protocols/Drain+Map.swift | 2 +- .../ContainersPreview/Protocols/Producer+Collect.swift | 2 +- Sources/ContainersPreview/Protocols/Producer.swift | 2 +- Sources/ContainersPreview/Types/Box.swift | 4 ++-- Sources/ContainersPreview/Types/Inout.swift | 2 +- Sources/ContainersPreview/Types/InputSpan.swift | 3 +++ .../DequeModule/RigidDeque/RigidDeque+Consumption.swift | 2 +- .../DequeModule/RigidDeque/RigidDeque+Container.swift | 2 ++ .../UniqueDeque/UniqueDeque+Consumption.swift | 2 +- .../DequeModule/UniqueDeque/UniqueDeque+Container.swift | 2 ++ Tests/BasicContainersTests/RigidArrayTests.swift | 9 +++++---- Tests/BasicContainersTests/UniqueArrayTests.swift | 2 +- Tests/ContainersTests/BoxTests.swift | 2 +- Tests/ContainersTests/InoutTests.swift | 2 +- Tests/DequeTests/RigidDequeTests.swift | 6 +++--- Tests/DequeTests/UniqueDequeTests.swift | 2 +- .../AssertionContexts/Assertions+Containers.swift | 4 ++-- 26 files changed, 44 insertions(+), 28 deletions(-) diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Consumption.swift b/Sources/BasicContainers/RigidArray/RigidArray+Consumption.swift index ab756cf0..c13aef42 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Consumption.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Consumption.swift @@ -137,7 +137,7 @@ extension RigidArray where Element: ~Copyable { } #endif -#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW @available(SwiftStdlib 5.0, *) extension RigidArray where Element: ~Copyable { @_alwaysEmitIntoClient diff --git a/Sources/BasicContainers/RigidArray/RigidArray+Container.swift b/Sources/BasicContainers/RigidArray/RigidArray+Container.swift index 2cbada14..0f6a3a4e 100644 --- a/Sources/BasicContainers/RigidArray/RigidArray+Container.swift +++ b/Sources/BasicContainers/RigidArray/RigidArray+Container.swift @@ -44,12 +44,14 @@ extension RigidArray: BidirectionalContainer where Element: ~Copyable {} @available(SwiftStdlib 5.0, *) extension RigidArray: RandomAccessContainer where Element: ~Copyable {} +#if compiler(>=6.3) @available(SwiftStdlib 5.0, *) extension RigidArray: MutableContainer where Element: ~Copyable {} @available(SwiftStdlib 5.0, *) extension RigidArray: RangeReplaceableContainer where Element: ~Copyable {} #endif +#endif @available(SwiftStdlib 5.0, *) extension RigidArray where Element: ~Copyable { diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Consumption.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Consumption.swift index 42aceb47..f8aaaf3b 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Consumption.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Consumption.swift @@ -116,7 +116,7 @@ extension UniqueArray where Element: ~Copyable { } #endif -#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW @available(SwiftStdlib 5.0, *) extension UniqueArray where Element: ~Copyable { public typealias SubrangeConsumer = RigidArray.SubrangeConsumer diff --git a/Sources/BasicContainers/UniqueArray/UniqueArray+Container.swift b/Sources/BasicContainers/UniqueArray/UniqueArray+Container.swift index c1a37eff..38013872 100644 --- a/Sources/BasicContainers/UniqueArray/UniqueArray+Container.swift +++ b/Sources/BasicContainers/UniqueArray/UniqueArray+Container.swift @@ -47,12 +47,14 @@ extension UniqueArray: RandomAccessContainer where Element: ~Copyable {} @available(SwiftStdlib 5.0, *) extension UniqueArray: MutableContainer where Element: ~Copyable {} +#if compiler(>=6.3) @available(SwiftStdlib 5.0, *) extension UniqueArray: RangeReplaceableContainer where Element: ~Copyable {} @available(SwiftStdlib 5.0, *) extension UniqueArray: DynamicContainer where Element: ~Copyable {} #endif +#endif @available(SwiftStdlib 5.0, *) extension UniqueArray where Element: ~Copyable { diff --git a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Copy.swift b/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Copy.swift index a91ed0fc..56328408 100644 --- a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Copy.swift +++ b/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Copy.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW @available(SwiftStdlib 5.0, *) extension BorrowingIteratorProtocol diff --git a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Map.swift b/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Map.swift index f4b2f205..0a9e5a16 100644 --- a/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Map.swift +++ b/Sources/ContainersPreview/Protocols/BorrowingIteratorProtocol+Map.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW @available(SwiftStdlib 5.0, *) extension BorrowingIteratorProtocol where Self: ~Copyable & ~Escapable { diff --git a/Sources/ContainersPreview/Protocols/Container/Container+Filter.swift b/Sources/ContainersPreview/Protocols/Container/Container+Filter.swift index e18c8afd..ad6681bf 100644 --- a/Sources/ContainersPreview/Protocols/Container/Container+Filter.swift +++ b/Sources/ContainersPreview/Protocols/Container/Container+Filter.swift @@ -11,7 +11,11 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if !COLLECTIONS_SINGLE_MODULE +import InternalCollectionsUtilities +#endif + +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW @available(SwiftStdlib 5.0, *) extension Container where Self: ~Copyable /*& ~Escapable*/ { diff --git a/Sources/ContainersPreview/Protocols/Container/DynamicContainer.swift b/Sources/ContainersPreview/Protocols/Container/DynamicContainer.swift index e8af848a..5713b1ee 100644 --- a/Sources/ContainersPreview/Protocols/Container/DynamicContainer.swift +++ b/Sources/ContainersPreview/Protocols/Container/DynamicContainer.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW @available(SwiftStdlib 5.0, *) public protocol DynamicContainer: RangeReplaceableContainer, ~Copyable { diff --git a/Sources/ContainersPreview/Protocols/Container/RangeReplaceableContainer.swift b/Sources/ContainersPreview/Protocols/Container/RangeReplaceableContainer.swift index ba4312d1..efa4a882 100644 --- a/Sources/ContainersPreview/Protocols/Container/RangeReplaceableContainer.swift +++ b/Sources/ContainersPreview/Protocols/Container/RangeReplaceableContainer.swift @@ -15,7 +15,7 @@ import InternalCollectionsUtilities #endif -#if compiler(>=6.2) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW //MARK: - Protocol Definition diff --git a/Sources/ContainersPreview/Protocols/Drain+Map.swift b/Sources/ContainersPreview/Protocols/Drain+Map.swift index 132083e2..b3460139 100644 --- a/Sources/ContainersPreview/Protocols/Drain+Map.swift +++ b/Sources/ContainersPreview/Protocols/Drain+Map.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW @available(SwiftStdlib 5.0, *) extension Drain where Self: ~Copyable & ~Escapable { diff --git a/Sources/ContainersPreview/Protocols/Producer+Collect.swift b/Sources/ContainersPreview/Protocols/Producer+Collect.swift index 68150984..36c61817 100644 --- a/Sources/ContainersPreview/Protocols/Producer+Collect.swift +++ b/Sources/ContainersPreview/Protocols/Producer+Collect.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW @available(SwiftStdlib 5.0, *) extension Producer where Self: ~Copyable & ~Escapable { diff --git a/Sources/ContainersPreview/Protocols/Producer.swift b/Sources/ContainersPreview/Protocols/Producer.swift index fd42f475..6bd546a2 100644 --- a/Sources/ContainersPreview/Protocols/Producer.swift +++ b/Sources/ContainersPreview/Protocols/Producer.swift @@ -250,7 +250,7 @@ extension Producer where Self: ~Copyable & ~Escapable { @inlinable @_lifetime(self: copy self) public mutating func next() throws(ProducerError) -> Element? { - try withUnsafeTemporaryAllocation( + try _withUnsafeTemporaryAllocation( of: Element.self, capacity: 1 ) { buffer throws(ProducerError) in var span = OutputSpan(buffer: buffer, initializedCount: 0) diff --git a/Sources/ContainersPreview/Types/Box.swift b/Sources/ContainersPreview/Types/Box.swift index 6dbd88bb..d0818c0e 100644 --- a/Sources/ContainersPreview/Types/Box.swift +++ b/Sources/ContainersPreview/Types/Box.swift @@ -90,7 +90,7 @@ extension Box where T: ~Copyable { return result } -#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW /// Leak the heap allocation behind this box, converting it into an /// immortal mutating reference. @_alwaysEmitIntoClient @@ -114,7 +114,7 @@ extension Box where T: ~Copyable { } #endif -#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW /// Return a mutating reference to the contents of this box. @_alwaysEmitIntoClient @_transparent diff --git a/Sources/ContainersPreview/Types/Inout.swift b/Sources/ContainersPreview/Types/Inout.swift index 16e7e007..3c8f99be 100644 --- a/Sources/ContainersPreview/Types/Inout.swift +++ b/Sources/ContainersPreview/Types/Inout.swift @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6.2) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW import Builtin /// A safe mutable reference allowing in-place mutation to an exclusive value. diff --git a/Sources/ContainersPreview/Types/InputSpan.swift b/Sources/ContainersPreview/Types/InputSpan.swift index 406fcb6f..8bce270b 100644 --- a/Sources/ContainersPreview/Types/InputSpan.swift +++ b/Sources/ContainersPreview/Types/InputSpan.swift @@ -410,6 +410,7 @@ extension InputSpan /* where Element: Copyable */ { @available(SwiftStdlib 5.0, *) extension InputSpan /* where Element: Copyable */ { @inlinable + @_lifetime(self: copy self) package mutating func prepend(copying source: UnsafeBufferPointer) { self.withUnsafeMutableBufferPointer { dst, dstCount in let dstEnd = dst.count &- dstCount @@ -423,6 +424,7 @@ extension InputSpan /* where Element: Copyable */ { } @inlinable + @_lifetime(self: copy self) package mutating func prepend(copying source: borrowing Span) { source.withUnsafeBufferPointer { src in self.prepend(copying: src) @@ -561,6 +563,7 @@ internal func withTemporaryInputSpan @available(SwiftStdlib 5.0, *) extension OutputSpan where Element: ~Copyable { @_alwaysEmitIntoClient + @_lifetime(self: copy self) package mutating func _consumeAll( consumingWith consumer: (inout InputSpan) -> Void ) { diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Consumption.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Consumption.swift index cc7f1807..8a657607 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Consumption.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Consumption.swift @@ -165,7 +165,7 @@ extension RigidDeque where Element: ~Copyable { #endif } -#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW @available(SwiftStdlib 5.0, *) extension RigidDeque where Element: ~Copyable { @_alwaysEmitIntoClient diff --git a/Sources/DequeModule/RigidDeque/RigidDeque+Container.swift b/Sources/DequeModule/RigidDeque/RigidDeque+Container.swift index a77a0479..d79d19ec 100644 --- a/Sources/DequeModule/RigidDeque/RigidDeque+Container.swift +++ b/Sources/DequeModule/RigidDeque/RigidDeque+Container.swift @@ -74,12 +74,14 @@ extension RigidDeque: BidirectionalContainer where Element: ~Copyable {} @available(SwiftStdlib 5.0, *) extension RigidDeque: RandomAccessContainer where Element: ~Copyable {} +#if compiler(>=6.3) @available(SwiftStdlib 5.0, *) extension RigidDeque: MutableContainer where Element: ~Copyable {} @available(SwiftStdlib 5.0, *) extension RigidDeque: RangeReplaceableContainer where Element: ~Copyable {} #endif +#endif @available(SwiftStdlib 5.0, *) extension RigidDeque where Element: ~Copyable { diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Consumption.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Consumption.swift index 986a454d..7f71f7c3 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Consumption.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Consumption.swift @@ -150,7 +150,7 @@ extension UniqueDeque where Element: ~Copyable { #endif } -#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW @available(SwiftStdlib 5.0, *) extension UniqueDeque where Element: ~Copyable { public typealias SubrangeConsumer = RigidDeque.SubrangeConsumer diff --git a/Sources/DequeModule/UniqueDeque/UniqueDeque+Container.swift b/Sources/DequeModule/UniqueDeque/UniqueDeque+Container.swift index a37d771b..e128c9be 100644 --- a/Sources/DequeModule/UniqueDeque/UniqueDeque+Container.swift +++ b/Sources/DequeModule/UniqueDeque/UniqueDeque+Container.swift @@ -45,12 +45,14 @@ extension UniqueDeque: RandomAccessContainer where Element: ~Copyable {} @available(SwiftStdlib 5.0, *) extension UniqueDeque: MutableContainer where Element: ~Copyable {} +#if compiler(>=6.3) @available(SwiftStdlib 5.0, *) extension UniqueDeque: RangeReplaceableContainer where Element: ~Copyable {} @available(SwiftStdlib 5.0, *) extension UniqueDeque: DynamicContainer where Element: ~Copyable {} #endif +#endif @available(SwiftStdlib 5.0, *) extension UniqueDeque where Element: ~Copyable { diff --git a/Tests/BasicContainersTests/RigidArrayTests.swift b/Tests/BasicContainersTests/RigidArrayTests.swift index 7747a9be..34d6d21e 100644 --- a/Tests/BasicContainersTests/RigidArrayTests.swift +++ b/Tests/BasicContainersTests/RigidArrayTests.swift @@ -16,12 +16,13 @@ import XCTest import Collections #else import _CollectionsTestSupport +import ContainersPreview import BasicContainers #endif #if compiler(>=6.2) -#if !COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(<6.3) || !COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW /// Check if `left` and `right` contain equal elements in the same order. @available(SwiftStdlib 5.0, *) internal func expectIterableContents< @@ -1178,7 +1179,7 @@ class RigidArrayTests: CollectionTestCase { } } -#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW func test_insert_copying_Container() { withSomeArrayLayouts("layout", ofCapacities: [0, 5, 10]) { layout in withEvery("i", in: 0 ... layout.count) { i in @@ -1326,7 +1327,7 @@ class RigidArrayTests: CollectionTestCase { } } -#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW func test_replace_Container() { withSomeArrayLayouts("layout", ofCapacities: [0, 5, 10]) { layout in withEveryRange("range", in: 0 ..< layout.count) { range in @@ -1357,7 +1358,7 @@ class RigidArrayTests: CollectionTestCase { } #endif -#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW func test_borrowing_map() { let c = 100 let items = RigidArray(capacity: c, copying: 0 ..< c) diff --git a/Tests/BasicContainersTests/UniqueArrayTests.swift b/Tests/BasicContainersTests/UniqueArrayTests.swift index c18ce0bb..d288478b 100644 --- a/Tests/BasicContainersTests/UniqueArrayTests.swift +++ b/Tests/BasicContainersTests/UniqueArrayTests.swift @@ -21,7 +21,7 @@ import BasicContainers #if compiler(>=6.2) -#if !COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(<6.3) || !COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW /// Check if `left` and `right` contain equal elements in the same order. @available(SwiftStdlib 5.0, *) public func expectIterableContents< diff --git a/Tests/ContainersTests/BoxTests.swift b/Tests/ContainersTests/BoxTests.swift index 14a1a9e2..3e7bf6e6 100644 --- a/Tests/ContainersTests/BoxTests.swift +++ b/Tests/ContainersTests/BoxTests.swift @@ -32,7 +32,7 @@ final class BoxTests: XCTestCase { XCTAssertEqual(intOnHeap.copy(), 123) -#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW var inoutToIntOnHeap = intOnHeap.leak() XCTAssertEqual(inoutToIntOnHeap.value, 123) diff --git a/Tests/ContainersTests/InoutTests.swift b/Tests/ContainersTests/InoutTests.swift index 173b876e..0108f015 100644 --- a/Tests/ContainersTests/InoutTests.swift +++ b/Tests/ContainersTests/InoutTests.swift @@ -19,7 +19,7 @@ import _CollectionsTestSupport import ContainersPreview #endif -#if compiler(>=6.2) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW final class InoutTests: XCTestCase { func test_basic() { var x = 0 diff --git a/Tests/DequeTests/RigidDequeTests.swift b/Tests/DequeTests/RigidDequeTests.swift index 9d772f96..b1ee2e3c 100644 --- a/Tests/DequeTests/RigidDequeTests.swift +++ b/Tests/DequeTests/RigidDequeTests.swift @@ -22,7 +22,7 @@ import ContainersPreview #endif #if compiler(>=6.2) -#if !COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(<6.3) || !COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW /// Check if `left` and `right` contain equal elements in the same order. @available(SwiftStdlib 5.0, *) internal func expectIterableContents< @@ -414,7 +414,7 @@ final class RigidDequeTests: CollectionTestCase { } } -#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW func test_initCopyingBorrowingSequence() { withEvery("c", in: 0 ..< 10) { c in withEvery("capacity", in: [c, c + 1]) { capacity in @@ -557,7 +557,7 @@ final class RigidDequeTests: CollectionTestCase { var data = tracker.rigidDeque(with: layout) let extra = tracker.instance(for: layout.count) guard !data.deque.isFull else { return } - data.contents.insert(extra, at: data.contents.count) + data.contents.append(extra) data.deque.append(extra) expectIterableContents(data.deque, equalTo: data.contents) } diff --git a/Tests/DequeTests/UniqueDequeTests.swift b/Tests/DequeTests/UniqueDequeTests.swift index 6bfe8429..2160da26 100644 --- a/Tests/DequeTests/UniqueDequeTests.swift +++ b/Tests/DequeTests/UniqueDequeTests.swift @@ -22,7 +22,7 @@ import ContainersPreview #endif #if compiler(>=6.2) -#if !COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(<6.3) || !COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW /// Check if `left` and `right` contain equal elements in the same order. @available(SwiftStdlib 5.0, *) internal func expectIterableContents< diff --git a/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift b/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift index 4056da1e..29beb425 100644 --- a/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift +++ b/Tests/_CollectionsTestSupport/AssertionContexts/Assertions+Containers.swift @@ -121,7 +121,7 @@ public func expectIterableContents< } } -#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW /// Check if `left` contains lifetime tracked instances whose payloads equal /// the elements in `right`. @available(SwiftStdlib 5.0, *) @@ -217,7 +217,7 @@ public func expectIterablePayloads< } #endif -#if COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW +#if compiler(>=6.3) && COLLECTIONS_UNSTABLE_CONTAINERS_PREVIEW @available(SwiftStdlib 5.0, *) public func expectIterablesWithEquivalentElements< S1: BorrowingSequence & ~Copyable & ~Escapable,