about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2017-12-22 19:12:22 +0100
committerSimon Sapin <simon.sapin@exyr.org>2018-01-20 10:55:16 +0100
commitfb03a49c2501c52401b3c987fd455818de1736f2 (patch)
treef8837bc6ac6935858714c8ad6fd1be55398a9242 /src/libcore
parentf19baf0977b176ba26277af479a19b71b7ee1fdb (diff)
Replace Unique<T> with NonZero<T> in Alloc trait
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/ptr.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index fd8f9138f36..89ecb3457fc 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -2452,6 +2452,13 @@ impl<'a, T: ?Sized> From<&'a T> for Unique<T> {
     }
 }
 
+#[unstable(feature = "unique", issue = "27730")]
+impl<'a, T: ?Sized> From<NonNull<T>> for Unique<T> {
+    fn from(p: NonNull<T>) -> Self {
+        Unique { pointer: p.pointer, _marker: PhantomData }
+    }
+}
+
 /// Previous name of `NonNull`.
 #[rustc_deprecated(since = "1.24", reason = "renamed to `NonNull`")]
 #[unstable(feature = "shared", issue = "27730")]