mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
In BTreeMap's merge function, adjust the length of the node before moving elements into it.
This commit is contained in:
parent
bff52927f5
commit
707afa2ed5
@ -1022,6 +1022,8 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::
|
||||
}
|
||||
self.node.as_leaf_mut().len -= 1;
|
||||
|
||||
left_node.as_leaf_mut().len += right_len as u16 + 1;
|
||||
|
||||
if self.node.height > 1 {
|
||||
ptr::copy_nonoverlapping(
|
||||
right_node.cast_unchecked().as_internal().edges.as_ptr(),
|
||||
@ -1053,8 +1055,6 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::
|
||||
);
|
||||
}
|
||||
|
||||
left_node.as_leaf_mut().len += right_len as u16 + 1;
|
||||
|
||||
Handle::new_edge(self.node, self.idx)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user