about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarco Conte <marco@enhance.com>2019-10-18 12:28:04 +0100
committerMarco Conte <marco@enhance.com>2019-10-31 10:48:33 +0000
commit900c13e7f465e53a3bae7ff91a1090d6faf29416 (patch)
tree63dcf28007b91b7982b8614ac11ff6e386c03cdd
parent2f16be42dd64669b784559e98662d9712ce13fab (diff)
downloadrust-900c13e7f465e53a3bae7ff91a1090d6faf29416.tar.gz
rust-900c13e7f465e53a3bae7ff91a1090d6faf29416.zip
enhance the documentation of std::io::BufReader regarding potential data loss
-rw-r--r--src/libstd/io/buffered.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index 9593a1bae0a..7870c56b476 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -24,7 +24,8 @@ use crate::memchr;
 ///
 /// When the `BufReader<R>` is dropped, the contents of its buffer will be
 /// discarded. Creating multiple instances of a `BufReader<R>` on the same
-/// stream can cause data loss.
+/// stream can cause data loss, as well as reading from the underlying reader
+/// after unwrapping the `BufReader<R>` instance with `BufReader<R>::into_inner()`.
 ///
 /// [`Read`]: ../../std/io/trait.Read.html
 /// [`TcpStream::read`]: ../../std/net/struct.TcpStream.html#method.read
@@ -179,7 +180,8 @@ impl<R> BufReader<R> {
 
     /// Unwraps this `BufReader<R>`, returning the underlying reader.
     ///
-    /// Note that any leftover data in the internal buffer is lost.
+    /// Note that any leftover data in the internal buffer is lost. Therefore,
+    /// a following read from the underlying reader may lead to data loss.
     ///
     /// # Examples
     ///