about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-01-20 12:28:13 +0000
committerbors <bors@rust-lang.org>2018-01-20 12:28:13 +0000
commitbdda8d61151a91fcc95b059918dd834c8e7ac09e (patch)
tree392c16311de525e9573a63486a6e7d32469b6fb1 /src/test
parent816d765716f25b0008049d89a0e41f0a48d03c78 (diff)
parent602a445b92b37ec6af4d3d7f331e1a0d1360b8d2 (diff)
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.)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/allocator-alloc-one.rs2
-rw-r--r--src/test/run-pass/issue-23433.rs6
-rw-r--r--src/test/rustdoc-js/from_u.js1
3 files changed, 3 insertions, 6 deletions
diff --git a/src/test/run-pass/allocator-alloc-one.rs b/src/test/run-pass/allocator-alloc-one.rs
index 712fa2d6001..eaa5bc90805 100644
--- a/src/test/run-pass/allocator-alloc-one.rs
+++ b/src/test/run-pass/allocator-alloc-one.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(allocator_api, unique)]
+#![feature(allocator_api, nonnull)]
 
 use std::heap::{Heap, Alloc};
 
diff --git a/src/test/run-pass/issue-23433.rs b/src/test/run-pass/issue-23433.rs
index aa13d6fad47..7af732f561d 100644
--- a/src/test/run-pass/issue-23433.rs
+++ b/src/test/run-pass/issue-23433.rs
@@ -10,13 +10,11 @@
 
 // Don't fail if we encounter a NonZero<*T> where T is an unsized type
 
-#![feature(unique)]
-
-use std::ptr::Unique;
+use std::ptr::NonNull;
 
 fn main() {
     let mut a = [0u8; 5];
-    let b: Option<Unique<[u8]>> = Some(Unique::from(&mut a));
+    let b: Option<NonNull<[u8]>> = Some(NonNull::from(&mut a));
     match b {
         Some(_) => println!("Got `Some`"),
         None => panic!("Unexpected `None`"),
diff --git a/src/test/rustdoc-js/from_u.js b/src/test/rustdoc-js/from_u.js
index 920620a9aee..0296788f7a0 100644
--- a/src/test/rustdoc-js/from_u.js
+++ b/src/test/rustdoc-js/from_u.js
@@ -15,7 +15,6 @@ const EXPECTED = {
         { 'path': 'std::char', 'name': 'from_u32' },
         { 'path': 'std::str', 'name': 'from_utf8' },
         { 'path': 'std::string::String', 'name': 'from_utf8' },
-        { 'path': 'std::boxed::Box', 'name': 'from_unique' },
         { 'path': 'std::i32', 'name': 'from_unsigned' },
         { 'path': 'std::i128', 'name': 'from_unsigned' },
     ],