From e5425014392de0a44c27fac054472b4c3926ef26 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Tue, 26 Mar 2024 20:45:15 +0330 Subject: [PATCH] io: document cancel safety of `AsyncBufReadExt::fill_buf` (#6431) --- tokio/src/io/util/async_buf_read_ext.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tokio/src/io/util/async_buf_read_ext.rs b/tokio/src/io/util/async_buf_read_ext.rs index 92500f7f869..1e9da4c8c4d 100644 --- a/tokio/src/io/util/async_buf_read_ext.rs +++ b/tokio/src/io/util/async_buf_read_ext.rs @@ -267,6 +267,12 @@ cfg_io_util! { /// This function will return an I/O error if the underlying reader was /// read, but returned an error. /// + /// # Cancel safety + /// + /// This method is cancel safe. If you use it as the event in a + /// [`tokio::select!`](crate::select) statement and some other branch + /// completes first, then it is guaranteed that no data was read. + /// /// [`consume`]: crate::io::AsyncBufReadExt::consume fn fill_buf(&mut self) -> FillBuf<'_, Self> where