Skip to content

Commit 640f6f0

Browse files
committed
Add Pinned type for opting out of Unpin on stable
1 parent a44abfd commit 640f6f0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/libcore/marker.rs

+10
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,16 @@ unsafe impl<'a, T: ?Sized> Freeze for &'a mut T {}
607607
#[unstable(feature = "pin", issue = "49150")]
608608
pub auto trait Unpin {}
609609

610+
/// A type which does not implement `Unpin`.
611+
///
612+
/// If a type contains a `Pinned`, it will not implement `Unpin` by default.
613+
#[unstable(feature = "pin", issue = "49150")]
614+
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
615+
pub struct Pinned;
616+
617+
#[unstable(feature = "pin", issue = "49150")]
618+
impl !Unpin for Pinned {}
619+
610620
/// Implementations of `Copy` for primitive types.
611621
///
612622
/// Implementations that cannot be described in Rust

0 commit comments

Comments
 (0)