mirror of
https://github.com/apple/swift-collections
synced 2026-11-26 04:47:48 +00:00
Fix implementation of removeAll()
This commit is contained in:
1 parent
9ebb1ae5a3
commit
4ff4e75436
1 file changed
+4
-2
@@ -432,8 +432,10 @@ extension InputSpan where Element: ~Copyable {
|
||||
@_alwaysEmitIntoClient
|
||||
@_lifetime(self: copy self)
|
||||
public mutating func removeAll() {
|
||||
_ = unsafe _start().withMemoryRebound(to: Element.self, capacity: _count) {
|
||||
unsafe $0.deinitialize(count: _count)
|
||||
guard count > 0 else { return }
|
||||
let start = unsafe _unsafeRawAddressOfSlot(uncheckedOffset: 0)
|
||||
unsafe start.withMemoryRebound(to: Element.self, capacity: _count) {
|
||||
_ = unsafe $0.deinitialize(count: _count)
|
||||
}
|
||||
_count = 0
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user