You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change allows noncopyable and nonescapable Sequence types, with
room for generalizing the Element type to be ~Copyable in the future.
The new prototype adds a BorrowingIterator associated type to Sequence
This commit adds a BorrowingIteratorProtocol for generalized bulk
iteration, a BorrowingIteratorAdapter as an implementation of the new
Sequence requirement for existing sequences, and a NeverIterator for
new noncopyable/nonescapable sequence types. Conformance to Sequence
for Span and InlineArray is also included.
Issues:
- Availability checking must be off due to the availability
requirements on the new Sequence.BorrowingIterator associated type
- Several existing sequences needed an explicit Element type alias to
compile (note that this was during experimentation, so it may be
possible to back out these changes)
- Some of the default implementations for generalized sequences simply
fatal error
- InlineArray is a tricky case, due to its conditionally copyable
design. It conforms to Sequence unconditionally, so it needs an
unconditional implementation of (the original) Iterator associated
type. However, when Sequence can use ~Copyable elements, that
implementation won't be workable, since (a) it copies the inline
array, and (b) it implements the `next() -> Element?` method, which
can't return a noncopyable element.
0 commit comments