about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorJohn Gallagher <jgallag88@gmail.com>2017-07-09 17:52:20 -0400
committerJohn Gallagher <jgallag88@gmail.com>2017-07-09 17:59:59 -0400
commitc6b280e0396780179a20776b55e3fa4cf4b1a513 (patch)
treed46c5c3d2c4ab51c4363c20632687e2a3da354c8 /src/libstd
parent55ad73b0266bef8dfb3ee6f9d7d6b3cf5d119e77 (diff)
downloadrust-c6b280e0396780179a20776b55e3fa4cf4b1a513.tar.gz
rust-c6b280e0396780179a20776b55e3fa4cf4b1a513.zip
Add warning to BufWriter documentation
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/io/buffered.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index 296ee78aadb..1b832453523 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -276,7 +276,10 @@ impl<R: Seek> Seek for BufReader<R> {
 /// `BufWriter` keeps an in-memory buffer of data and writes it to an underlying
 /// writer in large, infrequent batches.
 ///
-/// The buffer will be written out when the writer is dropped.
+/// When the `BufWriter` is dropped, the contents of its buffer will be written
+/// out. However, any errors that happen in the process of flushing the buffer
+/// when the writer is dropped will be ignored. Code that wishes to handle such
+/// errors must manually call [`flush`] before the writer is dropped.
 ///
 /// # Examples
 ///
@@ -316,6 +319,7 @@ impl<R: Seek> Seek for BufReader<R> {
 /// [`Write`]: ../../std/io/trait.Write.html
 /// [`Tcpstream::write`]: ../../std/net/struct.TcpStream.html#method.write
 /// [`TcpStream`]: ../../std/net/struct.TcpStream.html
+/// [`flush`]: #method.flush
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct BufWriter<W: Write> {
     inner: Option<W>,