diff options
| -rw-r--r-- | src/liballoc/collections/btree/node.rs | 1 | ||||
| -rw-r--r-- | src/liballoc/collections/btree/search.rs | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/liballoc/collections/btree/node.rs b/src/liballoc/collections/btree/node.rs index 03cb54ebce7..f40e0b0c304 100644 --- a/src/liballoc/collections/btree/node.rs +++ b/src/liballoc/collections/btree/node.rs @@ -591,6 +591,7 @@ impl<'a, K: 'a, V: 'a, Type> NodeRef<marker::Mut<'a>, K, V, Type> { unsafe { &mut *(self.root as *mut Root<K, V>) } } + /// The caller must ensure that the node is not the shared root. fn into_key_slice_mut(mut self) -> &'a mut [K] { debug_assert!(!self.is_shared_root()); // We cannot be the shared root, so `as_leaf_mut` is okay. diff --git a/src/liballoc/collections/btree/search.rs b/src/liballoc/collections/btree/search.rs index bdca4d186cf..48cbf67eea2 100644 --- a/src/liballoc/collections/btree/search.rs +++ b/src/liballoc/collections/btree/search.rs @@ -62,7 +62,7 @@ where // This function is defined over all borrow types (immutable, mutable, owned), // and may be called on the shared root in each case. // Crucially, we use `keys()` here, i.e., we work with immutable data. - // We do not need to make `keys_mut()` public and require support for the shared root. + // `keys_mut()` does not support the shared root, so we cannot use it. // Using `keys()` is fine here even if BorrowType is mutable, as all we return // is an index -- not a reference. for (i, k) in node.keys().iter().enumerate() { |
