Skip to content

[stdlib] use a primary associated type for initialize(fromContentsOf:) #61089

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

Closed
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
12 changes: 6 additions & 6 deletions stdlib/public/core/UnsafeBufferPointer.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -711,9 +711,9 @@ extension Unsafe${Mutable}BufferPointer {
/// by this function.
@inlinable
@_alwaysEmitIntoClient
public func initialize<C: Collection>(
fromContentsOf source: C
) -> Index where C.Element == Element {
public func initialize(
fromContentsOf source: some Collection<Element>
) -> Index {
let count = source.withContiguousStorageIfAvailable {
guard let sourceAddress = $0.baseAddress, !$0.isEmpty else {
return 0
Expand Down Expand Up @@ -814,9 +814,9 @@ extension Unsafe${Mutable}BufferPointer {
/// - Returns: An index one past the index of the last element updated.
@inlinable
@_alwaysEmitIntoClient
public func update<C: Collection>(
fromContentsOf source: C
) -> Index where C.Element == Element {
public func update(
fromContentsOf source: some Collection<Element>
) -> Index {
let count = source.withContiguousStorageIfAvailable {
guard let sourceAddress = $0.baseAddress else {
return 0
Expand Down