diff options
Diffstat (limited to '')
-rw-r--r-- | src/binary_heap.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/binary_heap.rs b/src/binary_heap.rs index f82f3d7d..dc9ea590 100644 --- a/src/binary_heap.rs +++ b/src/binary_heap.rs @@ -428,8 +428,9 @@ impl<'a, T> Hole<'a, T> { unsafe fn move_to(&mut self, index: usize) { debug_assert!(index != self.pos); debug_assert!(index < self.data.len()); - let index_ptr: *const _ = self.data.get_unchecked(index); - let hole_ptr = self.data.get_unchecked_mut(self.pos); + let ptr = self.data.as_mut_ptr(); + let index_ptr: *const _ = ptr.add(index); + let hole_ptr = ptr.add(self.pos); ptr::copy_nonoverlapping(index_ptr, hole_ptr, 1); self.pos = index; } |