diff options
Diffstat (limited to 'library/std/src/io')
| -rw-r--r-- | library/std/src/io/copy.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/library/std/src/io/copy.rs b/library/std/src/io/copy.rs index 8d733325b3b..15e962924ac 100644 --- a/library/std/src/io/copy.rs +++ b/library/std/src/io/copy.rs @@ -248,8 +248,11 @@ impl<I: Write + ?Sized> BufferedWriterSpec for BufWriter<I> { Err(e) => return Err(e), } } else { + // All the bytes that were already in the buffer are initialized, + // treat them as such when the buffer is flushed. + init += buf.len(); + self.flush_buf()?; - init = 0; } } } |
