- Introduce easy-to-use `replace(removing:addingFrom:)`, `insert(from:at:)`, and `append(from:)` algorithms that take `CountedProducer` instances, avoiding having to pass explicit counts separately
- Avoid RangeExpression2 helpers from satisfying core protocol requirements, leading to broken conformances
- Add `replace(removing:moving:)`, `replace(removing:consuming:)`, `insert(moving:at:)`, `insert(consuming:at:)`, `append(moving:)`, `append(consuming:)` operations that take range-replaceable containers.
- Reorder some parameters for consistency/readability:
- `insert(addingCount:at:from:)` → `insert(addingCount:from:at:)`
- `insert(at:moving:from:)` → `insert(moving:from:at:)`
Use `override`/`@_nonoverride` to help associated type inference and to allow diverging implementations of select requirements in BidirectionalContainer, RandomAccessContainer, and MutableContainer.
- UniqueBox is public API, so we cannot remove it in favor of the stdlib’s
- Remove Ref and MutableRef. Keep an internal _MutableRef to work around stdlib limitations.
Package traits already pass defines with their trait name when building. Instead of adding our own conditional defines based on the traits we can use the trait provided defines directly. I observed that various tooling behaves better with the trait provided defines.
These (and `@_unsafeSelfDependentResult`) are only usable on 6.4 snapshots. As 6.4 hasn’t shipped yet, we need to also make these conditional on the UnstableContainersPreview trait.
This slows down the default implementations of `distance(from:to:)` and `index(_:offsetBy:limitedBy:)`, but it allows linked lists to conform to `Container`. The trade off seems fair.
While we’re here, flesh out the `BidirectionalContainer` refinements a little, and add `Container.isEmpty` and `._custom[Last]IndexOfEquatableElement(_:)`.
This code is still untested.
Adds trailing underscores to the BorrowingSequence protocols and
requirements, in order to allow both parallel conformances and
the ability to evolve the requirements in this package.
This updates the ContainersPreview module to use the same
API as the proposed BorrowingSequence protocol and its supporting
types. In particular, instead of using Span as the iterator for
itself and other contiguously-stored types, this introduces
SpanIterator.
“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.