Rename Box::*_nonnull_raw to *_non_null_raw
This commit is contained in:
parent
55c50cd8ac
commit
1772fa2aa1
4 changed files with 18 additions and 18 deletions
|
@ -286,7 +286,7 @@ impl<T> Arc<T> {
|
||||||
weak: atomic::AtomicUsize::new(1),
|
weak: atomic::AtomicUsize::new(1),
|
||||||
data,
|
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.
|
/// 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> {
|
pub fn new() -> Weak<T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
Weak {
|
Weak {
|
||||||
ptr: Box::into_nonnull_raw(box ArcInner {
|
ptr: Box::into_non_null_raw(box ArcInner {
|
||||||
strong: atomic::AtomicUsize::new(0),
|
strong: atomic::AtomicUsize::new(0),
|
||||||
weak: atomic::AtomicUsize::new(1),
|
weak: atomic::AtomicUsize::new(1),
|
||||||
data: uninitialized(),
|
data: uninitialized(),
|
||||||
|
|
|
@ -290,13 +290,13 @@ impl<T: ?Sized> Box<T> {
|
||||||
/// ```
|
/// ```
|
||||||
/// fn main() {
|
/// fn main() {
|
||||||
/// let x = Box::new(5);
|
/// let x = Box::new(5);
|
||||||
/// let ptr = Box::into_nonnull_raw(x);
|
/// let ptr = Box::into_non_null_raw(x);
|
||||||
/// let x = unsafe { Box::from_nonnull_raw(ptr) };
|
/// let x = unsafe { Box::from_non_null_raw(ptr) };
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "nonnull", since = "1.24.0")]
|
#[stable(feature = "nonnull", since = "1.24.0")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn from_nonnull_raw(u: NonNull<T>) -> Self {
|
pub unsafe fn from_non_null_raw(u: NonNull<T>) -> Self {
|
||||||
Box(u.into())
|
Box(u.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ impl<T: ?Sized> Box<T> {
|
||||||
#[stable(feature = "box_raw", since = "1.4.0")]
|
#[stable(feature = "box_raw", since = "1.4.0")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn into_raw(b: Box<T>) -> *mut T {
|
pub fn into_raw(b: Box<T>) -> *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<T>`.
|
/// Consumes the `Box`, returning the wrapped pointer as `NonNull<T>`.
|
||||||
|
@ -333,17 +333,17 @@ impl<T: ?Sized> Box<T> {
|
||||||
/// caller should properly destroy `T` and release the memory. The
|
/// caller should properly destroy `T` and release the memory. The
|
||||||
/// proper way to do so is to either convert the `NonNull<T>` pointer:
|
/// proper way to do so is to either convert the `NonNull<T>` 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`]
|
/// - Into a raw pointer and back into a `Box` with the [`Box::from_raw`]
|
||||||
/// function.
|
/// function.
|
||||||
///
|
///
|
||||||
/// Note: this is an associated function, which means that you have
|
/// Note: this is an associated function, which means that you have
|
||||||
/// to call it as `Box::into_nonnull_raw(b)`
|
/// to call it as `Box::into_non_null_raw(b)`
|
||||||
/// instead of `b.into_nonnull_raw()`. This
|
/// instead of `b.into_non_null_raw()`. This
|
||||||
/// is so that there is no conflict with a method on the inner type.
|
/// 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
|
/// [`Box::from_raw`]: struct.Box.html#method.from_raw
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
|
@ -351,16 +351,16 @@ impl<T: ?Sized> Box<T> {
|
||||||
/// ```
|
/// ```
|
||||||
/// fn main() {
|
/// fn main() {
|
||||||
/// let x = Box::new(5);
|
/// 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")]
|
#[stable(feature = "nonnull", since = "1.24.0")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn into_nonnull_raw(b: Box<T>) -> NonNull<T> {
|
pub fn into_non_null_raw(b: Box<T>) -> NonNull<T> {
|
||||||
Box::into_unique(b).into()
|
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]
|
#[inline]
|
||||||
pub fn into_unique(b: Box<T>) -> Unique<T> {
|
pub fn into_unique(b: Box<T>) -> Unique<T> {
|
||||||
let unique = b.0;
|
let unique = b.0;
|
||||||
|
|
|
@ -157,7 +157,7 @@ impl<T> LinkedList<T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
node.next = self.head;
|
node.next = self.head;
|
||||||
node.prev = None;
|
node.prev = None;
|
||||||
let node = Some(Box::into_nonnull_raw(node));
|
let node = Some(Box::into_non_null_raw(node));
|
||||||
|
|
||||||
match self.head {
|
match self.head {
|
||||||
None => self.tail = node,
|
None => self.tail = node,
|
||||||
|
@ -192,7 +192,7 @@ impl<T> LinkedList<T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
node.next = None;
|
node.next = None;
|
||||||
node.prev = self.tail;
|
node.prev = self.tail;
|
||||||
let node = Some(Box::into_nonnull_raw(node));
|
let node = Some(Box::into_non_null_raw(node));
|
||||||
|
|
||||||
match self.tail {
|
match self.tail {
|
||||||
None => self.head = node,
|
None => self.head = node,
|
||||||
|
@ -986,7 +986,7 @@ impl<'a, T> IterMut<'a, T> {
|
||||||
Some(prev) => prev,
|
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),
|
next: Some(head),
|
||||||
prev: Some(prev),
|
prev: Some(prev),
|
||||||
element,
|
element,
|
||||||
|
|
|
@ -311,7 +311,7 @@ impl<T> Rc<T> {
|
||||||
// pointers, which ensures that the weak destructor never frees
|
// pointers, which ensures that the weak destructor never frees
|
||||||
// the allocation while the strong destructor is running, even
|
// the allocation while the strong destructor is running, even
|
||||||
// if the weak pointer is stored inside the strong one.
|
// 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),
|
strong: Cell::new(1),
|
||||||
weak: Cell::new(1),
|
weak: Cell::new(1),
|
||||||
value,
|
value,
|
||||||
|
@ -1190,7 +1190,7 @@ impl<T> Weak<T> {
|
||||||
pub fn new() -> Weak<T> {
|
pub fn new() -> Weak<T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
Weak {
|
Weak {
|
||||||
ptr: Box::into_nonnull_raw(box RcBox {
|
ptr: Box::into_non_null_raw(box RcBox {
|
||||||
strong: Cell::new(0),
|
strong: Cell::new(0),
|
||||||
weak: Cell::new(1),
|
weak: Cell::new(1),
|
||||||
value: uninitialized(),
|
value: uninitialized(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue