]> git.proxmox.com Git - rustc.git/blobdiff - src/libcollections/btree/node.rs
Imported Upstream version 1.8.0+dfsg1
[rustc.git] / src / libcollections / btree / node.rs
index c8a0f60587e9eaa5a89df18e2888b854016d52e6..8ae23a646e48855caa7ed93019d42d6e8bcc060b 100644 (file)
@@ -28,7 +28,7 @@
 // }
 // ```
 //
-// Since Rust doesn't acutally have dependent types and polymorphic recursion,
+// Since Rust doesn't actually have dependent types and polymorphic recursion,
 // we make do with lots of unsafety.
 
 use alloc::heap;
@@ -1027,6 +1027,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(),
@@ -1058,8 +1060,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)
         }
     }