about summary refs log tree commit diff
path: root/src/liballoc/collections
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-04-25 18:30:29 +0200
committerGitHub <noreply@github.com>2020-04-25 18:30:29 +0200
commit939c93208c306596d84f632acb0245542f3d46aa (patch)
tree7f7a9189351388addb12bed73555e976f3b53e0c /src/liballoc/collections
parent29fd52811428c040b972a6ac77dbbb8b69239b45 (diff)
parent7709d205ddcea48294f7916a3d7eb6d843bb6dbc (diff)
downloadrust-939c93208c306596d84f632acb0245542f3d46aa.tar.gz
rust-939c93208c306596d84f632acb0245542f3d46aa.zip
Rollup merge of #71168 - SimonSapin:into_raw_non_null, r=Amanieu
Deprecate `{Box,Rc,Arc}::into_raw_non_null`

Per ongoing FCP at https://github.com/rust-lang/rust/issues/47336#issuecomment-586589016
See also https://github.com/rust-lang/rust/issues/47336#issuecomment-614054164
Diffstat (limited to 'src/liballoc/collections')
-rw-r--r--src/liballoc/collections/linked_list.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/liballoc/collections/linked_list.rs b/src/liballoc/collections/linked_list.rs
index af341e6c1ca..5825bd306b6 100644
--- a/src/liballoc/collections/linked_list.rs
+++ b/src/liballoc/collections/linked_list.rs
@@ -143,7 +143,7 @@ impl<T> LinkedList<T> {
         unsafe {
             node.next = self.head;
             node.prev = None;
-            let node = Some(Box::into_raw_non_null(node));
+            let node = Some(Box::leak(node).into());
 
             match self.head {
                 None => self.tail = node,
@@ -184,7 +184,7 @@ impl<T> LinkedList<T> {
         unsafe {
             node.next = None;
             node.prev = self.tail;
-            let node = Some(Box::into_raw_non_null(node));
+            let node = Some(Box::leak(node).into());
 
             match self.tail {
                 None => self.head = node,
@@ -1133,11 +1133,9 @@ impl<T> IterMut<'_, T> {
                     Some(prev) => prev,
                 };
 
-                let node = Some(Box::into_raw_non_null(box Node {
-                    next: Some(head),
-                    prev: Some(prev),
-                    element,
-                }));
+                let node = Some(
+                    Box::leak(box Node { next: Some(head), prev: Some(prev), element }).into(),
+                );
 
                 // Not creating references to entire nodes to not invalidate the
                 // reference to `element` we handed to the user.
@@ -1450,7 +1448,7 @@ impl<'a, T> CursorMut<'a, T> {
     #[unstable(feature = "linked_list_cursors", issue = "58533")]
     pub fn insert_after(&mut self, item: T) {
         unsafe {
-            let spliced_node = Box::into_raw_non_null(Box::new(Node::new(item)));
+            let spliced_node = Box::leak(Box::new(Node::new(item))).into();
             let node_next = match self.current {
                 None => self.list.head,
                 Some(node) => node.as_ref().next,
@@ -1470,7 +1468,7 @@ impl<'a, T> CursorMut<'a, T> {
     #[unstable(feature = "linked_list_cursors", issue = "58533")]
     pub fn insert_before(&mut self, item: T) {
         unsafe {
-            let spliced_node = Box::into_raw_non_null(Box::new(Node::new(item)));
+            let spliced_node = Box::leak(Box::new(Node::new(item))).into();
             let node_prev = match self.current {
                 None => self.list.tail,
                 Some(node) => node.as_ref().prev,