]> git.lizzy.rs Git - rust.git/commitdiff
Rename Box::into_non_null_raw to Box::into_raw_non_null
authorSimon Sapin <simon.sapin@exyr.org>
Wed, 27 Dec 2017 21:56:06 +0000 (22:56 +0100)
committerSimon Sapin <simon.sapin@exyr.org>
Sat, 20 Jan 2018 10:09:23 +0000 (11:09 +0100)
src/liballoc/arc.rs
src/liballoc/boxed.rs
src/liballoc/linked_list.rs
src/liballoc/rc.rs

index 95ba517a7a9cf0e98f45be1f795017040c3def9a..6a77bf64baee5f9ffe5d9670ad5eab3405abade5 100644 (file)
@@ -286,7 +286,7 @@ pub fn new(data: T) -> Arc<T> {
             weak: atomic::AtomicUsize::new(1),
             data,
         };
-        Arc { ptr: Box::into_non_null_raw(x), phantom: PhantomData }
+        Arc { ptr: Box::into_raw_non_null(x), phantom: PhantomData }
     }
 
     /// Returns the contained value, if the `Arc` has exactly one strong reference.
@@ -991,7 +991,7 @@ impl<T> Weak<T> {
     pub fn new() -> Weak<T> {
         unsafe {
             Weak {
-                ptr: Box::into_non_null_raw(box ArcInner {
+                ptr: Box::into_raw_non_null(box ArcInner {
                     strong: atomic::AtomicUsize::new(0),
                     weak: atomic::AtomicUsize::new(1),
                     data: uninitialized(),
index 60998bc677b8e552c7b77d63e3977874368f47fc..78a4b337711bda58fdcad7383d337e0e78ded3c9 100644 (file)
@@ -295,7 +295,7 @@ pub unsafe fn from_raw(raw: *mut T) -> Self {
     #[stable(feature = "box_raw", since = "1.4.0")]
     #[inline]
     pub fn into_raw(b: Box<T>) -> *mut T {
-        Box::into_non_null_raw(b).as_ptr()
+        Box::into_raw_non_null(b).as_ptr()
     }
 
     /// Consumes the `Box`, returning the wrapped pointer as `NonNull<T>`.
@@ -308,8 +308,8 @@ pub fn into_raw(b: Box<T>) -> *mut T {
     /// function.
     ///
     /// Note: this is an associated function, which means that you have
-    /// to call it as `Box::into_non_null_raw(b)`
-    /// instead of `b.into_non_null_raw()`. This
+    /// to call it as `Box::into_raw_non_null(b)`
+    /// instead of `b.into_raw_non_null()`. This
     /// is so that there is no conflict with a method on the inner type.
     ///
     /// [`Box::from_raw`]: struct.Box.html#method.from_raw
@@ -319,16 +319,16 @@ pub fn into_raw(b: Box<T>) -> *mut T {
     /// ```
     /// fn main() {
     ///     let x = Box::new(5);
-    ///     let ptr = Box::into_non_null_raw(x);
+    ///     let ptr = Box::into_raw_non_null(x);
     /// }
     /// ```
     #[stable(feature = "nonnull", since = "1.24.0")]
     #[inline]
-    pub fn into_non_null_raw(b: Box<T>) -> NonNull<T> {
+    pub fn into_raw_non_null(b: Box<T>) -> NonNull<T> {
         Box::into_unique(b).into()
     }
 
-    #[unstable(feature = "ptr_internals", issue = "0", reason = "use into_non_null_raw instead")]
+    #[unstable(feature = "ptr_internals", issue = "0", reason = "use into_raw_non_null instead")]
     #[inline]
     pub fn into_unique(b: Box<T>) -> Unique<T> {
         let unique = b.0;
index 8ec0110060aa6c95a5372db1eb474475f041e39f..3cc810a055f3efc3eeee5b7e60752847964f75e9 100644 (file)
@@ -157,7 +157,7 @@ fn push_front_node(&mut self, mut node: Box<Node<T>>) {
         unsafe {
             node.next = self.head;
             node.prev = None;
-            let node = Some(Box::into_non_null_raw(node));
+            let node = Some(Box::into_raw_non_null(node));
 
             match self.head {
                 None => self.tail = node,
@@ -192,7 +192,7 @@ fn push_back_node(&mut self, mut node: Box<Node<T>>) {
         unsafe {
             node.next = None;
             node.prev = self.tail;
-            let node = Some(Box::into_non_null_raw(node));
+            let node = Some(Box::into_raw_non_null(node));
 
             match self.tail {
                 None => self.head = node,
@@ -986,7 +986,7 @@ pub fn insert_next(&mut self, element: T) {
                     Some(prev) => prev,
                 };
 
-                let node = Some(Box::into_non_null_raw(box Node {
+                let node = Some(Box::into_raw_non_null(box Node {
                     next: Some(head),
                     prev: Some(prev),
                     element,
index c3270e4e21d938aa3ed9a2db30bd9f4337dc21a4..1fa5d34cb5787147091617c92c1499a0e1506cf5 100644 (file)
@@ -311,7 +311,7 @@ pub fn new(value: T) -> Rc<T> {
             // pointers, which ensures that the weak destructor never frees
             // the allocation while the strong destructor is running, even
             // if the weak pointer is stored inside the strong one.
-            ptr: Box::into_non_null_raw(box RcBox {
+            ptr: Box::into_raw_non_null(box RcBox {
                 strong: Cell::new(1),
                 weak: Cell::new(1),
                 value,
@@ -1190,7 +1190,7 @@ impl<T> Weak<T> {
     pub fn new() -> Weak<T> {
         unsafe {
             Weak {
-                ptr: Box::into_non_null_raw(box RcBox {
+                ptr: Box::into_raw_non_null(box RcBox {
                     strong: Cell::new(0),
                     weak: Cell::new(1),
                     value: uninitialized(),