Skip to content

Commit e1ec814

Browse files
committed
Apply more review suggestions
1 parent f005e1c commit e1ec814

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/libcore/future/future.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ use task::{Poll, Waker};
1919
/// final value. This method does not block if the value is not ready. Instead,
2020
/// the current task is scheduled to be woken up when it's possible to make
2121
/// further progress by `poll`ing again. The wake up is performed using
22-
/// `cx.waker()`, a handle for waking up the current task.
22+
/// the `waker` argument of the `poll()` method, which is a handle for waking
23+
/// up the current task.
2324
///
2425
/// When using a future, you generally won't call `poll` directly, but instead
2526
/// `await!` the value.
@@ -78,8 +79,9 @@ pub trait Future {
7879
///
7980
/// Once a future has completed (returned `Ready` from `poll`),
8081
/// then any future calls to `poll` may panic, block forever, or otherwise
81-
/// cause bad behavior. The `Future` trait itself provides no guarantees
82-
/// about the behavior of `poll` after a future has completed.
82+
/// cause any kind of bad behavior expect causing memory unsafety.
83+
/// The `Future` trait itself provides no guarantees about the behavior
84+
/// of `poll` after a future has completed.
8385
///
8486
/// [`Poll::Pending`]: ../task/enum.Poll.html#variant.Pending
8587
/// [`Poll::Ready(val)`]: ../task/enum.Poll.html#variant.Ready

src/libcore/task/wake.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ pub struct RawWakerVTable {
4242

4343
/// This function will be called when `wake` is called on the [`Waker`].
4444
/// It must wake up the task associated with this [`RawWaker`].
45+
///
46+
/// The implemention of this function must not consume the provided data
47+
/// pointer.
4548
pub wake: unsafe fn(*const ()),
4649

4750
/// This function gets called when a [`RawWaker`] gets dropped.
@@ -125,7 +128,10 @@ impl Drop for Waker {
125128

126129
impl fmt::Debug for Waker {
127130
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
131+
let vtable_ptr = self.waker.vtable as *const RawWakerVTable;
128132
f.debug_struct("Waker")
133+
.field("data", &self.waker.data)
134+
.field("vtable", &vtable_ptr)
129135
.finish()
130136
}
131137
}

0 commit comments

Comments
 (0)