]> git.lizzy.rs Git - rust.git/commitdiff
More explicit; CFG on atomic pointer
authorWithout Boats <woboats@gmail.com>
Sun, 2 Feb 2020 15:51:54 +0000 (16:51 +0100)
committerWithout Boats <woboats@gmail.com>
Mon, 23 Mar 2020 14:45:30 +0000 (15:45 +0100)
src/liballoc/lib.rs
src/liballoc/task.rs

index 4d9e8cd34608c38b4ec4848ac98cc50847b59a59..d55a1a3b63584185cdb60e86ee6f26d650334796 100644 (file)
@@ -161,6 +161,7 @@ mod boxed {
 pub mod string;
 #[cfg(target_has_atomic = "ptr")]
 pub mod sync;
+#[cfg(target_has_atomic = "ptr")]
 pub mod task;
 #[cfg(test)]
 mod tests;
index 8da2989784d955a84fc9db9d505656828b268abb..3705ec9dcb6c90371a7c77f373f836256293a16d 100644 (file)
@@ -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