File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ use task::{Poll, Waker};
19
19
/// final value. This method does not block if the value is not ready. Instead,
20
20
/// the current task is scheduled to be woken up when it's possible to make
21
21
/// 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.
23
24
///
24
25
/// When using a future, you generally won't call `poll` directly, but instead
25
26
/// `await!` the value.
@@ -78,8 +79,9 @@ pub trait Future {
78
79
///
79
80
/// Once a future has completed (returned `Ready` from `poll`),
80
81
/// 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.
83
85
///
84
86
/// [`Poll::Pending`]: ../task/enum.Poll.html#variant.Pending
85
87
/// [`Poll::Ready(val)`]: ../task/enum.Poll.html#variant.Ready
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ pub struct RawWakerVTable {
42
42
43
43
/// This function will be called when `wake` is called on the [`Waker`].
44
44
/// 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.
45
48
pub wake : unsafe fn ( * const ( ) ) ,
46
49
47
50
/// This function gets called when a [`RawWaker`] gets dropped.
@@ -125,7 +128,10 @@ impl Drop for Waker {
125
128
126
129
impl fmt:: Debug for Waker {
127
130
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
131
+ let vtable_ptr = self . waker . vtable as * const RawWakerVTable ;
128
132
f. debug_struct ( "Waker" )
133
+ . field ( "data" , & self . waker . data )
134
+ . field ( "vtable" , & vtable_ptr)
129
135
. finish ( )
130
136
}
131
137
}
You can’t perform that action at this time.
0 commit comments