File tree Expand file tree Collapse file tree 3 files changed +132
-119
lines changed
src/liballoc/collections/btree Expand file tree Collapse file tree 3 files changed +132
-119
lines changed Original file line number Diff line number Diff line change @@ -2001,8 +2001,13 @@ where
20012001 }
20022002 }
20032003
2004- let front = Handle :: new_edge ( min_node, min_edge) ;
2005- let back = Handle :: new_edge ( max_node, max_edge) ;
2004+ // Safety guarantee: `min_edge` is always in range for `min_node`, because
2005+ // `min_edge` is unconditionally calculated for each iteration's value of `min_node`,
2006+ // either (if not found) as the edge index returned by `search_linear`,
2007+ // or (if found) as the KV index returned by `search_linear`, possibly + 1.
2008+ // Likewise for `max_node` versus `max_edge`.
2009+ let front = unsafe { Handle :: new_edge ( min_node, min_edge) } ;
2010+ let back = unsafe { Handle :: new_edge ( max_node, max_edge) } ;
20062011 match ( front. force ( ) , back. force ( ) ) {
20072012 ( Leaf ( f) , Leaf ( b) ) => {
20082013 return ( f, b) ;
You can’t perform that action at this time.
0 commit comments