about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorTaylor Cramer <cramertj@google.com>2018-05-22 17:10:14 -0700
committerTaylor Cramer <cramertj@google.com>2018-05-22 17:24:49 -0700
commit640f6f07494ece4ebe7e4d9680fff9a83ab4b0d2 (patch)
treec133b32639572dd26b335b2759416f081274fbf0 /src/libcore
parenta44abfdc29ee66ec1d51c2389405cbac479f35a7 (diff)
downloadrust-640f6f07494ece4ebe7e4d9680fff9a83ab4b0d2.tar.gz
rust-640f6f07494ece4ebe7e4d9680fff9a83ab4b0d2.zip
Add Pinned type for opting out of Unpin on stable
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/marker.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs
index d4a87b13f04..77db165bcbd 100644
--- a/src/libcore/marker.rs
+++ b/src/libcore/marker.rs
@@ -607,6 +607,16 @@ unsafe impl<'a, T: ?Sized> Freeze for &'a mut T {}
 #[unstable(feature = "pin", issue = "49150")]
 pub auto trait Unpin {}
 
+/// A type which does not implement `Unpin`.
+///
+/// If a type contains a `Pinned`, it will not implement `Unpin` by default.
+#[unstable(feature = "pin", issue = "49150")]
+#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
+pub struct Pinned;
+
+#[unstable(feature = "pin", issue = "49150")]
+impl !Unpin for Pinned {}
+
 /// Implementations of `Copy` for primitive types.
 ///
 /// Implementations that cannot be described in Rust