Skip to content

Commit

Permalink
import core::ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
Gleb Pomykalov committed Aug 23, 2021
1 parent 958d43b commit 7a55899
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tokio/src/util/wake_list.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use core::mem::MaybeUninit;
use core::ptr;
use std::task::Waker;

const NUM_WAKERS: usize = 32;
Expand Down Expand Up @@ -32,7 +33,7 @@ impl WakeList {
assert!(self.curr <= NUM_WAKERS);
while self.curr > 0 {
self.curr -= 1;
let waker = unsafe { std::ptr::read(self.inner[self.curr].as_mut_ptr()) };
let waker = unsafe { ptr::read(self.inner[self.curr].as_mut_ptr()) };
waker.wake();
}
}
Expand All @@ -41,7 +42,7 @@ impl WakeList {
impl Drop for WakeList {
fn drop(&mut self) {
let slice =
std::ptr::slice_from_raw_parts_mut(self.inner.as_mut_ptr() as *mut Waker, self.curr);
unsafe { std::ptr::drop_in_place(slice) };
ptr::slice_from_raw_parts_mut(self.inner.as_mut_ptr() as *mut Waker, self.curr);
unsafe { ptr::drop_in_place(slice) };
}
}

0 comments on commit 7a55899

Please sign in to comment.