Skip to content

[stdlib] add missing Element type witnesses #70142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions stdlib/public/core/Bitset.swift
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,12 @@ extension _UnsafeBitset.Word {
// problems in normal use, because `next()` is usually called on a separate
// iterator, not the original word.
extension _UnsafeBitset.Word: Sequence, IteratorProtocol {

#if $NoncopyableGenerics
@usableFromInline
typealias Element = Int
#endif

@inlinable
internal var count: Int {
return value.nonzeroBitCount
Expand Down
5 changes: 5 additions & 0 deletions stdlib/public/core/ExistentialCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,11 @@ internal struct _ClosureBasedSequence<Iterator: IteratorProtocol> {
}

extension _ClosureBasedSequence: Sequence {

#if $NoncopyableGenerics
public typealias Element = Iterator.Element
#endif

@inlinable
internal func makeIterator() -> Iterator {
return _makeUnderlyingIterator()
Expand Down
5 changes: 5 additions & 0 deletions stdlib/public/core/Sequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,11 @@ public struct IteratorSequence<Base: IteratorProtocol> {
}

extension IteratorSequence: IteratorProtocol, Sequence {

#if $NoncopyableGenerics
public typealias Element = Base.Element
#endif

/// Advances to the next element and returns it, or `nil` if no next element
/// exists.
///
Expand Down