about summary refs log tree commit diff
path: root/src/liballoc/btree/node.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-06-12 00:36:21 +0000
committerbors <bors@rust-lang.org>2018-06-12 00:36:21 +0000
commit4367e41ea2a105c373de27c2f080fc2527cc6927 (patch)
tree9ca30ec2dbf3311f0a0d0d6275d5abca8f23fc1f /src/liballoc/btree/node.rs
parentf9944fde377b8b2575f96fff60f784eddce54002 (diff)
parent7f0d54d98842c786ab7a140c17c3ea32aea6aead (diff)
downloadrust-4367e41ea2a105c373de27c2f080fc2527cc6927.tar.gz
rust-4367e41ea2a105c373de27c2f080fc2527cc6927.zip
Auto merge of #51241 - glandium:globalalloc, r=sfackler,SimonSapin
Stabilize GlobalAlloc and #[global_allocator]

This PR implements the changes discussed in https://github.com/rust-lang/rust/issues/49668#issuecomment-393263510

Fixes #49668
Fixes #27389

This does not change the default global allocator: #36963
Diffstat (limited to 'src/liballoc/btree/node.rs')
-rw-r--r--src/liballoc/btree/node.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/liballoc/btree/node.rs b/src/liballoc/btree/node.rs
index 431695c32ab..19bdcbc6ad6 100644
--- a/src/liballoc/btree/node.rs
+++ b/src/liballoc/btree/node.rs
@@ -287,7 +287,7 @@ impl<K, V> Root<K, V> {
         self.as_mut().as_leaf_mut().parent = ptr::null();
 
         unsafe {
-            Global.dealloc(NonNull::from(top).as_opaque(), Layout::new::<InternalNode<K, V>>());
+            Global.dealloc(NonNull::from(top).cast(), Layout::new::<InternalNode<K, V>>());
         }
     }
 }
@@ -478,7 +478,7 @@ impl<K, V> NodeRef<marker::Owned, K, V, marker::Leaf> {
         debug_assert!(!self.is_shared_root());
         let node = self.node;
         let ret = self.ascend().ok();
-        Global.dealloc(node.as_opaque(), Layout::new::<LeafNode<K, V>>());
+        Global.dealloc(node.cast(), Layout::new::<LeafNode<K, V>>());
         ret
     }
 }
@@ -499,7 +499,7 @@ impl<K, V> NodeRef<marker::Owned, K, V, marker::Internal> {
     > {
         let node = self.node;
         let ret = self.ascend().ok();
-        Global.dealloc(node.as_opaque(), Layout::new::<InternalNode<K, V>>());
+        Global.dealloc(node.cast(), Layout::new::<InternalNode<K, V>>());
         ret
     }
 }
@@ -1321,12 +1321,12 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::
                 }
 
                 Global.dealloc(
-                    right_node.node.as_opaque(),
+                    right_node.node.cast(),
                     Layout::new::<InternalNode<K, V>>(),
                 );
             } else {
                 Global.dealloc(
-                    right_node.node.as_opaque(),
+                    right_node.node.cast(),
                     Layout::new::<LeafNode<K, V>>(),
                 );
             }