[ContainersPreview] Remove BorrowingSequence.first

This property is unnecessary; it was just demonstrating an old problem. It clashes with the classic `Collection.first`, and that renders invocations of that ambiguous in code that uses Collection types that also have a BorrowingSequence conformance.
This commit is contained in:
Karoy Lorentey committed 2026-03-09 16:11:56 -07:00
1 parent fcdacbbaa2
commit 3b10b992bc
1 file changed
-13
@@ -47,19 +47,6 @@ extension BorrowingSequence where Self: Sequence {
}
}
@available(SwiftStdlib 5.0, *)
extension BorrowingSequence where Element: Copyable {
// FIXME: How do we expect this to work for ~Copyable elements?
public var first: Element? {
var it = makeBorrowingIterator()
let span = it.nextSpan(maximumCount: 1)
guard !span.isEmpty else { return nil }
return span[0]
}
}
@available(SwiftStdlib 5.0, *)
extension BorrowingSequence where Self: ~Copyable & ~Escapable {
/// Implementation demo of what borrowing for-in loops would need to expand into.