Rollup merge of #59472 - czipperz:bufreader-document-drop-discards, r=Centril

Document that `std::io::BufReader` discards contents on drop

Resolves #55546
This commit is contained in:
Mazdak Farrokhzad 2019-03-28 08:43:42 +01:00 committed by GitHub
commit 2d171d8350
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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