Skip to content

Commit 71a8c89

Browse files
Catfish-Manlorentey
andcommitted
Assert that the incoming elements have a correct count implementation
Co-authored-by: Karoy Lorentey <[email protected]>
1 parent 258c5b5 commit 71a8c89

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

stdlib/public/core/Array.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,8 @@ extension Array: RangeReplaceableCollection {
12401240
start: startNewElements,
12411241
count: _buffer.mutableCapacity - oldCount)
12421242

1243-
_ = buf.initialize(fromContentsOf: newElements)
1243+
let end = buf.initialize(fromContentsOf: newElements)
1244+
_precondition(end == buf.endIndex)
12441245
_buffer.mutableCount = _buffer.mutableCount + newElementsCount
12451246
}
12461247

0 commit comments

Comments
 (0)