Skip to content

Commit 12b3630

Browse files
committed
Rename Box::into_non_null_raw to Box::into_raw_non_null
1 parent 8ef5e54 commit 12b3630

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

src/liballoc/arc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl<T> Arc<T> {
286286
weak: atomic::AtomicUsize::new(1),
287287
data,
288288
};
289-
Arc { ptr: Box::into_non_null_raw(x), phantom: PhantomData }
289+
Arc { ptr: Box::into_raw_non_null(x), phantom: PhantomData }
290290
}
291291

292292
/// Returns the contained value, if the `Arc` has exactly one strong reference.
@@ -991,7 +991,7 @@ impl<T> Weak<T> {
991991
pub fn new() -> Weak<T> {
992992
unsafe {
993993
Weak {
994-
ptr: Box::into_non_null_raw(box ArcInner {
994+
ptr: Box::into_raw_non_null(box ArcInner {
995995
strong: atomic::AtomicUsize::new(0),
996996
weak: atomic::AtomicUsize::new(1),
997997
data: uninitialized(),

src/liballoc/boxed.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ impl<T: ?Sized> Box<T> {
295295
#[stable(feature = "box_raw", since = "1.4.0")]
296296
#[inline]
297297
pub fn into_raw(b: Box<T>) -> *mut T {
298-
Box::into_non_null_raw(b).as_ptr()
298+
Box::into_raw_non_null(b).as_ptr()
299299
}
300300

301301
/// Consumes the `Box`, returning the wrapped pointer as `NonNull<T>`.
@@ -308,8 +308,8 @@ impl<T: ?Sized> Box<T> {
308308
/// function.
309309
///
310310
/// Note: this is an associated function, which means that you have
311-
/// to call it as `Box::into_non_null_raw(b)`
312-
/// instead of `b.into_non_null_raw()`. This
311+
/// to call it as `Box::into_raw_non_null(b)`
312+
/// instead of `b.into_raw_non_null()`. This
313313
/// is so that there is no conflict with a method on the inner type.
314314
///
315315
/// [`Box::from_raw`]: struct.Box.html#method.from_raw
@@ -319,16 +319,16 @@ impl<T: ?Sized> Box<T> {
319319
/// ```
320320
/// fn main() {
321321
/// let x = Box::new(5);
322-
/// let ptr = Box::into_non_null_raw(x);
322+
/// let ptr = Box::into_raw_non_null(x);
323323
/// }
324324
/// ```
325325
#[stable(feature = "nonnull", since = "1.24.0")]
326326
#[inline]
327-
pub fn into_non_null_raw(b: Box<T>) -> NonNull<T> {
327+
pub fn into_raw_non_null(b: Box<T>) -> NonNull<T> {
328328
Box::into_unique(b).into()
329329
}
330330

331-
#[unstable(feature = "ptr_internals", issue = "0", reason = "use into_non_null_raw instead")]
331+
#[unstable(feature = "ptr_internals", issue = "0", reason = "use into_raw_non_null instead")]
332332
#[inline]
333333
pub fn into_unique(b: Box<T>) -> Unique<T> {
334334
let unique = b.0;

src/liballoc/linked_list.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl<T> LinkedList<T> {
157157
unsafe {
158158
node.next = self.head;
159159
node.prev = None;
160-
let node = Some(Box::into_non_null_raw(node));
160+
let node = Some(Box::into_raw_non_null(node));
161161

162162
match self.head {
163163
None => self.tail = node,
@@ -192,7 +192,7 @@ impl<T> LinkedList<T> {
192192
unsafe {
193193
node.next = None;
194194
node.prev = self.tail;
195-
let node = Some(Box::into_non_null_raw(node));
195+
let node = Some(Box::into_raw_non_null(node));
196196

197197
match self.tail {
198198
None => self.head = node,
@@ -986,7 +986,7 @@ impl<'a, T> IterMut<'a, T> {
986986
Some(prev) => prev,
987987
};
988988

989-
let node = Some(Box::into_non_null_raw(box Node {
989+
let node = Some(Box::into_raw_non_null(box Node {
990990
next: Some(head),
991991
prev: Some(prev),
992992
element,

src/liballoc/rc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ impl<T> Rc<T> {
311311
// pointers, which ensures that the weak destructor never frees
312312
// the allocation while the strong destructor is running, even
313313
// if the weak pointer is stored inside the strong one.
314-
ptr: Box::into_non_null_raw(box RcBox {
314+
ptr: Box::into_raw_non_null(box RcBox {
315315
strong: Cell::new(1),
316316
weak: Cell::new(1),
317317
value,
@@ -1190,7 +1190,7 @@ impl<T> Weak<T> {
11901190
pub fn new() -> Weak<T> {
11911191
unsafe {
11921192
Weak {
1193-
ptr: Box::into_non_null_raw(box RcBox {
1193+
ptr: Box::into_raw_non_null(box RcBox {
11941194
strong: Cell::new(0),
11951195
weak: Cell::new(1),
11961196
value: uninitialized(),

0 commit comments

Comments
 (0)