From 3b10b992bca8a1363cd4af76efcf651873d021e1 Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Mon, 9 Mar 2026 16:11:56 -0700 Subject: [PATCH] [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. --- .../Protocols/BorrowingSequence.swift | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Sources/ContainersPreview/Protocols/BorrowingSequence.swift b/Sources/ContainersPreview/Protocols/BorrowingSequence.swift index 9c90ef0e..7601184e 100644 --- a/Sources/ContainersPreview/Protocols/BorrowingSequence.swift +++ b/Sources/ContainersPreview/Protocols/BorrowingSequence.swift @@ -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.