Add Pinned type for opting out of Unpin on stable

This commit is contained in:
Taylor Cramer 2018-05-22 17:10:14 -07:00
parent a44abfdc29
commit 640f6f0749

View File

@ -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