Skip to content

Commit 2d171d8

Browse files
authored
Rollup merge of #59472 - czipperz:bufreader-document-drop-discards, r=Centril
Document that `std::io::BufReader` discards contents on drop Resolves #55546
2 parents d5b8048 + ffaa5c9 commit 2d171d8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libstd/io/buffered.rs

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ use crate::memchr;
2121
/// times. It also provides no advantage when reading from a source that is
2222
/// already in memory, like a `Vec<u8>`.
2323
///
24+
/// When the `BufReader` is dropped, the contents of its buffer will be
25+
/// discarded. Creating multiple instances of a `BufReader` on the same
26+
/// stream can cause data loss.
27+
///
2428
/// [`Read`]: ../../std/io/trait.Read.html
2529
/// [`TcpStream::read`]: ../../std/net/struct.TcpStream.html#method.read
2630
/// [`TcpStream`]: ../../std/net/struct.TcpStream.html

0 commit comments

Comments
 (0)