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