File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
library/alloc/src/collections Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -571,6 +571,8 @@ impl<T: Ord> BinaryHeap<T> {
571571 // child + 1 < end <= self.len(), so they're valid indexes.
572572 // child == 2 * hole.pos() + 1 != hole.pos() and
573573 // child + 1 == 2 * hole.pos() + 2 != hole.pos().
574+ // FIXME: 2 * hole.pos() + 1 or 2 * hole.pos() + 2 could overflow
575+ // if T is a ZST
574576 child += unsafe { hole. get ( child) <= hole. get ( child + 1 ) } as usize ;
575577
576578 // if we are already in order, stop.
@@ -627,6 +629,8 @@ impl<T: Ord> BinaryHeap<T> {
627629 // child + 1 < end <= self.len(), so they're valid indexes.
628630 // child == 2 * hole.pos() + 1 != hole.pos() and
629631 // child + 1 == 2 * hole.pos() + 2 != hole.pos().
632+ // FIXME: 2 * hole.pos() + 1 or 2 * hole.pos() + 2 could overflow
633+ // if T is a ZST
630634 child += unsafe { hole. get ( child) <= hole. get ( child + 1 ) } as usize ;
631635
632636 // SAFETY: Same as above
You can’t perform that action at this time.
0 commit comments