Fix implementation of removeAll()

This commit is contained in:
Guillaume Lessard committed 2026-10-14 17:28:49 -07:00
1 parent 9ebb1ae5a3
commit 4ff4e75436
1 file changed
+4 -2
+4 -2
View File
@@ -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
}