Skip to content

Commit 246ff1b

Browse files
committed
Working build!
1 parent e8a0829 commit 246ff1b

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

stdlib/public/core/BorrowingIteratorProtocol.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,26 @@ extension Span: BorrowingIteratorProtocol where Element: ~Copyable {
148148
}
149149
}
150150

151+
@available(SwiftStdlib 6.3, *)
152+
extension Span /*: Sequence /* where Element: ~Copyable */ */ {
153+
@_alwaysEmitIntoClient
154+
@_lifetime(borrow self)
155+
public func makeBorrowingIterator() -> Span<Element> {
156+
self
157+
}
158+
}
159+
160+
extension InlineArray: Sequence /* where Element: ~Copyable */ {
161+
public typealias Element = Element
162+
public typealias Iterator = NeverIterator<Element>
163+
164+
@_alwaysEmitIntoClient
165+
@_lifetime(borrow self)
166+
public func makeBorrowingIterator() -> Span<Element> {
167+
self.span
168+
}
169+
}
170+
151171
//@available(SwiftStdlib 6.3, *)
152172
//extension MutableSpan: Iterable where Element: ~Copyable {
153173
// public typealias BorrowIterator = Span<Element>.BorrowIterator

stdlib/public/core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ endif()
340340

341341
# STAGING: Temporarily avoids having to write #fileID in Swift.swiftinterface.
342342
list(APPEND swift_stdlib_compile_flags "-Xfrontend" "-enable-experimental-concise-pound-file")
343+
list(APPEND swift_stdlib_compile_flags "-Xfrontend" "-disable-availability-checking")
343344

344345
list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "Macros")
345346
list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "FreestandingMacros")

stdlib/public/core/Sequence.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,7 @@ public protocol Sequence<Element> /* : ~Copyable, ~Escapable */ {
331331
associatedtype Iterator: IteratorProtocol<Element>
332332

333333
@available(SwiftStdlib 6.3, *)
334-
associatedtype BorrowingIterator: BorrowingIteratorProtocol & ~Copyable & ~Escapable /* where BorrowingIterator.Element == Element */
335-
= BorrowingIteratorAdapter<Self>
334+
associatedtype BorrowingIterator: BorrowingIteratorProtocol<Element> & ~Copyable & ~Escapable = BorrowingIteratorAdapter<Self>
336335

337336
// FIXME: <rdar://problem/34142121>
338337
// This typealias should be removed as it predates the source compatibility
@@ -465,7 +464,9 @@ public struct BorrowingIteratorAdapter<S: Sequence>: /* & ~Copyable & ~Escapable
465464
{
466465
var iterator: S.Iterator
467466
var curValue: S.Element?
468-
467+
468+
public typealias Element = S.Element
469+
469470
@lifetime(&self)
470471
public mutating func nextSpan(maximumCount: Int) -> Span<S.Element> {
471472
curValue = iterator.next()
@@ -480,7 +481,7 @@ public enum NeverIterator<Element: ~Copyable> {}
480481
extension NeverIterator: IteratorProtocol { /* where Element: ~Copyable */
481482
public typealias Element = Element
482483
public func next() -> Element? {
483-
fatalError()
484+
Builtin.unreachable()
484485
}
485486
}
486487

@@ -491,6 +492,13 @@ extension Sequence where BorrowingIterator == BorrowingIteratorAdapter<Self> {
491492
}
492493
}
493494

495+
@available(SwiftStdlib 6.3, *)
496+
extension Sequence where Iterator == NeverIterator<Element> {
497+
public func makeIterator() -> Iterator {
498+
fatalError("Attempt to iterate using a NeverIterator")
499+
}
500+
}
501+
494502
// Provides a default associated type witness for Iterator when the
495503
// Self type is both a Sequence and an Iterator.
496504
extension Sequence where Self: IteratorProtocol {

0 commit comments

Comments
 (0)