Rename NonNull::empty to dangling.
This commit is contained in:
parent
5aeeafff49
commit
76b686f78d
1 changed files with 2 additions and 1 deletions
|
@ -2370,6 +2370,7 @@ impl<T: Sized> Unique<T> {
|
||||||
///
|
///
|
||||||
/// This is useful for initializing types which lazily allocate, like
|
/// This is useful for initializing types which lazily allocate, like
|
||||||
/// `Vec::new` does.
|
/// `Vec::new` does.
|
||||||
|
// FIXME: rename to dangling() to match NonNull?
|
||||||
pub fn empty() -> Self {
|
pub fn empty() -> Self {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = mem::align_of::<T>() as *mut T;
|
let ptr = mem::align_of::<T>() as *mut T;
|
||||||
|
@ -2509,7 +2510,7 @@ impl<T: Sized> NonNull<T> {
|
||||||
/// This is useful for initializing types which lazily allocate, like
|
/// This is useful for initializing types which lazily allocate, like
|
||||||
/// `Vec::new` does.
|
/// `Vec::new` does.
|
||||||
#[stable(feature = "nonnull", since = "1.24.0")]
|
#[stable(feature = "nonnull", since = "1.24.0")]
|
||||||
pub fn empty() -> Self {
|
pub fn dangling() -> Self {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = mem::align_of::<T>() as *mut T;
|
let ptr = mem::align_of::<T>() as *mut T;
|
||||||
NonNull::new_unchecked(ptr)
|
NonNull::new_unchecked(ptr)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue