Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't view the same buffer; it might be updated while in use.
Due to a bug in how Enumerator#next progresses (it will run an iteration ahead of requested) this bug was exposed as #4903 where an Enumerator#next-based sink for IO.copy_stream showed previously-returned results getting modified after handoff. The same buffer array was being shared across all chunks written, which works ok if that view were only used within the confines of copy_stream, but in this case the chunks were held across more than a single write. Fixes #4903. See #5007 for the Enumerator#next bug.