diff options
| author | Mike Hommey <mh@glandium.org> | 2018-04-03 08:51:02 +0900 |
|---|---|---|
| committer | Simon Sapin <simon.sapin@exyr.org> | 2018-04-12 22:53:22 +0200 |
| commit | fddf51ee0b9765484fc316dbf3d4feb8ceea715d (patch) | |
| tree | 52814590ab7288801f78e8ee5493e156f3181017 /src/liballoc/btree | |
| parent | fd242ee64c5488e64e2bb677d90f2460e017b7cb (diff) | |
| download | rust-fddf51ee0b9765484fc316dbf3d4feb8ceea715d.tar.gz rust-fddf51ee0b9765484fc316dbf3d4feb8ceea715d.zip | |
Use NonNull<Void> instead of *mut u8 in the Alloc trait
Fixes #49608
Diffstat (limited to 'src/liballoc/btree')
| -rw-r--r-- | src/liballoc/btree/node.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/liballoc/btree/node.rs b/src/liballoc/btree/node.rs index 8e23228bd28..64aa40ac166 100644 --- a/src/liballoc/btree/node.rs +++ b/src/liballoc/btree/node.rs @@ -236,7 +236,7 @@ impl<K, V> Root<K, V> { pub fn pop_level(&mut self) { debug_assert!(self.height > 0); - let top = self.node.ptr.as_ptr() as *mut u8; + let top = self.node.ptr; self.node = unsafe { BoxedNode::from_ptr(self.as_mut() @@ -249,7 +249,7 @@ impl<K, V> Root<K, V> { self.as_mut().as_leaf_mut().parent = ptr::null(); unsafe { - Global.dealloc(top, Layout::new::<InternalNode<K, V>>()); + Global.dealloc(NonNull::from(top).as_void(), Layout::new::<InternalNode<K, V>>()); } } } @@ -433,9 +433,9 @@ impl<K, V> NodeRef<marker::Owned, K, V, marker::Leaf> { marker::Edge > > { - let ptr = self.as_leaf() as *const LeafNode<K, V> as *const u8 as *mut u8; + let node = self.node; let ret = self.ascend().ok(); - Global.dealloc(ptr, Layout::new::<LeafNode<K, V>>()); + Global.dealloc(node.as_void(), Layout::new::<LeafNode<K, V>>()); ret } } @@ -454,9 +454,9 @@ impl<K, V> NodeRef<marker::Owned, K, V, marker::Internal> { marker::Edge > > { - let ptr = self.as_internal() as *const InternalNode<K, V> as *const u8 as *mut u8; + let node = self.node; let ret = self.ascend().ok(); - Global.dealloc(ptr, Layout::new::<InternalNode<K, V>>()); + Global.dealloc(node.as_void(), Layout::new::<InternalNode<K, V>>()); ret } } @@ -1239,12 +1239,12 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker:: } Global.dealloc( - right_node.node.as_ptr() as *mut u8, + right_node.node.as_void(), Layout::new::<InternalNode<K, V>>(), ); } else { Global.dealloc( - right_node.node.as_ptr() as *mut u8, + right_node.node.as_void(), Layout::new::<LeafNode<K, V>>(), ); } |
