about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorChris Gregory <czipperz@gmail.com>2019-03-27 22:11:13 -0400
committerChris Gregory <czipperz@gmail.com>2019-03-27 22:11:13 -0400
commitffaa5c904e6de9cf15c44adfa43a56f046c28c42 (patch)
tree27be3fa463b4edb0e5b3fafa9bf2e34e97ff1c49 /src/libstd
parent07d350897c7f95bb40ae9762ad1e945f95fc37ae (diff)
downloadrust-ffaa5c904e6de9cf15c44adfa43a56f046c28c42.tar.gz
rust-ffaa5c904e6de9cf15c44adfa43a56f046c28c42.zip
Document that `std::io::BufReader` discards contents on drop
Resolves #55546
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/io/buffered.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index 4668e3ec7ea..487706b05bb 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -21,6 +21,10 @@ use crate::memchr;
 /// times. It also provides no advantage when reading from a source that is
 /// already in memory, like a `Vec<u8>`.
 ///
+/// When the `BufReader` is dropped, the contents of its buffer will be
+/// discarded. Creating multiple instances of a `BufReader` on the same
+/// stream can cause data loss.
+///
 /// [`Read`]: ../../std/io/trait.Read.html
 /// [`TcpStream::read`]: ../../std/net/struct.TcpStream.html#method.read
 /// [`TcpStream`]: ../../std/net/struct.TcpStream.html