Skip to content

Commit 9b92bf8

Browse files
ssomersRalfJung
andauthored
Apply suggestions from code review
Co-Authored-By: Ralf Jung <[email protected]>
1 parent 37b5cca commit 9b92bf8

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/liballoc/collections/btree/node.rs

+1
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ impl<'a, K: 'a, V: 'a, Type> NodeRef<marker::Mut<'a>, K, V, Type> {
591591
unsafe { &mut *(self.root as *mut Root<K, V>) }
592592
}
593593

594+
/// The caller must ensure that the node is not the shared root.
594595
fn into_key_slice_mut(mut self) -> &'a mut [K] {
595596
debug_assert!(!self.is_shared_root());
596597
// We cannot be the shared root, so `as_leaf_mut` is okay.

src/liballoc/collections/btree/search.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ where
6262
// This function is defined over all borrow types (immutable, mutable, owned),
6363
// and may be called on the shared root in each case.
6464
// Crucially, we use `keys()` here, i.e., we work with immutable data.
65-
// We do not need to make `keys_mut()` public and require support for the shared root.
65+
// `keys_mut()` does not support the shared root, so we cannot use it.
6666
// Using `keys()` is fine here even if BorrowType is mutable, as all we return
6767
// is an index -- not a reference.
6868
for (i, k) in node.keys().iter().enumerate() {

0 commit comments

Comments
 (0)