diff --git a/tokio/src/net/tcp/stream.rs b/tokio/src/net/tcp/stream.rs index c432b3f4370..33b15717a8d 100644 --- a/tokio/src/net/tcp/stream.rs +++ b/tokio/src/net/tcp/stream.rs @@ -1070,6 +1070,13 @@ impl TcpStream { /// Successive calls return the same data. This is accomplished by passing /// `MSG_PEEK` as a flag to the underlying `recv` system call. /// + /// # Cancel safety + /// + /// This method is cancel safe. If the method is used as the event in a + /// [`tokio::select!`](crate::select) statement and some other branch + /// completes first, then it is guaranteed that no peek was performed, and + /// that `buf` has not been modified. + /// /// # Examples /// /// ```no_run