-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve several Read
implementations
#122441
Conversation
r? @ChrisDenton rustbot has assigned @ChrisDenton. Use r? to explicitly pick a reviewer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to code nits: Since Take::read_(buf_)exact
don't actually call into the inner reader if buf.len() > self.limit
, then you can get the weird case where take.read_exact(&mut long_buffer)
returns EOF, but then immediately afterwards take.read_exact(&mut short_buffer)
succeeds.
Perhaps self.limit
should be set to 0 if Err(EOF)
is returned from Take::read_(buf_)exact
? Though this would "decouple" the limit from how many bytes are actually read, but that already happens if we do call into the inner reader and its read_exact
fails, so 🤷.
cc92a9b
to
0db18e0
Compare
I think that One thing though, |
0db18e0
to
df0d955
Compare
@a1phyr Can you split out the Unix-specific changes into their own PR? |
7e790d3
to
576a0ba
Compare
…ingjubilee `UnixStream`: override `read_buf` Split from rust-lang#122441 r? `@workingjubilee`
…ingjubilee `UnixStream`: override `read_buf` Split from rust-lang#122441 r? ``@workingjubilee``
Rollup merge of rust-lang#123084 - a1phyr:unixstream_read_buf, r=workingjubilee `UnixStream`: override `read_buf` Split from rust-lang#122441 r? ``@workingjubilee``
☔ The latest upstream changes (presumably #122393) made this pull request unmergeable. Please resolve the merge conflicts. |
576a0ba
to
d1d142b
Compare
☔ The latest upstream changes (presumably #123732) made this pull request unmergeable. Please resolve the merge conflicts. |
d1d142b
to
2e3ee23
Compare
…Denton Improve several `Read` implementations - `read_to_end` and `read_to_string` for `Cursor` - Error on OOM in `read_to_string` of `&[u8]` and `VecDeque<u8>` - Avoid making the slices contiguous in `VecDeque::read_to_string` - ~`read_exact` and (unstable) `read_buf_exact` for `Take`~ - ~`read_buf` for `UnixStream` and `&UnixStream`~ (moved to rust-lang#123084) - `read_to_end` for `ChildStdErr`
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#122441 (Improve several `Read` implementations) - rust-lang#124584 (Various improvements to entrypoint code) - rust-lang#124699 (Use `unchecked_sub` in `split_at`) - rust-lang#124704 (Fix ignored tests for formatting) - rust-lang#124709 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#122441 (Improve several `Read` implementations) - rust-lang#124584 (Various improvements to entrypoint code) - rust-lang#124699 (Use `unchecked_sub` in `split_at`) - rust-lang#124704 (Fix ignored tests for formatting) - rust-lang#124709 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#122441 (Improve several `Read` implementations) - rust-lang#124584 (Various improvements to entrypoint code) - rust-lang#124699 (Use `unchecked_sub` in `split_at`) - rust-lang#124715 (interpret, miri: uniform treatments of intrinsics/functions with and without return block) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#122441 - a1phyr:improve_read_impls, r=ChrisDenton Improve several `Read` implementations - `read_to_end` and `read_to_string` for `Cursor` - Error on OOM in `read_to_string` of `&[u8]` and `VecDeque<u8>` - Avoid making the slices contiguous in `VecDeque::read_to_string` - ~`read_exact` and (unstable) `read_buf_exact` for `Take`~ - ~`read_buf` for `UnixStream` and `&UnixStream`~ (moved to rust-lang#123084) - `read_to_end` for `ChildStdErr`
read_to_end
andread_to_string
forCursor
read_to_string
of&[u8]
andVecDeque<u8>
VecDeque::read_to_string
read_exact
and (unstable)read_buf_exact
forTake
(moved toread_buf
forUnixStream
and&UnixStream
UnixStream
: overrideread_buf
#123084)read_to_end
forChildStdErr