Update dependency apple/swift-collections to from: "1.4.0"#235
Merged
renovate[bot] merged 1 commit intomainfrom Mar 7, 2026
Merged
Update dependency apple/swift-collections to from: "1.4.0"#235renovate[bot] merged 1 commit intomainfrom
renovate[bot] merged 1 commit intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
from: "1.3.0"→from: "1.4.0"Release Notes
apple/swift-collections (apple/swift-collections)
v1.4.0: Swift Collections 1.4.0Compare Source
This feature release supports Swift toolchain versions 6.0, 6.1 and 6.2. It includes a variety of bug fixes, and ships the following new features:
New ownership-aware ring buffer and hashed container implementations
In the
DequeModulemodule, we have two new source-stable types that provide ownership-aware ring buffer implementations:struct UniqueDeque<Element>is a uniquely held, dynamically resizing, noncopyable deque.struct RigidDeque<Element>is a fixed-capacity deque implementation.RigidDeque/UniqueDequeare toDequelikeRigidArray/UniqueArrayare toArray-- they provide noncopyable embodiments of the same basic data structure, with many of the same operations.In the
BasicContainersmodule, this release adds previews of four new types, implementing ownership-aware hashed containers:struct UniqueSet<Element>is a uniquely held, dynamically resizing set.struct RigidSet<Element>is a fixed-capacity set.struct UniqueDictionary<Key, Value>is a uniquely held, dynamically resizing dictionary.struct RigidDictionary<Key, Value>is a fixed-capacity dictionary.These are direct analogues of the standard
SetandDictionarytypes. These types are built on top of theEquatableandHashableprotocol generalizations that were proposed in SE-0499; as that proposal is not yet implemented in any shipping toolchain, these new types are shipping as source-unstable previews, conditional on a newUnstableHashedContainerspackage trait. The final API of these types will also deeply depend on thestruct Borrowandstruct Inoutproposals (and potentially other language/stdlib improvements) that are currently working their way through the Swift Evolution process. Accordingly, we may need to make source-breaking changes to the interfaces of these types -- they are not ready to be blessed as Public API. However, we encourage intrepid engineers to try them on for size, and report pain points. (Of which we expect there will be many in this first preview.)We continue the pattern of
Rigid-andUnique-naming prefixes with these new types:Uniquetypes (UniqueArray,UniqueDeque,UniqueSet,UniqueDictionaryetc.) are dynamically self-sizing containers that automatically reallocate their storage as needed to best accommodate their contents; theUniqueprefix was chosen to highlight that these types are always uniquely held, avoiding the complications of mutating shared copies.Rigidtypes remove dynamic sizing, and they operate strictly within an explicitly configured capacity. Dynamic sizing is not always appropriate -- when targeting space- or time-constrained environments (think embedded use cases or real-time work), it is preferable to avoid implicit reallocations, and to instead choose to have explicit control over when (and if) storage is reallocated, and to what size. This is where theRigidtypes come in: their instances are created with a specific capacity and it is a runtime error to exceed that. This makes them quite inflexible (hence the "rigid" qualifier), but in exchange, their operations provide far stricter complexity guarantees: they exhibit no random runtime latency spikes, and they can trivially fit in strict memory budgets.Early drafts of borrowing sequence, generative iteration and container protocols
This release includes highly experimental but working implementations of new protocols supplying ownership-aware alternatives to the classic
Sequence/Collectionprotocol hierarchy. These protocols and the generic operations built on top of them can be turned on by enabling theUnstableContainersPreviewpackage trait.protocol BorrowingSequence<Element>models borrowing sequences with ephemeral lifetimes. (This is already progressing through Swift Evolution.)protocol Container<Element>models constructs that physically store their contents, and can expose stable spans over them.protocol Producer<Element, ProducerError>models a generative iterator -- a construct that generates items demand.protocol Drain<Element>refinesProducerto model an in-place consumable elements -- primarily for use around container types.In this version, the package has developed these protocols just enough to implement basic generic operations for moving data between containers like
UniqueArrayandRigidDeque. As we gain experience using these, future releases may start adding basic generic algorithms, more protocols (bidirectional, random-access, (per)mutable, range-replaceable containers etc.) convenience adapters, and other features -- or we may end up entirely overhauling or simply discarding some/all of them. Accordingly, the experimental interfaces enabled byUnstableContainersPrevieware not source stable, and they are not intended for production use. We expect the eventual production version of these (or whatever designs they evolve into) to ship in the Swift Standard Library. We do highly recommend interested folks to try playing with these, to get a feel for the strange problems of Ownership.Besides these protocols, the package also defines rudimentary substitutes of some basic primitives that belong in the Standard Library:
struct InputSpan<Element>the dual ofOutputSpan-- whileOutputSpanis primarily for moving items into somebody else's storage,InputSpanenables safely moving items out of storage.struct Borrow<Target>represents a borrowing reference to an item. (This package models this with a pointer, which is an ill-fitting substitute for the real implementation in the stdlib.)struct Inout<Target>represents a mutating reference to an item.A formal way to access
SortedSetandSortedDictionarytypesThe
SortedCollectionsmodule contains (preexisting) early drafts of two sorted collection typesSortedSetandSortedDictionary, built on top of an in-memory B-tree implementation. This release defines anUnstableSortedCollectionspackage trait that can be used to enable building these types for experimentation without manually modifying the package. Like in previous releases, these implementations remain unfinished in this release, with known API issues; accordingly, these types remain unstable. (Issue #1 remains open.) Future package releases may change their interface in ways that break source compatibility, or they may remove these types altogether.Minor interface-level changes
The
Collectionsmodule no longer uses the unstable@_exported importfeature. Instead, it publishes public typealiases of every type that it previously reexported fromDequeModule,OrderedCollections,BitCollections,HeapModuleandHashTreeCollections.We renamed some
RigidArray/UniqueArrayoperations to improve their clarity at the point of use. The old names are still available, but deprecated.append(count:initializingWith:)append(addingCount:initializingWith:)insert(count:at:initializingWith:)insert(addingCount:at:initializingWith:)replaceSubrange(_:newCount:initializingWith:)replace(removing:addingCount:initializingWith:)replaceSubrange(_:moving:)replace(removing:moving:)replaceSubrange(_:copying:)replace(removing:copying:)copy()clone()copy(capacity:)clone(capacity:)We have now defined a complete set of
OutputSpan/InputSpan-basedappend/insert/replace/consumeprimitives, fully generalized to be implementable by piecewise contiguous containers. These operations pave the way for aContainer-based analogue of the classicRangeReplaceableCollectionprotocol, with most of the user-facing operations becoming standard generic algorithms built on top of these primitives:The package no longer uses the code generation tool
gyb.What's Changed
packageaccess modifier and get rid of gybbing by @lorentey in #526RigidDequeandUniqueDequeby @lorentey in #557@_exported importby @lorentey in #566RigidArray/UniqueArrayupdates by @lorentey in #569RigidArray/UniqueArray: Add new copying span initializers by @Azoy in #572RigidDeque/UniqueDeque: Add some top-level documentation by @lorentey in #571maximumCountby @lorentey in #575update(with:)method by @benrimmington in #538span(after/before:)(+ other doc fixes) by @natecook1000 in #541New Contributors
Full Changelog: apple/swift-collections@1.3.0...1.4.0
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.