Skip to content

Commit da61476

Browse files
committed
Make reduce(inout:) take its initial value owned
1 parent e012655 commit da61476

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

stdlib/public/core/SequenceAlgorithms.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ extension Sequence {
723723
/// - Complexity: O(*n*), where *n* is the length of the sequence.
724724
@inlinable
725725
public func reduce<Result>(
726-
into initialResult: Result,
726+
into initialResult: __owned Result,
727727
_ updateAccumulatingResult:
728728
(_ partialResult: inout Result, Element) throws -> ()
729729
) rethrows -> Result {

test/api-digester/Outputs/stability-stdlib-abi.swift.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,3 +528,5 @@ Class _StringStorage has changed its super class from _AbstractStringStorage to
528528
Constructor _AbstractStringStorage.init() has been removed
529529
Func _AbstractStringStorage.copy(with:) has been removed
530530
Func _AbstractStringStorage.getOrComputeBreadcrumbs() has been removed
531+
532+
Func Sequence.reduce(into:_:) has parameter 0 changing from Default to Owned

test/api-digester/Outputs/stability-stdlib-source.swift.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,5 @@ Func LazyCollectionProtocol.map(_:) has been removed
210210
Func LazyCollectionProtocol.prefix(while:) has been removed
211211
Func LazyCollectionProtocol.reversed() has been removed
212212
Var LazyCollectionProtocol.lazy has declared type change from LazyCollection<Self.Elements> to LazySequence<Self.Elements>
213+
214+
Func Sequence.reduce(into:_:) has parameter 0 changing from Default to Owned

0 commit comments

Comments
 (0)