From: Simon Sapin Date: Fri, 22 Dec 2017 22:46:52 +0000 (+0100) Subject: Rename Box::*_nonnull_raw to *_non_null_raw X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=1772fa2aa1262e5efae8172bbd9154a937269eb7;p=rust.git Rename Box::*_nonnull_raw to *_non_null_raw --- diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index e490f67dd92..95ba517a7a9 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -286,7 +286,7 @@ pub fn new(data: T) -> Arc { weak: atomic::AtomicUsize::new(1), data, }; - Arc { ptr: Box::into_nonnull_raw(x), phantom: PhantomData } + Arc { ptr: Box::into_non_null_raw(x), phantom: PhantomData } } /// Returns the contained value, if the `Arc` has exactly one strong reference. @@ -991,7 +991,7 @@ impl Weak { pub fn new() -> Weak { unsafe { Weak { - ptr: Box::into_nonnull_raw(box ArcInner { + ptr: Box::into_non_null_raw(box ArcInner { strong: atomic::AtomicUsize::new(0), weak: atomic::AtomicUsize::new(1), data: uninitialized(), diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index e7bc10dfaa9..a1563483f1e 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -290,13 +290,13 @@ pub unsafe fn from_raw(raw: *mut T) -> Self { /// ``` /// fn main() { /// let x = Box::new(5); - /// let ptr = Box::into_nonnull_raw(x); - /// let x = unsafe { Box::from_nonnull_raw(ptr) }; + /// let ptr = Box::into_non_null_raw(x); + /// let x = unsafe { Box::from_non_null_raw(ptr) }; /// } /// ``` #[stable(feature = "nonnull", since = "1.24.0")] #[inline] - pub unsafe fn from_nonnull_raw(u: NonNull) -> Self { + pub unsafe fn from_non_null_raw(u: NonNull) -> Self { Box(u.into()) } @@ -323,7 +323,7 @@ pub unsafe fn from_nonnull_raw(u: NonNull) -> Self { #[stable(feature = "box_raw", since = "1.4.0")] #[inline] pub fn into_raw(b: Box) -> *mut T { - Box::into_nonnull_raw(b).as_ptr() + Box::into_non_null_raw(b).as_ptr() } /// Consumes the `Box`, returning the wrapped pointer as `NonNull`. @@ -333,17 +333,17 @@ pub fn into_raw(b: Box) -> *mut T { /// caller should properly destroy `T` and release the memory. The /// proper way to do so is to either convert the `NonNull` pointer: /// - /// - Into a `Box` with the [`Box::from_nonnull_raw`] function. + /// - Into a `Box` with the [`Box::from_non_null_raw`] function. /// /// - Into a raw pointer and back into a `Box` with the [`Box::from_raw`] /// function. /// /// Note: this is an associated function, which means that you have - /// to call it as `Box::into_nonnull_raw(b)` - /// instead of `b.into_nonnull_raw()`. This + /// to call it as `Box::into_non_null_raw(b)` + /// instead of `b.into_non_null_raw()`. This /// is so that there is no conflict with a method on the inner type. /// - /// [`Box::from_nonnull_raw`]: struct.Box.html#method.from_nonnull_raw + /// [`Box::from_non_null_raw`]: struct.Box.html#method.from_non_null_raw /// [`Box::from_raw`]: struct.Box.html#method.from_raw /// /// # Examples @@ -351,16 +351,16 @@ pub fn into_raw(b: Box) -> *mut T { /// ``` /// fn main() { /// let x = Box::new(5); - /// let ptr = Box::into_nonnull_raw(x); + /// let ptr = Box::into_non_null_raw(x); /// } /// ``` #[stable(feature = "nonnull", since = "1.24.0")] #[inline] - pub fn into_nonnull_raw(b: Box) -> NonNull { + pub fn into_non_null_raw(b: Box) -> NonNull { Box::into_unique(b).into() } - #[unstable(feature = "ptr_internals", issue = "0", reason = "use into_nonnull_raw instead")] + #[unstable(feature = "ptr_internals", issue = "0", reason = "use into_non_null_raw instead")] #[inline] pub fn into_unique(b: Box) -> Unique { let unique = b.0; diff --git a/src/liballoc/linked_list.rs b/src/liballoc/linked_list.rs index 4c4a00e53fa..8ec0110060a 100644 --- a/src/liballoc/linked_list.rs +++ b/src/liballoc/linked_list.rs @@ -157,7 +157,7 @@ fn push_front_node(&mut self, mut node: Box>) { unsafe { node.next = self.head; node.prev = None; - let node = Some(Box::into_nonnull_raw(node)); + let node = Some(Box::into_non_null_raw(node)); match self.head { None => self.tail = node, @@ -192,7 +192,7 @@ fn push_back_node(&mut self, mut node: Box>) { unsafe { node.next = None; node.prev = self.tail; - let node = Some(Box::into_nonnull_raw(node)); + let node = Some(Box::into_non_null_raw(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_nonnull_raw(box Node { + let node = Some(Box::into_non_null_raw(box Node { next: Some(head), prev: Some(prev), element, diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 590a6837905..c3270e4e21d 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -311,7 +311,7 @@ pub fn new(value: T) -> Rc { // 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_nonnull_raw(box RcBox { + ptr: Box::into_non_null_raw(box RcBox { strong: Cell::new(1), weak: Cell::new(1), value, @@ -1190,7 +1190,7 @@ impl Weak { pub fn new() -> Weak { unsafe { Weak { - ptr: Box::into_nonnull_raw(box RcBox { + ptr: Box::into_non_null_raw(box RcBox { strong: Cell::new(0), weak: Cell::new(1), value: uninitialized(),