Skip to content

Commit dbe9d5d

Browse files
committed
More explicit; CFG on atomic pointer
1 parent 9beccfb commit dbe9d5d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/liballoc/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ pub mod str;
159159
pub mod string;
160160
#[cfg(target_has_atomic = "ptr")]
161161
pub mod sync;
162+
#[cfg(target_has_atomic = "ptr")]
162163
pub mod task;
163164
#[cfg(test)]
164165
mod tests;

src/liballoc/task.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,20 @@ fn raw_waker<W: Wake + Send + Sync + 'static>(waker: Arc<W>) -> RawWaker {
5959
// Increment the reference count of the arc to clone it.
6060
unsafe fn clone_waker<W: Wake + Send + Sync + 'static>(waker: *const ()) -> RawWaker {
6161
let waker: Arc<W> = Arc::from_raw(waker as *const W);
62-
mem::forget(waker.clone());
62+
mem::forget(Arc::clone(&waker));
6363
raw_waker(waker)
6464
}
6565

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

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

7878
// Decrement the reference count of the Arc on drop

0 commit comments

Comments
 (0)