From 607315b2c34bb6c373cf3fc8283ab6b05414d114 Mon Sep 17 00:00:00 2001 From: Stein Somers Date: Thu, 9 Apr 2020 20:16:30 +0200 Subject: [PATCH 1/2] Kill comment left behind by a last minute change in #70795 --- src/liballoc/collections/btree/map.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/liballoc/collections/btree/map.rs b/src/liballoc/collections/btree/map.rs index a1e59b2e6af..3b42055d4a8 100644 --- a/src/liballoc/collections/btree/map.rs +++ b/src/liballoc/collections/btree/map.rs @@ -2788,8 +2788,6 @@ impl<'a, K: 'a, V: 'a> Handle, K, V, marker::LeafOrInter pos.next_unchecked(); } } - - // This internal node might be underfull, but only if it's the root. break; } } From de39a4f6218fac9d0b9d09a928613b4aa2407a31 Mon Sep 17 00:00:00 2001 From: Stein Somers Date: Thu, 9 Apr 2020 20:19:18 +0200 Subject: [PATCH 2/2] Respect the comment: no root unless the borrow type is `Mut` --- src/liballoc/collections/btree/node.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/liballoc/collections/btree/node.rs b/src/liballoc/collections/btree/node.rs index bc4e2711670..84d34db2d45 100644 --- a/src/liballoc/collections/btree/node.rs +++ b/src/liballoc/collections/btree/node.rs @@ -161,7 +161,7 @@ impl Root { NodeRef { height: self.height, node: self.node.as_ptr(), - root: self as *const _ as *mut _, + root: ptr::null(), _marker: PhantomData, } } @@ -179,7 +179,7 @@ impl Root { NodeRef { height: self.height, node: self.node.as_ptr(), - root: ptr::null_mut(), // FIXME: Is there anything better to do here? + root: ptr::null(), _marker: PhantomData, } }