Skip to content

Update dependency apple/swift-collections to from: "1.7.1" - #67

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/apple-swift-collections-1.x
Open

renovate[bot] wants to merge 1 commit into
mainfrom
renovate/apple-swift-collections-1.x

Conversation

@renovate

@renovate renovate Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

ℹ️ Note

This PR body was truncated due to platform limits.

This PR contains the following updates:

Package Update Change
apple/swift-collections minor from: "1.1.4" → from: "1.7.1"

Release Notes

apple/swift-collections (apple/swift-collections)

v1.7.1: Swift Collections 1.7.1

Compare Source

This is a patch release that ships a workaround for a Swift 6.4 defect that prevents code that uses the package from deploying before macOS/iOS 27 (#​733), alongside fixes for a handful of other bugs uncovered since 1.7.0.

What's Changed

New Contributors

Full Changelog: apple/swift-collections@1.7.0...1.7.1

v1.7.0: Swift Collections 1.7.0

Compare Source

This is a feature release raising the minimum required toolchain to Swift 6.2. It formalizes Equatable/Hashable conformances on the ownership-aware container types, adds a new stable OrderedSet operation, and continues to develop the experimental ownership-aware container model behind the UnstableContainersPreview trait. It also includes a number of performance improvements and bug fixes.

New stable APIs

OrderedCollections
  • OrderedSet.replace(at:with:) replaces the member at a given index with a new element, returning the element that was removed. Replacing a member with an element that already exists elsewhere in the set is a runtime error. Expected amortized O(1) complexity. (#​669)
BasicContainers, DequeModule
  • On a Swift 6.4 or later toolchain, RigidArray, UniqueArray, RigidDeque, UniqueDeque, RigidSet, UniqueSet, RigidDictionary, and UniqueDictionary now formally conform to Equatable and Hashable. (The underlying == and hash(into:) members were already available in 1.6.0; what is new is the conformances themselves.) Building with Swift 6.2 or 6.3 still gets you the ==/hash(into:) members, but no conformances.

  • RigidDeque.isTriviallyIdentical(to:) and UniqueDeque.isTriviallyIdentical(to:) are now available for every element type, including noncopyable ones. Previously these required Element: Equatable.

  • New spelling for the capacity, cloning, and range-replacement operations; see Renamed APIs below. The new names are the stable spelling going forward; the old ones remain as deprecated shims.

Collections umbrella module

The Collections module is back to re-exporting its constituent modules with @_exported import, instead of restating each type as a public typealias (#​716). A single
import Collections therefore now brings in the entire contents of BitCollections, DequeModule, HashTreeCollections, HeapModule, and OrderedCollections — including types that previously were not exposed in the Collections module, such as RigidDeque and UniqueDeque. This allows import Collections to work even for clients that have MemberImportVisibility enabled.

Renamed APIs

BasicContainers and DequeModule are stable modules, so every rename below ships with a deprecated shim carrying @available(*, deprecated, renamed:). Existing code keeps compiling, and Xcode/swift build will offer fix-its.

Old name New name
reallocate(capacity:) setCapacity(_:)
copy() clone()
copy(capacity:) clone(capacity:)
UniqueDeque.init(capacity:) init(minimumCapacity:)
replace(_:with:) and friends replaceSubrange(_:copying:) / (_:moving:) / (_:consuming:)
replace(_:count:initializingWith:) replaceSubrange(_:addingCount:initializingWith:)
append(count:initializingWith:) append(addingCount:initializingWith:)
insert(count:at:initializingWith:) insert(addingCount:at:initializingWith:)
nextSpan(after:maximumCount:) nextSpan(after:maxCount:)
nextMutableSpan(after:maximumCount:) nextMutableSpan(after:maxCount:)
previousSpan(before:maximumCount:) previousSpan(before:maxCount:)
RigidSet.insert(count:initializingWith:) insert(addingCount:initializingWith:)
RigidSet.insert(count:from:) insert(addingCount:from:)

Most of the new names sync this package with the API names recently adopted in the Standard Library in Iterable and UniqueArray.

Performance improvements

  • BitSet.count is roughly 3× faster. (#​702)
  • _Word.allBits is now @inlinable, which unblocks specialization in several
    bit-twiddling paths. (#​704)
  • OrderedSet.reverse() now reverses the hash table in place instead of
    rebuilding it from scratch. (#​668)
  • UniqueArray no longer performs duplicate bounds checks on subscript and
    mutation paths. (#​699)
  • RigidArray's internal representation was split from a (buffer pointer, count) pair into separate pointer, capacity, and count fields. This exposes an unused bit pattern for the compiler to use for representing nil values in optional wrapped arrays, avoiding having to add an out-of-line discriminator. The representation of RigidDictionary was
    adjusted in a similar way. (#​692, #​717)
  • Deque and the TreeSet/TreeDictionary types are no longer using a malloc_size to make use of any "extra" storage allocated. (#​700)
  • OrderedDictionary.replaceElement now uses exchange(_:with:) on its equal-key path to avoid copying the outgoing value. (#​688, #​703)
  • RigidDictionary now stores a sentinel value rather than nil for its values pointer, removing a branch from value access.

Notable bug fixes

  • BitCollections: BitSet.isEqualSet(to:) returned the wrong result when given an empty Range<Int>. A non-empty bit set incorrectly compared equal to an empty range. (#​718)
  • SortedCollections (UnstableSortedCollections trait): SortedDictionary.Keys, .Values, and .SubSequence had inverted == implementations, so equal instances compared unequal and vice versa. SubSequence equality also now uses tuple comparison rather than an element-by-element loop with the wrong short-circuit. (#​697)
  • Embedded Swift: the _UniqueCollection fast paths in BitSet.isEqualSet(to:), OrderedSet.isEqualSet(to:), TreeSet.isEqualSet(to:), and TreeSet.symmetricDifference(_:) rely on dynamic conformance checks, which are unavailable in embedded Swift. They are now compiled out with #if !$Embedded. (#​715)

Experimental container protocols (UnstableContainersPreview trait)

This is the first swift-collections release that ships a fully operational container protocol hierarchy, including some massive updates. However, things are still subject to change, and we expect to need to make breaking changes as we gain experience using the new constructs. Nothing under this trait is stable API, and source-breaking changes land without deprecations.

New: Documentation/Container-design.md is a work-in-progress document describing the container design implemented in the ContainersPreview module. As of the 1.7.0 release, it explains some of the design decisions behind the container protocols, up to and including MutableContainer. (The Producer hierarchy and the range-replaceable container protocol family is not yet fully covered; we expect those parts to be fleshed out later.)

New SpanPreview module

InputSpan has moved out of ContainersPreview into a new SpanPreview module. SpanPreview holds span-adjacent primitives that are expected to graduate to the standard library, and it is entirely empty unless the UnstableContainersPreview trait is enabled. It also ships basic MutableSpan/OutputSpan helpers for producing and consuming InputSpans.

Some core APIs on the container types require the use of InputSpan, and this change lets these APIs continue to live in their defining module.

SpanPreview is explicitly not part of the package's stable public API, as we expect to soon replace it with the Standard Library's own InputSpan definition.

Dependency inversion

ContainersPreview and the concrete container modules have swapped places in the dependency graph. BasicContainers and DequeModule no longer depend on ContainersPreview; instead ContainersPreview depends on them, and all
container conformances for the concrete types now live there, under Sources/ContainersPreview/Conformances/. (842f125c)

Source-breaking for trait adopters: getting Container (etc.) conformances for RigidArray, UniqueArray, RigidDeque, UniqueDeque, RigidSet, or UniqueSet now requires import ContainersPreview. Importing just BasicContainers or DequeModule gets you the types and their intrinsic operations, but not the protocol conformances.

Standard library adoption
  • The locally-defined BorrowingSequence_/BorrowingIteratorProtocol_ protocols have been replaced by the standard library's Iterable and BorrowingIteratorProtocol. The package's own definitions have been removed. (#​657)
  • Similarly, Ref and MutableRef now ship in the Standard Library rather than being declared in ContainersPreview. (UniqueBox is part of the package's stable API, so its definition continues to remain available. We expect to deprecate it in a future package release.)
New protocols
  • Removal and consumption operations were spun off from RangeReplaceableContainer into the new parent protocol DrainableContainer. This protocol models containers supporting partial in-place consumption (and removal) of their contents. Range-replacement operations now all return indices to the subranges they affected, so that we can perform insertions/removals without losing our place in the container. (This is particularly important for linked lists and similar linked data structures capable of performing O(1) insertions/removals.) (#​723)
  • CountedProducer refines Producer adding a precise count of remaining elements. Drain now refines CountedProducer.
  • ContainerDrain refines Drain to allow retrieving a valid index after the items have been drained.
  • RangeExpression2 now refines the standard RangeExpression, so that we can use the standard range expression notation over container types. (The name (as well as the protocol itself) is a placeholder, so that we have something that works while we are looking for a better solution.) (#​22a94a97)
Reworked core requirements
  • Container's core primitive is now nextSpan(after:maxCount:limitedBy:), with optional delimiter arguments; the
    bidirectional counterpart is spanBoundary(before:maxDistance:limitedBy:).
  • Container gained makeBorrowingIterator(from:), makeBorrowingIterator(from:to:), and currentIndex(of:) requirements.
  • Container now expects its indices to be Comparable again, as we have found a way to provide them in conforming linked list types. (#​727)
  • [Mutable]Container gained subscript requirements expressed with borrow and mutate accessors.
  • Producer.generate(into:) switched to saturating semantics — it now fills the destination when possible, unless it reaches its end or throws. (#​728)
New algorithms
  • MutableContainer gained bulk update operations (updateSubrange and friends), in both mutating and copying forms, plus a default swapAt implementation for copyable elements. (#​724)
  • PermutableContainer gained reverse(), shuffle(), moveSubrange(_:to:), and a heap sort.
  • Producer gained UnfoldProducer (an unfold-style generator), and
  • BorrowingIteratorProtocol gained mapError, and map was fixed; _map2 and _map3 were added alongside it to demonstrate different throwing behaviors. Error handling across the producer/drain algorithms was reviewed.
  • New Container conformances for Span, MutableSpan, OutputSpan, and InputSpan.

Experimental hashed containers (UnstableHashedContainers trait)

These types are functional, but they still have known usability gaps in their API surface that prevents us from declaring them API stable.

  • The trait no longer needs UnstableContainersPreview to be enabled alongside it. 70dc2389)
  • RigidSet and UniqueSet now conform to Container. (#​713)
  • RigidDictionary and UniqueDictionary gained a keys property and mutableValue(forKey:), which yields in-place mutable access to a stored value. (#​698,

Testing and infrastructure

  • checkSetAlgebra, a new law checker in _CollectionsTestSupport, verifies set-like types against the SetAlgebra laws — and additionally checks each mutating operation against its non-mutating twin. (#​719, #​730)
  • A Container conformance validator has been added, along the lines of the existing Sequence/Collection conformance checkers, and is now applied to RigidSet, UniqueSet, RigidDeque, and UniqueDeque. (#​713, #​720)
  • New tests cover Deque's storage allocation behavior and MutableContainer's requirements (the latter uncovered and fixed several issues). (#​722)
  • We added a first draft of a swift-format configuration for this package.
  • CI workflows were updated (swiftlang/github-workflows 0.0.11 → 0.0.15, actions/checkout 6 → 7), and the matrix was simplified now that 6.0/6.1 are out of support.
  • The unstable Xcode project had its groups converted to folders.

Detailed List of Changes

New Contributors

Full Changelog: apple/swift-collections@1.6.0...1.7.0

v1.6.0: Swift Collections 1.6.0

Compare Source

This is a feature release adding several useful operations to ordered collections, as well as shipping bug fixes that landed since 1.5.1.

The list of supported Swift toolchain versions remains 6.0, 6.1, 6.2, and 6.3 for now. Note that we intend to retire support for Swift 6.0 and 6.1 in a subsequent release later this year.

New OrderedCollections operations

We now have several new operations that move existing elements in an OrderedSet or OrderedDictionary to a new position within the same collection:

  • OrderedSet.moveSubrange(_:to:) and OrderedDictionary.moveSubrange(_:to:) move items at a range of indices to just before the item at the specified destination index.
  • OrderedSet.move(members:to:) and OrderedDictionary.move(keys:to:) relocate elements identified by value (or key), preserving the order in which they're listed.
  • OrderedSet.move(indices:to:) and OrderedDictionary.move(indices:to:) relocate items at an arbitrary sequence of indices, preserving their listed order.

Bugfixes

  • SortedCollections [with the UnstableSortedCollections trait]: The default capacity of B-tree nodes is no longer clamped at 16, improving performance. (#​257)
  • DequeModule: The ownership-aware RigidDeque and UniqueDeque types no longer hand out invalid spans to clients (#​659)
  • ContainersPreview [with the UnstableContainersPreview trait]: The deprecated Borrow type alias is now declared with correct availability. (#​655)

What's Changed

New Contributors

Full Changelog: apple/swift-collections@1.5.1...1.6.0

v1.5.1: Swift Collections 1.5.1

Compare Source

This is a patch release resolving three issues uncovered since 1.5.0 was tagged, including a source breaking regression introduced in 1.4.0, affecting clients importing the Collections module.

What's Changed

Full Changelog: apple/swift-collections@1.5.0...1.5.1

v1.5.0: Swift Collections 1.5.0

Compare Source

This feature release supports Swift toolchain versions 6.0, 6.1, 6.2, and 6.3. It includes the following new features and bug fixes:

Debugging enhancements

The package now defines LLDB data formatters for RigidArray. The formatters are emitted into the executable binary, and they are automatically loaded by LLDB. We expect to implement formatters for (many) more types in subsequent releases.

New stable APIs
  • RigidArray and UniqueArray now conform to Equatable when their element type is Equatable. This conformance requires a Swift 6.4 or later toolchain (it relies on SE-0499 generalizations of Equatable/Hashable to support noncopyable conforming types).
  • RigidArray and UniqueArray gained an isTriviallyIdentical(to:) operation, which reports whether two instances share their underlying storage allocation. This does not require the element type to be Equatable, and it works with noncopyable elements.
  • BitSet gained a makeIterator(from:) shortcut for starting iteration at (or after) a specific member, avoiding a linear scan from the start of the set.
  • OrderedDictionary gained a replaceElement(at:withKey:value:) operation that replaces the key-value pair at a given index. The new key is allowed to equal the existing key at that index (in which case only the value is updated).
Experimental hashed containers (UnstableHashedContainers trait)

The Robin-Hood-hashed UniqueSet, RigidSet, UniqueDictionary, and RigidDictionary types in the BasicContainers module continue to evolve behind the UnstableHashedContainers package trait. This release brings a number of correctness fixes and performance improvements:

  • Faster removals, with better maxProbeLength maintenance to avoid probe-length bloat.
  • Small tables are now scrambled to avoid degenerate patterns on common key distributions.
  • A fast-path shortcut for insertions into under-utilized tables.
  • Fixes to the insertion algorithm and to RigidDictionary.updateValue(forKey:with:) (the latter exhibited undefined behavior on removals).
  • RigidSet.insert(maximumCount:from:) no longer spuriously reports a capacity overflow due to incorrect accounting.
  • The UnstableHashedContainers trait can now be enabled independently of UnstableContainersPreview.

These types remain source-unstable for now.

Experimental sorted collections (UnstableSortedCollections trait)

The SortedCollections module's SortedSet has gained the following additions:

  • SortedSet now supports value-range subscripts for the full variety of standard range expression types, ClosedRange, PartialRangeFrom, PartialRangeThrough, and PartialRangeUpTo.
  • SortedSet.firstIndex(after:) and SortedSet.lastIndex(before:) return the index to the nearest member following or preceding a given value.

This release also fixes several underlying B-tree bugs that were surfaced by these additions.

These types remain source-unstable; they have known API deficiencies that will need to be addressed before they ship.

Experimental container protocols (UnstableContainersPreview trait)

The ContainersPreview module's protocol hierarchy and associated types continue to be developed. Several constructs have been renamed to follow Swift Evolution proposals in flight.

Old name New name
struct Box<T> struct UniqueBox<Value>
struct Borrow<Target> struct Ref<Target>
struct Inout<Target> struct MutableRef<Target>
Producer.ProducerError Producer.Failure
Producer.generateNext() Producer.next()
Producer.skip(upTo:) Producer.skip(by:)

For UniqueBox, Ref and MutableRef, there are deprecated typealiases for the old names, preserving source compatibility.

Other changes to the experimental container model:

  • Container.Index no longer needs to conform to Comparable. This allows linked lists to become containers.
  • RigidArray, UniqueArray, RigidDeque, and UniqueDeque now conform to the container protocols.
  • Added Producer.collect(into:) for collecting a producer's output into a RangeReplaceableContainer.
  • Added BorrowingIteratorProtocol.copy() for turning a borrowing iterator into a producer.
  • Added filter and map overloads for BorrowingIteratorProtocol, Producer, and Drain.
  • BorrowingSequence.first was removed.
  • BorrowingSequence, BorrowingIteratorProtocol and their requirements have temporarily gained trailing underscores to avoid naming conflicts with the (provisional) protocol definition in the Standard Library. We expect these definitions to be removed when these protocols officially become part of the stdlib.

The protocol-based APIs in ContainersPreview now require a Swift 6.4 or later toolchain. UniqueBox is source-stable, therefore it continues to require Swift 6.2.

Notable bug fixes
  • HashTreeCollections: Fixed an invariant violation that could be triggered by some operations on TreeSet/TreeDictionary.
  • _RopeModule: Fixed an infinite loop when hashing the UTF-8 view of a multi-chunk big substring.
  • BitCollections: Fixed a bogus precondition in BitArray.insert(repeating:count:at:); fixed BitSet.isSubset(of: Range<Int>) to correctly examine elements above the range's upper word.
  • HeapModule: Fixed Heap.insert(contentsOf:) to use a wrapping multiply in its Floyd-heuristic computation; added a missing bounds assertion in Heap._UnsafeHandle.swapAt(_:with:).
  • OrderedCollections: Fixed OrderedSet crash on negative capacity values; minor fixes in _HashTable.UnsafeHandle.
  • DequeModule: Fixed sizing issue in UniqueDeque.replace(removing:addingCount:initializingWith:); fixed a missing argument validation in RigidDeque.nextMutableSpan(after:maximumCount:); RigidDeque.consume(_:consumingWith:) now closes the resulting gap before returning; added zero-count fast-paths; replace/prepend operations taking a Collection now verify that the source's count matches its contents.
  • BasicContainers: Fixed an overallocation issue in UniqueArray.replace(removing:copying:); fixed a partial-initialization correctness issue in RigidArray.replace(removing:consumingWith:addingCount:initializingWith:).

What's Changed

New Contributors

Full Changelog: apple/swift-collections@1.4.1...1.5.0

v1.4.1: Swift Collections 1.4.1

Compare Source

This patch release is mostly focusing on evolving the package traits UnstableContainersPreview and UnstableHashedContainers, with the following notable fixes and improvements to the stable parts of the package:

  • Make the package documentation build successfully on the DocC that ships in Swift 6.2.
  • Avoid using floating point arithmetic to size collection storage in the DequeModule and OrderedCollections modules.

Changes to experimental package traits

The new set and dictionary types enabled by the UnstableHashedContainers trait have now resolved several correctness issues in their implementation of insertions. They have also gained some low-hanging performance optimizations. Like before, these types are in "working prototype" phase, and while they have working implementations of basic primitive operations, we haven't done much work validating their performance yet. Feedback from intrepid early adopters would be very welcome.

The UnstableContainersPreview trait has gained several new protocols and algorithm implementations, working towards one possible working model of a coherent, ownership-aware container/iteration model.

  • BidirectionalContainer defines a container that allows iterating over spans backwards, and provides decrement operations on indices -- an analogue of the classic BidirectionalCollection protocol.
  • RandomAccessContainer models containers that allow constant-time repositioning of their indices, like RandomAccessCollection.
  • MutableContainer is the ownership-aware analogue of MutableCollection -- it models a container type that allows its elements to be arbitrarily reordered and mutated/reassigned without changing the shape of the data structure (that is to say, without invalidating any indices).
  • PermutableContainer is an experimental new spinoff of MutableContainer, focusing on reordering items without allowing arbitrary mutations.
  • RangeReplaceableContainer is a partial, ownership-aware analogue of RangeReplaceableCollection, providing a full set of insertion/append/removal/consumption operations, with support for fixed-capacity conforming types.
  • DynamicContainer rounds out the range-replacement operations with initializer and capacity reservation requirements that can only be implemented by dynamically sized containers.
  • We now have working reference implementations of lazy map, reduce and filter operations on borrowing iterators, producers and drains, as well a collect(into:) family of methods to supply "greedy" variants, generating items into a container of the user's choice. Importantly, the algorithms tend to be defined on the iterator types, rather than directly on some sequence/container -- going this way has some interesting benefits (explicitness, no confusion between the various flavors or the existing Sequence algorithms), but they also have notable drawbacks (minor design issues with the borrowing iterator protocol, unknowns on how the pattern would apply to container algorithms, etc.).
    let items: RigidArray<Int> = ...
    let transformed = 
      items.makeBorrowingIterator() // obviously we'd want a better name here, like `borrow()`
      .map { 2 * $0 }
      .collect(into: UniqueArray.self)
    // `transformed` is a UniqueArray instance holding all values in `items`, doubled up 
    let items: RigidArray = ...
    let transformed = 
       items.makeBorrowingIterator()
      .filter { !$0.isMultiple(of: 7) }
      .copy()
      .collect(into: UniqueArray.self)
    // `transformed` holds a copy of all values in `items` that aren't a multiple of 7
    let items: RigidArray = ...
    let transformed = 
       items.consumeAll()
      .filter { !$0.isMultiple(of: 7) }
      .collect(into: UniqueArray.self)
    // `transformed` holds all values that were previously in `items` that aren't a multiple of 7. `items` is now empty.

Like before, these are highly experimental, and they will definitely change in dramatic/radical ways on the way to stabilization. Note that there is no project- or team-wide consensus on any of these constructs. I'm publishing them primarily as a crucial reference point, and to gain a level of shared understanding of the actual problems that need to be resolved, and the consequences of the design path we are on.

What's Changed

❗ Important

✂ PR body was truncated to here.


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate
renovate Bot force-pushed the renovate/apple-swift-collections-1.x branch from d1619ad to 50cffe7 Compare September 26, 2026 03:08
@renovate renovate Bot changed the title Update dependency apple/swift-collections to from: "1.7.0" Update dependency apple/swift-collections to from: "1.7.1" Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants