summaryrefslogtreecommitdiffstats
path: root/tokio/src/io/async_read.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tokio/src/io/async_read.rs')
-rw-r--r--tokio/src/io/async_read.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/tokio/src/io/async_read.rs b/tokio/src/io/async_read.rs
index 2bccb17f..8f6e0b98 100644
--- a/tokio/src/io/async_read.rs
+++ b/tokio/src/io/async_read.rs
@@ -57,6 +57,11 @@ pub trait AsyncRead {
///
/// This function is called from [`poll_read_buf`].
///
+ /// # Safety
+ ///
+ /// Implementations that return `false` must never read from data slices
+ /// that they did not write to.
+ ///
/// [`io::Read`]: std::io::Read
/// [`poll_read_buf`]: #method.poll_read_buf
unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [u8]) -> bool {