mirror of
https://github.com/apple/swift-collections
synced 2026-11-24 04:27:53 +00:00
[BasicContainers] Fix UniqueArray.append(moving:) dropping and leaking every element
Signed-off-by: Aniket <aniketkomailkro@gmail.com>
This commit is contained in:
1 parent
b905c889ff
commit
80d8052b4b
2 files changed
+27
-1
No files matched your search
@@ -160,8 +160,9 @@ extension UniqueArray where Element: ~Copyable {
|
||||
_ensureFreeCapacity(items.count)
|
||||
return items.edit { source in
|
||||
unsafe source.withUnsafeMutableBufferPointer { buffer, count in
|
||||
let extracted = unsafe buffer._extracting(first: count)
|
||||
count = 0
|
||||
return unsafe _storage.append(moving: buffer._extracting(first: count))
|
||||
return unsafe _storage.append(moving: extracted)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user