Description
Location
https://doc.rust-lang.org/std/future/trait.Future.html#tymethod.poll
Summary
The documentation for Future::poll
reads:
Note that on multiple calls to
poll
, only theWaker
from theContext
passed to the most recent call should be scheduled to receive a wakeup.
The implications of violating this aren’t specified. One might conclude that it is a bug to wake both the old and new wakers, as it says only the new one should be used. On the other hand, it says “should”, not “must”.
Note that there is no way to avoid waking both wakers in certain cases. See for instance the answer to In async Rust, how can a Future make sure it only calls the most recent Waker?, which reads:
This may cause the old waker to be woken unnecessarily, but that's fine.
I believe the intent of this requirement for poll
is that there is no guarantee waking old wakers has any effect, but it is not a bug to wake them in addition to waking the most recent one. Is that correct? If so we may want to clarify this, preferably replacing the word “should” with something more concrete.