From 66e29121b333d1ba5bde803f570e421524d4431e Mon Sep 17 00:00:00 2001 From: Patrick Wehbe <50799614+patrickwehbe@users.noreply.github.com> Date: Fri, 19 Jun 2026 23:32:30 +0300 Subject: [PATCH] time: fix reversed poll order in timeout doc (#8214) The timeout doc said the timeout is checked before polling the future, but the impl polls the future first and only then checks the delay (see the Future impl for Timeout, which calls me.value.poll before poll_delay). Reverse the clause to match the implementation. This is also what makes the rest of the sentence correct: the future can complete and exceed the timeout without an error precisely because it is polled before the timeout is checked. Co-authored-by: Patrick Wehbe --- tokio/src/time/timeout.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tokio/src/time/timeout.rs b/tokio/src/time/timeout.rs index fc2065c11..48862cea2 100644 --- a/tokio/src/time/timeout.rs +++ b/tokio/src/time/timeout.rs @@ -21,7 +21,7 @@ use std::task::{self, Poll}; /// value is returned. Otherwise, an error is returned and the future is /// canceled. /// -/// Note that the timeout is checked before polling the future, so if the future +/// Note that the future is polled before the timeout is checked, so if the future /// does not yield during execution then it is possible for the future to complete /// and exceed the timeout _without_ returning an error. ///