Skip to content

Commit dfed279

Browse files
authored
Merge pull request #19706 from airspeedswift/further-pwnage
2 parents 37fca33 + ed64e7b commit dfed279

11 files changed

+23
-23
lines changed

stdlib/public/core/Array.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,7 +1280,7 @@ extension Array: RangeReplaceableCollection {
12801280
}
12811281

12821282
@inlinable
1283-
public func _copyToContiguousArray() -> ContiguousArray<Element> {
1283+
public __consuming func _copyToContiguousArray() -> ContiguousArray<Element> {
12841284
if let n = _buffer.requestNativeBuffer() {
12851285
return ContiguousArray(_buffer: n)
12861286
}
@@ -1490,7 +1490,7 @@ extension Array {
14901490
}
14911491

14921492
@inlinable
1493-
public func _copyContents(
1493+
public __consuming func _copyContents(
14941494
initializing buffer: UnsafeMutableBufferPointer<Element>
14951495
) -> (Iterator,UnsafeMutableBufferPointer<Element>.Index) {
14961496

stdlib/public/core/ContiguousArray.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ extension ContiguousArray: RangeReplaceableCollection {
759759
/// same array.
760760
@inlinable
761761
@_semantics("array.append_element")
762-
public mutating func append(_ newElement: Element) {
762+
public mutating func append(_ newElement: __owned Element) {
763763
_makeUniqueAndReserveCapacityIfNotUnique()
764764
let oldCount = _getCount()
765765
_reserveCapacityAssumingUniqueBuffer(oldCount: oldCount)
@@ -784,7 +784,7 @@ extension ContiguousArray: RangeReplaceableCollection {
784784
/// array.
785785
@inlinable
786786
@_semantics("array.append_contentsOf")
787-
public mutating func append<S: Sequence>(contentsOf newElements: S)
787+
public mutating func append<S: Sequence>(contentsOf newElements: __owned S)
788788
where S.Element == Element {
789789

790790
let newElementsCount = newElements.underestimatedCount

stdlib/public/core/ContiguousArrayBuffer.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
393393
/// just-initialized memory.
394394
@inlinable
395395
@discardableResult
396-
internal func _copyContents(
396+
internal __consuming func _copyContents(
397397
subRange bounds: Range<Int>,
398398
initializing target: UnsafeMutablePointer<Element>
399399
) -> UnsafeMutablePointer<Element> {
@@ -441,7 +441,7 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
441441
///
442442
/// - Complexity: O(1).
443443
@inlinable
444-
internal func _asCocoaArray() -> _NSArrayCore {
444+
internal __consuming func _asCocoaArray() -> _NSArrayCore {
445445
if count == 0 {
446446
return _emptyArrayStorage
447447
}
@@ -512,7 +512,7 @@ internal struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
512512
/// Append the elements of `rhs` to `lhs`.
513513
@inlinable
514514
internal func += <Element, C : Collection>(
515-
lhs: inout _ContiguousArrayBuffer<Element>, rhs: C
515+
lhs: inout _ContiguousArrayBuffer<Element>, rhs: __owned C
516516
) where C.Element == Element {
517517

518518
let oldCount = lhs.count
@@ -566,7 +566,7 @@ extension _ContiguousArrayBuffer : RandomAccessCollection {
566566

567567
extension Sequence {
568568
@inlinable
569-
public func _copyToContiguousArray() -> ContiguousArray<Element> {
569+
public __consuming func _copyToContiguousArray() -> ContiguousArray<Element> {
570570
return _copySequenceToContiguousArray(self)
571571
}
572572
}
@@ -599,14 +599,14 @@ internal func _copySequenceToContiguousArray<
599599

600600
extension Collection {
601601
@inlinable
602-
public func _copyToContiguousArray() -> ContiguousArray<Element> {
602+
public __consuming func _copyToContiguousArray() -> ContiguousArray<Element> {
603603
return _copyCollectionToContiguousArray(self)
604604
}
605605
}
606606

607607
extension _ContiguousArrayBuffer {
608608
@inlinable
609-
internal func _copyToContiguousArray() -> ContiguousArray<Element> {
609+
internal __consuming func _copyToContiguousArray() -> ContiguousArray<Element> {
610610
return ContiguousArray(_buffer: self)
611611
}
612612
}

stdlib/public/core/Dictionary.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,7 +1565,7 @@ extension Dictionary.Keys {
15651565

15661566
@inlinable
15671567
@inline(__always)
1568-
public func makeIterator() -> Iterator {
1568+
public __consuming func makeIterator() -> Iterator {
15691569
return Iterator(_variant.makeIterator())
15701570
}
15711571
}
@@ -1598,7 +1598,7 @@ extension Dictionary.Values {
15981598

15991599
@inlinable
16001600
@inline(__always)
1601-
public func makeIterator() -> Iterator {
1601+
public __consuming func makeIterator() -> Iterator {
16021602
return Iterator(_variant.makeIterator())
16031603
}
16041604
}

stdlib/public/core/ExistentialCollection.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,12 +804,12 @@ extension Any${Kind} {
804804
}
805805

806806
@inlinable
807-
public func _copyToContiguousArray() -> ContiguousArray<Element> {
807+
public __consuming func _copyToContiguousArray() -> ContiguousArray<Element> {
808808
return self._box.__copyToContiguousArray()
809809
}
810810

811811
@inlinable
812-
public func _copyContents(initializing buf: UnsafeMutableBufferPointer<Element>)
812+
public __consuming func _copyContents(initializing buf: UnsafeMutableBufferPointer<Element>)
813813
-> (AnyIterator<Element>,UnsafeMutableBufferPointer<Element>.Index) {
814814
let (it,idx) = _box.__copyContents(initializing: buf)
815815
return (AnyIterator(it),idx)

stdlib/public/core/Filter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ extension LazyFilterCollection : LazySequenceProtocol {
140140
public var underestimatedCount: Int { return 0 }
141141

142142
@inlinable // lazy-performance
143-
public func _copyToContiguousArray() -> ContiguousArray<Base.Element> {
143+
public __consuming func _copyToContiguousArray() -> ContiguousArray<Base.Element> {
144144

145145
// The default implementation of `_copyToContiguousArray` queries the
146146
// `count` property, which evaluates `_predicate` for every element --

stdlib/public/core/Flatten.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ extension FlattenCollection : Sequence {
261261
public var underestimatedCount: Int { return 0 }
262262

263263
@inlinable // lazy-performance
264-
public func _copyToContiguousArray() -> ContiguousArray<Base.Element.Element> {
264+
public __consuming func _copyToContiguousArray() -> ContiguousArray<Base.Element.Element> {
265265
// The default implementation of `_copyToContiguousArray` queries the
266266
// `count` property, which materializes every inner collection. This is a
267267
// bad default for `flatMap()`. So we treat `self` as a sequence and only

stdlib/public/core/Join.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ extension JoinedSequence: Sequence {
131131
}
132132

133133
@inlinable // lazy-performance
134-
public func _copyToContiguousArray() -> ContiguousArray<Element> {
134+
public __consuming func _copyToContiguousArray() -> ContiguousArray<Element> {
135135
var result = ContiguousArray<Element>()
136136
let separatorSize: Int = numericCast(_separator.count)
137137

stdlib/public/core/LazyCollection.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ extension LazyCollection : Sequence {
9393
public var underestimatedCount: Int { return _base.underestimatedCount }
9494

9595
@inlinable
96-
public func _copyToContiguousArray()
96+
public __consuming func _copyToContiguousArray()
9797
-> ContiguousArray<Base.Element> {
9898
return _base._copyToContiguousArray()
9999
}
100100

101101
@inlinable
102-
public func _copyContents(
102+
public __consuming func _copyContents(
103103
initializing buf: UnsafeMutableBufferPointer<Element>
104104
) -> (Iterator,UnsafeMutableBufferPointer<Element>.Index) {
105105
return _base._copyContents(initializing: buf)

stdlib/public/core/SequenceWrapper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ extension _SequenceWrapper where Iterator == Base.Iterator {
4848

4949
@inlinable // generic-performance
5050
@discardableResult
51-
public func _copyContents(
51+
public __consuming func _copyContents(
5252
initializing buf: UnsafeMutableBufferPointer<Element>
5353
) -> (Iterator, UnsafeMutableBufferPointer<Element>.Index) {
5454
return _base._copyContents(initializing: buf)

stdlib/public/core/SliceBuffer.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ internal struct _SliceBuffer<Element>
9292
internal mutating func replaceSubrange<C>(
9393
_ subrange: Range<Int>,
9494
with insertCount: Int,
95-
elementsOf newValues: C
95+
elementsOf newValues: __owned C
9696
) where C : Collection, C.Element == Element {
9797

9898
_invariantCheck()
@@ -221,7 +221,7 @@ internal struct _SliceBuffer<Element>
221221

222222
@inlinable // FIXME(sil-serialize-all)
223223
@discardableResult
224-
internal func _copyContents(
224+
internal __consuming func _copyContents(
225225
subRange bounds: Range<Int>,
226226
initializing target: UnsafeMutablePointer<Element>
227227
) -> UnsafeMutablePointer<Element> {
@@ -372,7 +372,7 @@ internal struct _SliceBuffer<Element>
372372

373373
extension _SliceBuffer {
374374
@inlinable // FIXME(sil-serialize-all)
375-
internal func _copyToContiguousArray() -> ContiguousArray<Element> {
375+
internal __consuming func _copyToContiguousArray() -> ContiguousArray<Element> {
376376
if _hasNativeBuffer {
377377
let n = nativeBuffer
378378
if count == n.count {

0 commit comments

Comments
 (0)