Skip to content

Commit 1772fa2

Browse files
committed
Rename Box::*_nonnull_raw to *_non_null_raw
1 parent 55c50cd commit 1772fa2

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
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_nonnull_raw(x), phantom: PhantomData }
289+
Arc { ptr: Box::into_non_null_raw(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_nonnull_raw(box ArcInner {
994+
ptr: Box::into_non_null_raw(box ArcInner {
995995
strong: atomic::AtomicUsize::new(0),
996996
weak: atomic::AtomicUsize::new(1),
997997
data: uninitialized(),

src/liballoc/boxed.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -290,13 +290,13 @@ impl<T: ?Sized> Box<T> {
290290
/// ```
291291
/// fn main() {
292292
/// let x = Box::new(5);
293-
/// let ptr = Box::into_nonnull_raw(x);
294-
/// let x = unsafe { Box::from_nonnull_raw(ptr) };
293+
/// let ptr = Box::into_non_null_raw(x);
294+
/// let x = unsafe { Box::from_non_null_raw(ptr) };
295295
/// }
296296
/// ```
297297
#[stable(feature = "nonnull", since = "1.24.0")]
298298
#[inline]
299-
pub unsafe fn from_nonnull_raw(u: NonNull<T>) -> Self {
299+
pub unsafe fn from_non_null_raw(u: NonNull<T>) -> Self {
300300
Box(u.into())
301301
}
302302

@@ -323,7 +323,7 @@ impl<T: ?Sized> Box<T> {
323323
#[stable(feature = "box_raw", since = "1.4.0")]
324324
#[inline]
325325
pub fn into_raw(b: Box<T>) -> *mut T {
326-
Box::into_nonnull_raw(b).as_ptr()
326+
Box::into_non_null_raw(b).as_ptr()
327327
}
328328

329329
/// Consumes the `Box`, returning the wrapped pointer as `NonNull<T>`.
@@ -333,34 +333,34 @@ impl<T: ?Sized> Box<T> {
333333
/// caller should properly destroy `T` and release the memory. The
334334
/// proper way to do so is to either convert the `NonNull<T>` pointer:
335335
///
336-
/// - Into a `Box` with the [`Box::from_nonnull_raw`] function.
336+
/// - Into a `Box` with the [`Box::from_non_null_raw`] function.
337337
///
338338
/// - Into a raw pointer and back into a `Box` with the [`Box::from_raw`]
339339
/// function.
340340
///
341341
/// Note: this is an associated function, which means that you have
342-
/// to call it as `Box::into_nonnull_raw(b)`
343-
/// instead of `b.into_nonnull_raw()`. This
342+
/// to call it as `Box::into_non_null_raw(b)`
343+
/// instead of `b.into_non_null_raw()`. This
344344
/// is so that there is no conflict with a method on the inner type.
345345
///
346-
/// [`Box::from_nonnull_raw`]: struct.Box.html#method.from_nonnull_raw
346+
/// [`Box::from_non_null_raw`]: struct.Box.html#method.from_non_null_raw
347347
/// [`Box::from_raw`]: struct.Box.html#method.from_raw
348348
///
349349
/// # Examples
350350
///
351351
/// ```
352352
/// fn main() {
353353
/// let x = Box::new(5);
354-
/// let ptr = Box::into_nonnull_raw(x);
354+
/// let ptr = Box::into_non_null_raw(x);
355355
/// }
356356
/// ```
357357
#[stable(feature = "nonnull", since = "1.24.0")]
358358
#[inline]
359-
pub fn into_nonnull_raw(b: Box<T>) -> NonNull<T> {
359+
pub fn into_non_null_raw(b: Box<T>) -> NonNull<T> {
360360
Box::into_unique(b).into()
361361
}
362362

363-
#[unstable(feature = "ptr_internals", issue = "0", reason = "use into_nonnull_raw instead")]
363+
#[unstable(feature = "ptr_internals", issue = "0", reason = "use into_non_null_raw instead")]
364364
#[inline]
365365
pub fn into_unique(b: Box<T>) -> Unique<T> {
366366
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_nonnull_raw(node));
160+
let node = Some(Box::into_non_null_raw(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_nonnull_raw(node));
195+
let node = Some(Box::into_non_null_raw(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_nonnull_raw(box Node {
989+
let node = Some(Box::into_non_null_raw(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_nonnull_raw(box RcBox {
314+
ptr: Box::into_non_null_raw(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_nonnull_raw(box RcBox {
1193+
ptr: Box::into_non_null_raw(box RcBox {
11941194
strong: Cell::new(0),
11951195
weak: Cell::new(1),
11961196
value: uninitialized(),

0 commit comments

Comments
 (0)