[HeapModule] Heap._UnsafeHandle.swapAt(_:with:): Add missing bounds assertion

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Karoy LorenteyandClaude Sonnet 4.6 committed 2026-05-01 15:13:59 -07:00
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)
}