mirror of
https://github.com/apple/swift-collections
synced 2026-11-25 04:37:48 +00:00
Merge pull request #570 from lorentey/remove-outputspan-workaround
Remove workaround for bug in OutputSpan.wUMBP
This commit is contained in:
13 files changed
+27
-62
No files matched your search
@@ -150,7 +150,7 @@ extension RigidArray where Element: ~Copyable {
|
||||
public mutating func append(
|
||||
moving items: inout OutputSpan<Element>
|
||||
) {
|
||||
items._withUnsafeMutableBufferPointer { buffer, count in
|
||||
items.withUnsafeMutableBufferPointer { buffer, count in
|
||||
let source = buffer._extracting(first: count)
|
||||
unsafe self.append(moving: source)
|
||||
count = 0
|
||||
|
||||
@@ -197,7 +197,7 @@ extension RigidArray where Element: ~Copyable {
|
||||
moving items: inout OutputSpan<Element>,
|
||||
at index: Int
|
||||
) {
|
||||
items._withUnsafeMutableBufferPointer { buffer, count in
|
||||
items.withUnsafeMutableBufferPointer { buffer, count in
|
||||
let source = buffer._extracting(first: count)
|
||||
unsafe self.insert(moving: source, at: index)
|
||||
count = 0
|
||||
|
||||
@@ -242,7 +242,7 @@ extension RigidArray where Element: ~Copyable {
|
||||
moving newElements: UnsafeMutableBufferPointer<Element>,
|
||||
) {
|
||||
replace(removing: subrange, addingCount: newElements.count) { target in
|
||||
target._withUnsafeMutableBufferPointer { buffer, count in
|
||||
target.withUnsafeMutableBufferPointer { buffer, count in
|
||||
count = unsafe buffer._moveInitializePrefix(from: newElements)
|
||||
}
|
||||
}
|
||||
@@ -319,7 +319,7 @@ extension RigidArray where Element: ~Copyable {
|
||||
removing subrange: Range<Int>,
|
||||
moving items: inout OutputSpan<Element>
|
||||
) {
|
||||
items._withUnsafeMutableBufferPointer { buffer, count in
|
||||
items.withUnsafeMutableBufferPointer { buffer, count in
|
||||
let source = buffer._extracting(first: count)
|
||||
unsafe self.replace(removing: subrange, moving: source)
|
||||
count = 0
|
||||
@@ -442,7 +442,7 @@ extension RigidArray {
|
||||
copying newElements: UnsafeBufferPointer<Element>
|
||||
) {
|
||||
replace(removing: subrange, addingCount: newElements.count) { target in
|
||||
target._withUnsafeMutableBufferPointer { buffer, count in
|
||||
target.withUnsafeMutableBufferPointer { buffer, count in
|
||||
count = unsafe buffer._initializePrefix(copying: newElements)
|
||||
}
|
||||
}
|
||||
@@ -552,7 +552,7 @@ extension RigidArray {
|
||||
newCount: Int
|
||||
) {
|
||||
self.replace(removing: subrange, addingCount: newCount) { target in
|
||||
target._withUnsafeMutableBufferPointer { dst, dstCount in
|
||||
target.withUnsafeMutableBufferPointer { dst, dstCount in
|
||||
let done: Void? = newElements.withContiguousStorageIfAvailable { src in
|
||||
let i = unsafe dst._initializePrefix(copying: src)
|
||||
precondition(
|
||||
|
||||
Reference in new issue
Block a user