mirror of
https://github.com/apple/swift-collections
synced 2026-11-28 05:04:21 +00:00
[HeapModule] Heap._UnsafeHandle.swapAt(_:with:): Add missing bounds assertion
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
dd6dd8a445
commit
9e2f57eddf
1 file changed
+1
@@ -76,6 +76,7 @@ extension Heap._UnsafeHandle {
|
||||
/// Swaps the element at the given node with the supplied value.
|
||||
@inlinable @inline(__always)
|
||||
internal func swapAt(_ i: _HeapNode, with value: inout Element) {
|
||||
assert(i.offset < count)
|
||||
let p = buffer.baseAddress.unsafelyUnwrapped + i.offset
|
||||
swap(&p.pointee, &value)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user