about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorDrMeepster <19316085+DrMeepster@users.noreply.github.com>2021-06-29 15:25:08 -0700
committerDrMeepster <19316085+DrMeepster@users.noreply.github.com>2021-11-02 22:47:27 -0700
commit7c5a895a89e9e6b3950eecc443361281245b50ff (patch)
tree38fe20e6755f8c868e2d6dbbdefed981de38f894 /library/std/src
parent9562c01879475a01e3ac5a147bc3724a9b5bd1dc (diff)
downloadrust-7c5a895a89e9e6b3950eecc443361281245b50ff.tar.gz
rust-7c5a895a89e9e6b3950eecc443361281245b50ff.zip
fix test failure from trying to assume_init too much
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/io/copy.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/io/copy.rs b/library/std/src/io/copy.rs
index a75dbc76278..6ab96662305 100644
--- a/library/std/src/io/copy.rs
+++ b/library/std/src/io/copy.rs
@@ -103,7 +103,7 @@ impl<I: Write> BufferedCopySpec for BufWriter<I> {
                             return Ok(len);
                         }
 
-                        init = read_buf.initialized_len();
+                        init = read_buf.initialized_len() - bytes_read;
 
                         // SAFETY: ReadBuf guarantees all of its filled bytes are init
                         unsafe { buf.set_len(buf.len() + bytes_read) };