efebe45cc0
collections: Make BinaryHeap panic safe in sift_up / sift_down Use a struct called Hole that keeps track of an invalid location in the vector and fills the hole on drop. I include a run-pass test that the current BinaryHeap fails, and the new one passes. NOTE: The BinaryHeap will still be inconsistent after a comparison fails. It will not have the heap property. What we fix is just that elements will be valid values. This is actually a performance win -- the new code does not bother to write in `zeroed()` values in the holes, it just leaves them as they were. Net result is something like a 5% decrease in runtime for `BinaryHeap::from_vec`. This can be further improved by using unchecked indexing (I confirmed it makes a difference, not a surprise with the non-sequential access going on), but let's leave that for another PR. Safety first 😉 Fixes #25842 |
||
---|---|---|
.. | ||
compiler-rt@58ab642c30 | ||
compiletest | ||
doc | ||
driver | ||
error-index-generator | ||
etc | ||
grammar | ||
jemalloc@e24a1a025a | ||
liballoc | ||
libarena | ||
libbacktrace | ||
libcollections | ||
libcollectionstest | ||
libcore | ||
libcoretest | ||
libflate | ||
libfmt_macros | ||
libgetopts | ||
libgraphviz | ||
liblibc | ||
liblog | ||
librand | ||
librbml | ||
librustc | ||
librustc_back | ||
librustc_bitflags | ||
librustc_borrowck | ||
librustc_data_structures | ||
librustc_driver | ||
librustc_lint | ||
librustc_llvm | ||
librustc_privacy | ||
librustc_resolve | ||
librustc_trans | ||
librustc_typeck | ||
librustc_unicode | ||
librustdoc | ||
libserialize | ||
libstd | ||
libsyntax | ||
libterm | ||
libtest | ||
llvm@bff6907697 | ||
rt | ||
rust-installer@e54d4823d2 | ||
rustbook | ||
rustllvm | ||
test | ||
snapshots.txt |