diff options
| author | bors <bors@rust-lang.org> | 2020-06-19 23:04:41 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-06-19 23:04:41 +0000 |
| commit | 34c5cd9a64d8537236626c4ccbed39a924cd38e2 (patch) | |
| tree | b9b73acf0895861bf6991337643170178e2c890d /src/liballoc/task.rs | |
| parent | 2d8bd9b74dc0cf06d881bac645698ccbcf9d9c5e (diff) | |
| parent | a88182f94b0141a8df54fe86aad07d857baff911 (diff) | |
| download | rust-34c5cd9a64d8537236626c4ccbed39a924cd38e2.tar.gz rust-34c5cd9a64d8537236626c4ccbed39a924cd38e2.zip | |
Auto merge of #73511 - Manishearth:rollup-3iffxd8, r=Manishearth
Rollup of 13 pull requests Successful merges: - #71568 (Document unsafety in slice/sort.rs) - #72709 (`#[deny(unsafe_op_in_unsafe_fn)]` in liballoc) - #73214 (Add asm!() support for hexagon) - #73248 (save_analysis: improve handling of enum struct variant) - #73257 (ty: projections in `transparent_newtype_field`) - #73261 (Suggest `?Sized` when applicable for ADTs) - #73300 (Implement crate-level-only lints checking.) - #73334 (Note numeric literals that can never fit in an expected type) - #73357 (Use `LocalDefId` for import IDs in trait map) - #73364 (asm: Allow multiple template string arguments; interpret them as newline-separated) - #73382 (Only display other method receiver candidates if they actually apply) - #73465 (Add specialization of `ToString for char`) - #73489 (Refactor hir::Place) Failed merges: r? @ghost
Diffstat (limited to 'src/liballoc/task.rs')
| -rw-r--r-- | src/liballoc/task.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/liballoc/task.rs b/src/liballoc/task.rs index 745444a152e..0d1cc99df47 100644 --- a/src/liballoc/task.rs +++ b/src/liballoc/task.rs @@ -60,7 +60,7 @@ impl<W: Wake + Send + Sync + 'static> From<Arc<W>> for RawWaker { 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 { - Arc::incr_strong_count(waker as *const W); + unsafe { Arc::incr_strong_count(waker as *const W) }; RawWaker::new( waker as *const (), &RawWakerVTable::new(clone_waker::<W>, wake::<W>, wake_by_ref::<W>, drop_waker::<W>), @@ -69,19 +69,20 @@ 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> = Arc::from_raw(waker as *const W); + let waker: Arc<W> = 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>> = ManuallyDrop::new(Arc::from_raw(waker as *const W)); + let waker: ManuallyDrop<Arc<W>> = + unsafe { ManuallyDrop::new(Arc::from_raw(waker as *const W)) }; <W as Wake>::wake_by_ref(&waker); } // Decrement the reference count of the Arc on drop unsafe fn drop_waker<W: Wake + Send + Sync + 'static>(waker: *const ()) { - Arc::decr_strong_count(waker as *const W); + unsafe { Arc::decr_strong_count(waker as *const W) }; } RawWaker::new( |
