Skip to content

Commit 3e73445

Browse files
authored
Merge pull request #61093 from glessard/se0370-primary-associated-types
[stdlib] use a primary associated type
2 parents 43c5cf9 + 4f4bfba commit 3e73445

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

stdlib/public/core/UnsafeBufferPointer.swift.gyb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -708,9 +708,9 @@ extension Unsafe${Mutable}BufferPointer {
708708
/// by this function.
709709
@inlinable
710710
@_alwaysEmitIntoClient
711-
public func initialize<C: Collection>(
712-
fromContentsOf source: C
713-
) -> Index where C.Element == Element {
711+
public func initialize(
712+
fromContentsOf source: some Collection<Element>
713+
) -> Index {
714714
let count = source.withContiguousStorageIfAvailable {
715715
guard let sourceAddress = $0.baseAddress, !$0.isEmpty else {
716716
return 0
@@ -811,9 +811,9 @@ extension Unsafe${Mutable}BufferPointer {
811811
/// - Returns: An index one past the index of the last element updated.
812812
@inlinable
813813
@_alwaysEmitIntoClient
814-
public func update<C: Collection>(
815-
fromContentsOf source: C
816-
) -> Index where C.Element == Element {
814+
public func update(
815+
fromContentsOf source: some Collection<Element>
816+
) -> Index {
817817
let count = source.withContiguousStorageIfAvailable {
818818
guard let sourceAddress = $0.baseAddress else {
819819
return 0

stdlib/public/core/UnsafeBufferPointerSlice.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -785,9 +785,9 @@ extension Slice {
785785
/// initialized by this function.
786786
@inlinable
787787
@_alwaysEmitIntoClient
788-
public func initialize<C: Collection>(
789-
fromContentsOf source: C
790-
) -> Index where Base == UnsafeMutableBufferPointer<C.Element> {
788+
public func initialize<Element>(
789+
fromContentsOf source: some Collection<Element>
790+
) -> Index where Base == UnsafeMutableBufferPointer<Element> {
791791
let buffer = Base(rebasing: self)
792792
let index = buffer.initialize(fromContentsOf: source)
793793
let distance = buffer.distance(from: buffer.startIndex, to: index)
@@ -855,9 +855,9 @@ extension Slice {
855855
/// - Returns: An index one past the index of the last element updated.
856856
@inlinable
857857
@_alwaysEmitIntoClient
858-
public func update<C: Collection>(
859-
fromContentsOf source: C
860-
) -> Index where Base == UnsafeMutableBufferPointer<C.Element> {
858+
public func update<Element>(
859+
fromContentsOf source: some Collection<Element>
860+
) -> Index where Base == UnsafeMutableBufferPointer<Element> {
861861
let buffer = Base(rebasing: self)
862862
let index = buffer.update(fromContentsOf: source)
863863
let distance = buffer.distance(from: buffer.startIndex, to: index)

0 commit comments

Comments
 (0)