mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
BTreeMap: detect bulk_steal's count-1 underflow in release builds too
This commit is contained in:
parent
4c5c4aa002
commit
ad75a96b34
@ -1469,6 +1469,7 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
|
||||
|
||||
/// This does stealing similar to `steal_left` but steals multiple elements at once.
|
||||
pub fn bulk_steal_left(&mut self, count: usize) {
|
||||
assert!(count > 0);
|
||||
unsafe {
|
||||
let left_node = &mut self.left_child;
|
||||
let old_left_len = left_node.len();
|
||||
@ -1526,6 +1527,7 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
|
||||
|
||||
/// The symmetric clone of `bulk_steal_left`.
|
||||
pub fn bulk_steal_right(&mut self, count: usize) {
|
||||
assert!(count > 0);
|
||||
unsafe {
|
||||
let left_node = &mut self.left_child;
|
||||
let old_left_len = left_node.len();
|
||||
|
Loading…
Reference in New Issue
Block a user