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
Tracking Issue for RFC 2930 (read-buf) #78485
Comments
( cc @rust-lang/libs ) |
I'm interested in working on this. @rustbot claim |
I am slightly confused by the API of edit: probably I should ask this on zulip instead of github |
It would return |
I would have expected it to return |
Sure, that makes sense. |
@drmeepster are you still working on this? |
Yeah, I am. Although I'm currently working on #79607 because I needed it for this. |
Okay, I can continue working on this now that we have |
I have a PR to add an |
Have we considered extending This came up because I'm looking into fixing some UB in rayon, which is passing around uninitialized Going further, it would also be interesting to see if we could rewrite |
I made very similar points here: https://internals.rust-lang.org/t/readbuf-as-part-of-rust-edition-2021/14256/9?u=djc |
Note that we now have a |
Currently, if you |
Could we please have a shared interface trait for Seek::stream_position and BorrowedBuf::len? That would help in adapting library crates such as |
I just want to note that while |
I'm interested in The current implementation of those types has no dependency on |
…nic, r=dtolnay Don't panic in `<BorrowedCursor as io::Write>::write` Instead of panicking if the BorrowedCursor does not have enough capacity for the whole buffer, just return a short write, [like `<&mut [u8] as io::Write>::write` does](https://doc.rust-lang.org/src/std/io/impls.rs.html#349). (cc `@ChayimFriedman2` rust-lang#78485 (comment)) (I'm not sure if this needs an ACP? since it's not changing the "API", just what the function does)
…c, r=dtolnay Don't panic in `<BorrowedCursor as io::Write>::write` Instead of panicking if the BorrowedCursor does not have enough capacity for the whole buffer, just return a short write, [like `<&mut [u8] as io::Write>::write` does](https://doc.rust-lang.org/src/std/io/impls.rs.html#349). (cc `@ChayimFriedman2` rust-lang#78485 (comment)) (I'm not sure if this needs an ACP? since it's not changing the "API", just what the function does)
Don't panic in `<BorrowedCursor as io::Write>::write` Instead of panicking if the BorrowedCursor does not have enough capacity for the whole buffer, just return a short write, [like `<&mut [u8] as io::Write>::write` does](https://doc.rust-lang.org/src/std/io/impls.rs.html#349). (cc `@ChayimFriedman2` rust-lang/rust#78485 (comment)) (I'm not sure if this needs an ACP? since it's not changing the "API", just what the function does)
The
but the very next paragraph:
Looking at the actual implementations makes it obvious that they mostly pass-through and grab slices from the underlying |
Does Also related to @the8472's comment, docs need examples. |
Don't panic in `<BorrowedCursor as io::Write>::write` Instead of panicking if the BorrowedCursor does not have enough capacity for the whole buffer, just return a short write, [like `<&mut [u8] as io::Write>::write` does](https://doc.rust-lang.org/src/std/io/impls.rs.html#349). (cc `@ChayimFriedman2` rust-lang/rust#78485 (comment)) (I'm not sure if this needs an ACP? since it's not changing the "API", just what the function does)
There is something "fun" with I don't know if this is expected and it is probably useful, but it might be surprising if some implementations start doing that. In fact,
Something more problematic is that it is impossible to write a correct |
Tbh, I think |
Don't panic in `<BorrowedCursor as io::Write>::write` Instead of panicking if the BorrowedCursor does not have enough capacity for the whole buffer, just return a short write, [like `<&mut [u8] as io::Write>::write` does](https://doc.rust-lang.org/src/std/io/impls.rs.html#349). (cc `@ChayimFriedman2` rust-lang/rust#78485 (comment)) (I'm not sure if this needs an ACP? since it's not changing the "API", just what the function does)
This is a tracking issue for the RFC "2930" (rust-lang/rfcs#2930).
The feature gate for the issue is
#![feature(read_buf)]
.About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
read_buf_vectored
,ReadBufs
).rustc_must_implement_one_of
, which is a language-observable thing, and thus needs some amount of oversight/documentation about that as a prerequisite of stabilization.Unresolved Questions
read_buf
return the number of bytes read likeread
does or should theReadBuf
track it instead? Some operations, like checking for EOF, are a bit simpler ifread_buf
returns the value, but the confusion around what is and is not trustworthy is worrysome for unsafe code working withRead
implementations.assume_init
be named?&mut ReadBuf
to prevent unexpected swapping of the caller-providedReadBuf
?BufWriter
copy_to specialization with the unstableread_buf
feature #93305Implementation history
The text was updated successfully, but these errors were encountered: