File tree 1 file changed +4
-0
lines changed
library/alloc/src/collections
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> {
571
571
// child + 1 < end <= self.len(), so they're valid indexes.
572
572
// child == 2 * hole.pos() + 1 != hole.pos() and
573
573
// 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
574
576
child += unsafe { hole. get ( child) <= hole. get ( child + 1 ) } as usize ;
575
577
576
578
// if we are already in order, stop.
@@ -627,6 +629,8 @@ impl<T: Ord> BinaryHeap<T> {
627
629
// child + 1 < end <= self.len(), so they're valid indexes.
628
630
// child == 2 * hole.pos() + 1 != hole.pos() and
629
631
// 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
630
634
child += unsafe { hole. get ( child) <= hole. get ( child + 1 ) } as usize ;
631
635
632
636
// SAFETY: Same as above
You can’t perform that action at this time.
0 commit comments