]> git.lizzy.rs Git - rust.git/commit
Auto merge of #46952 - SimonSapin:nonnull, r=alexcrichton
authorbors <bors@rust-lang.org>
Sat, 20 Jan 2018 12:28:13 +0000 (12:28 +0000)
committerbors <bors@rust-lang.org>
Sat, 20 Jan 2018 12:28:13 +0000 (12:28 +0000)
commitbdda8d61151a91fcc95b059918dd834c8e7ac09e
tree392c16311de525e9573a63486a6e7d32469b6fb1
parent816d765716f25b0008049d89a0e41f0a48d03c78
parent602a445b92b37ec6af4d3d7f331e1a0d1360b8d2
Auto merge of #46952 - SimonSapin:nonnull, r=alexcrichton

Rename std::ptr::Shared to NonNull and stabilize it

This implements the changes proposed at https://github.com/rust-lang/rust/issues/27730#issuecomment-352800629:

> * Rename `Shared<T>` to `NonNull<T>` and stabilize it. (Being in the `ptr` module is enough to say that it’s a pointer. I’m not very attached to this specific name though.)
> * Rename `Box<T>` methods ~~`from_unique`~~/`into_unique` to ~~`from_nonnull`~~/`into_nonnull` (or whatever names are deemed appropriate), replace `Unique<T>` with `NonNull<T>` in their signatures, and stabilize them.
> *  Replace `Unique<T>` with `NonNull<T>` in the signatures of methods of the `Alloc` trait.
> * Mark `Unique` “permanently-unstable” by replacing remaining occurrences of `#[unstable(feature = "unique", issue = "27730")]` with:
>
>   ```rust
>   #[unstable(feature = "ptr_internals", issue = "0", reason = "\
>       use NonNull instead and consider PhantomData<T> (if you also use #[may_dangle]), \
>       Send, and/or Sync")]
>   ```
>
>   (Maybe the `reason` string is only useful on the struct definition.) Ideally it would be made private to some crate instead, but it needs to be used in both liballoc and libstd.
> * (Leave `NonZero` and `Zeroable` unstable for now, and subject to future bikeshedding.)