Skip to content

Commit

Permalink
Rollup merge of rust-lang#74316 - yoshuawuyts:no-wake-type-hints, r=M…
Browse files Browse the repository at this point in the history
…ark-Simulacrum

Remove unnecessary type hints from Wake internals

While working on rust-lang#74304 I noticed we were writing out the type signature twice in some internal `Wake` impl methods; this streamlines that. Thanks!
  • Loading branch information
Manishearth authored Jul 14, 2020
2 parents 99c0b97 + 0e9a20f commit 2fb307a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/liballoc/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,13 @@ fn raw_waker<W: Wake + Send + Sync + 'static>(waker: Arc<W>) -> RawWaker {

// Wake by value, moving the Arc into the Wake::wake function
unsafe fn wake<W: Wake + Send + Sync + 'static>(waker: *const ()) {
let waker: Arc<W> = unsafe { Arc::from_raw(waker as *const W) };
let waker = unsafe { Arc::from_raw(waker as *const W) };
<W as Wake>::wake(waker);
}

// Wake by reference, wrap the waker in ManuallyDrop to avoid dropping it
unsafe fn wake_by_ref<W: Wake + Send + Sync + 'static>(waker: *const ()) {
let waker: ManuallyDrop<Arc<W>> =
unsafe { ManuallyDrop::new(Arc::from_raw(waker as *const W)) };
let waker = unsafe { ManuallyDrop::new(Arc::from_raw(waker as *const W)) };
<W as Wake>::wake_by_ref(&waker);
}

Expand Down

0 comments on commit 2fb307a

Please sign in to comment.