Skip to content

Commit 363e992

Browse files
committed
review suggestions
1 parent e1ec814 commit 363e992

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/libcore/future/future.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,15 @@ pub trait Future {
6868
/// typically do *not* suffer the same problems of "all wakeups must poll
6969
/// all events"; they are more like `epoll(4)`.
7070
///
71-
/// An implementation of `poll` should strive to return quickly, and must
72-
/// *never* block. Returning quickly prevents unnecessarily clogging up
71+
/// An implementation of `poll` should strive to return quickly, and should
72+
/// not block. Returning quickly prevents unnecessarily clogging up
7373
/// threads or event loops. If it is known ahead of time that a call to
7474
/// `poll` may end up taking awhile, the work should be offloaded to a
7575
/// thread pool (or something similar) to ensure that `poll` can return
7676
/// quickly.
7777
///
78+
/// An implementation of `poll` may also never cause memory unsafety.
79+
///
7880
/// # Panics
7981
///
8082
/// Once a future has completed (returned `Ready` from `poll`),

src/libcore/task/wake.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ pub struct RawWaker {
2929
///
3030
/// The pointer passed to all functions inside the vtable is the `data` pointer
3131
/// from the enclosing [`RawWaker`] object.
32+
///
33+
/// The functions inside this struct are only intended be called on the `data`
34+
/// pointer of a properly constructed [`RawWaker`] object from inside the
35+
/// [`RawWaker`] implementation. Calling one of the contained functions using
36+
/// any other `data` pointer will cause undefined behavior.
3237
#[derive(PartialEq, Copy, Clone, Debug)]
3338
pub struct RawWakerVTable {
3439
/// This function will be called when the [`RawWaker`] gets cloned, e.g. when

0 commit comments

Comments
 (0)