about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWithout Boats <woboats@gmail.com>2020-02-02 16:51:54 +0100
committerWithout Boats <woboats@gmail.com>2020-03-23 15:45:30 +0100
commit3ae74cafe483b16c6810a4ff34de03da4974b1ce (patch)
treeb4e1fbda797ebe10f676e4446e3b7f72bd639eac
parentede03a417501eeb2c9913e69cde1a7407f6a91db (diff)
downloadrust-3ae74cafe483b16c6810a4ff34de03da4974b1ce.tar.gz
rust-3ae74cafe483b16c6810a4ff34de03da4974b1ce.zip
More explicit; CFG on atomic pointer
-rw-r--r--src/liballoc/lib.rs1
-rw-r--r--src/liballoc/task.rs6
2 files changed, 4 insertions, 3 deletions
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs
index 4d9e8cd3460..d55a1a3b635 100644
--- a/src/liballoc/lib.rs
+++ b/src/liballoc/lib.rs
@@ -161,6 +161,7 @@ pub mod str;
 pub mod string;
 #[cfg(target_has_atomic = "ptr")]
 pub mod sync;
+#[cfg(target_has_atomic = "ptr")]
 pub mod task;
 #[cfg(test)]
 mod tests;
diff --git a/src/liballoc/task.rs b/src/liballoc/task.rs
index 8da2989784d..3705ec9dcb6 100644
--- a/src/liballoc/task.rs
+++ b/src/liballoc/task.rs
@@ -59,20 +59,20 @@ fn raw_waker<W: Wake + Send + Sync + 'static>(waker: Arc<W>) -> RawWaker {
     // Increment the reference count of the arc to clone it.
     unsafe fn clone_waker<W: Wake + Send + Sync + 'static>(waker: *const ()) -> RawWaker {
         let waker: Arc<W> = Arc::from_raw(waker as *const W);
-        mem::forget(waker.clone());
+        mem::forget(Arc::clone(&waker));
         raw_waker(waker)
     }
 
     // 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> = Arc::from_raw(waker as *const W);
-        Wake::wake(waker);
+        <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>> = ManuallyDrop::new(Arc::from_raw(waker as *const W));
-        Wake::wake_by_ref(&waker);
+        <W as Wake>::wake_by_ref(&waker);
     }
 
     // Decrement the reference count of the Arc on drop