Auto merge of #79987 - ssomers:btree_cleanup_4, r=Mark-Simulacrum
BTreeMap: detect bulk_steal's count-1 underflow in release builds too r? `@Mark-Simulacrum`
This commit is contained in:
commit
69ff39ee32
1 changed files with 2 additions and 0 deletions
|
@ -1475,6 +1475,7 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
|
||||||
|
|
||||||
/// This does stealing similar to `steal_left` but steals multiple elements at once.
|
/// This does stealing similar to `steal_left` but steals multiple elements at once.
|
||||||
pub fn bulk_steal_left(&mut self, count: usize) {
|
pub fn bulk_steal_left(&mut self, count: usize) {
|
||||||
|
assert!(count > 0);
|
||||||
unsafe {
|
unsafe {
|
||||||
let left_node = &mut self.left_child;
|
let left_node = &mut self.left_child;
|
||||||
let old_left_len = left_node.len();
|
let old_left_len = left_node.len();
|
||||||
|
@ -1532,6 +1533,7 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
|
||||||
|
|
||||||
/// The symmetric clone of `bulk_steal_left`.
|
/// The symmetric clone of `bulk_steal_left`.
|
||||||
pub fn bulk_steal_right(&mut self, count: usize) {
|
pub fn bulk_steal_right(&mut self, count: usize) {
|
||||||
|
assert!(count > 0);
|
||||||
unsafe {
|
unsafe {
|
||||||
let left_node = &mut self.left_child;
|
let left_node = &mut self.left_child;
|
||||||
let old_left_len = left_node.len();
|
let old_left_len = left_node.len();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue