Make Waker and LocalWaker Unpin

These types never project pinned-ness into their contents,
so it is safe for them to be `Unpin`.
This commit is contained in:
Taylor Cramer 2018-06-29 19:33:16 -07:00
parent 2ce61c0aed
commit a2b21e5819

View File

@ -13,6 +13,7 @@
issue = "50547")]
use fmt;
use marker::Unpin;
use ptr::NonNull;
/// A `Waker` is a handle for waking up a task by notifying its executor that it
@ -25,6 +26,7 @@ pub struct Waker {
inner: NonNull<UnsafeWake>,
}
impl Unpin for Waker {}
unsafe impl Send for Waker {}
unsafe impl Sync for Waker {}
@ -99,6 +101,7 @@ pub struct LocalWaker {
inner: NonNull<UnsafeWake>,
}
impl Unpin for LocalWaker {}
impl !Send for LocalWaker {}
impl !Sync for LocalWaker {}