Skip to content

Commit a2b21e5

Browse files
committed
Make Waker and LocalWaker Unpin
These types never project pinned-ness into their contents, so it is safe for them to be `Unpin`.
1 parent 2ce61c0 commit a2b21e5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/libcore/task/wake.rs

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
issue = "50547")]
1414

1515
use fmt;
16+
use marker::Unpin;
1617
use ptr::NonNull;
1718

1819
/// A `Waker` is a handle for waking up a task by notifying its executor that it
@@ -25,6 +26,7 @@ pub struct Waker {
2526
inner: NonNull<UnsafeWake>,
2627
}
2728

29+
impl Unpin for Waker {}
2830
unsafe impl Send for Waker {}
2931
unsafe impl Sync for Waker {}
3032

@@ -99,6 +101,7 @@ pub struct LocalWaker {
99101
inner: NonNull<UnsafeWake>,
100102
}
101103

104+
impl Unpin for LocalWaker {}
102105
impl !Send for LocalWaker {}
103106
impl !Sync for LocalWaker {}
104107

0 commit comments

Comments
 (0)