From 3b5ef4eb984df78f5bfc4f9ff22181908177886f Mon Sep 17 00:00:00 2001 From: Ryan Thomas Date: Sun, 30 Oct 2022 01:59:29 +1100 Subject: [PATCH] time: document that timeouts check only before poll (#5126) --- tokio/src/time/timeout.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tokio/src/time/timeout.rs b/tokio/src/time/timeout.rs index c7f24410783..c6adfd935b7 100644 --- a/tokio/src/time/timeout.rs +++ b/tokio/src/time/timeout.rs @@ -21,6 +21,10 @@ 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 +/// does not yield during execution then it is possible for the future to complete +/// and exceed the timeout _without_ returning an error. +/// /// This function returns a future whose return type is [`Result`]``, where `T` is the /// return type of the provided future. ///