@@ -179,7 +179,7 @@ impl<K, V> NodeRef<marker::Owned, K, V, marker::LeafOrInternal> {
179
179
180
180
/// Removes the internal root node, using its first child as the new root node.
181
181
/// As it is intended only to be called when the root node has only one child,
182
- /// no cleanup is done on any of the other children.
182
+ /// no cleanup is done on any of the keys, values and other children.
183
183
/// This decreases the height by 1 and is the opposite of `push_internal_level`.
184
184
///
185
185
/// Requires exclusive access to the `Root` object but not to the root node;
@@ -220,7 +220,7 @@ impl<K, V> NodeRef<marker::Owned, K, V, marker::LeafOrInternal> {
220
220
/// - When this is `Owned`, the `NodeRef` acts roughly like `Box<Node>`,
221
221
/// but does not have a destructor, and must be cleaned up manually.
222
222
/// Since any `NodeRef` allows navigating through the tree, `BorrowType`
223
- /// effectively applies to the entire tree, not just the node itself.
223
+ /// effectively applies to the entire tree, not just to the node itself.
224
224
/// - `K` and `V`: These are the types of keys and values stored in the nodes.
225
225
/// - `Type`: This can be `Leaf`, `Internal`, or `LeafOrInternal`. When this is
226
226
/// `Leaf`, the `NodeRef` points to a leaf node, when this is `Internal` the
@@ -420,7 +420,7 @@ impl<'a, K: 'a, V: 'a, Type> NodeRef<marker::Immut<'a>, K, V, Type> {
420
420
421
421
impl < K , V > NodeRef < marker:: Owned , K , V , marker:: LeafOrInternal > {
422
422
/// Similar to `ascend`, gets a reference to a node's parent node, but also
423
- /// deallocate the current node in the process. This is unsafe because the
423
+ /// deallocates the current node in the process. This is unsafe because the
424
424
/// current node will still be accessible despite being deallocated.
425
425
pub unsafe fn deallocate_and_ascend (
426
426
self ,
@@ -656,7 +656,10 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
656
656
/// Removes a key-value pair from the end of the node and returns the pair.
657
657
/// Also removes the edge that was to the right of that pair and, if the node
658
658
/// is internal, returns the orphaned subtree that this edge owned.
659
- fn pop ( & mut self ) -> ( K , V , Option < Root < K , V > > ) {
659
+ ///
660
+ /// # Safety
661
+ /// The node must not be empty.
662
+ unsafe fn pop ( & mut self ) -> ( K , V , Option < Root < K , V > > ) {
660
663
debug_assert ! ( self . len( ) > 0 ) ;
661
664
662
665
let idx = self . len ( ) - 1 ;
0 commit comments