diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-03-28 08:43:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-28 08:43:42 +0100 |
| commit | 2d171d83505e92ea57631e7f1043e2d5cf841b16 (patch) | |
| tree | 55af2ea6b67167e3a65c51af19c640174a6f316d /src | |
| parent | d5b8048245f43bce521b8aabba344f795f2d56f8 (diff) | |
| parent | ffaa5c904e6de9cf15c44adfa43a56f046c28c42 (diff) | |
| download | rust-2d171d83505e92ea57631e7f1043e2d5cf841b16.tar.gz rust-2d171d83505e92ea57631e7f1043e2d5cf841b16.zip | |
Rollup merge of #59472 - czipperz:bufreader-document-drop-discards, r=Centril
Document that `std::io::BufReader` discards contents on drop Resolves #55546
Diffstat (limited to 'src')
| -rw-r--r-- | src/libstd/io/buffered.rs | 4 |
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 |
