Repository navigation
Tracking Issue for RFC 2930 (read-buf) #78485
Copy link
Copy link
Open
Labels
A-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`Area: `std::io`, `std::fs`, `std::net` and `std::path`B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
This is a tracking issue for the RFC "2930" (rust-lang/rfcs#2930).
The feature gate for the issue is #![feature(read_buf)].
This is now called BorrowedBuf rather than ReadBuf.
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
- Implement the RFC
- Initial implementation in Implement most of RFC 2930, providing the ReadBuf abstraction #81156
- Vectorized APIs (
read_buf_vectored,ReadBufs).
- Adjust documentation (see instructions on rustc-dev-guide)
- Stabilization PR (see instructions on rustc-dev-guide)
- Note that this is a use of
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.
- Note that this is a use of
Unresolved Questions
ShouldDiscussed in this issue, resolved at Tracking Issue for RFC 2930 (read-buf) #78485 (comment)read_bufreturn the number of bytes read likereaddoes or should theReadBuftrack it instead? Some operations, like checking for EOF, are a bit simpler ifread_bufreturns the value, but the confusion around what is and is not trustworthy is worrysome for unsafe code working withReadimplementations.What shouldRenamed toassume_initbe named?set_initin c1aae4d, in 2022. Also, this is now part of the separate feature gateborrowed_buf_initwhich we currently don't plan to stabilize.Should the API use a wrapper aroundResolved by std::io: migrate ReadBuf to BorrowedBuf/BorrowedCursor #97015&mut ReadBufto prevent unexpected swapping of the caller-providedReadBuf?- ~~Resolve soundness issue: Unsound
BufWritercopy_to specialization with the unstableread_buffeature #93305 ~~ Resolved by std::io: migrate ReadBuf to BorrowedBuf/BorrowedCursor #97015
Implementation history
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`Area: `std::io`, `std::fs`, `std::net` and `std::path`B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Activity
nikomatsakis commentedon Oct 28, 2020
( cc @rust-lang/libs )
beepster4096 commentedon Oct 28, 2020
I'm interested in working on this.
@rustbot claim
beepster4096 commentedon Nov 8, 2020
I am slightly confused by the API of
ReadBufs. What return type should methods likeinitializedhave:&[u8]or&[IoSlice]? If its the former, how do you know which slices are initialized/filled? If it's the latter, what happens if a slice is partially initialized/filled?edit: probably I should ask this on zulip instead of github
sfackler commentedon Nov 8, 2020
It would return
&[IoSliceMut], and only include the slices that are fully initialized.programmerjake commentedon Nov 8, 2020
I would have expected it to return
(&[IoSliceMut], &[u8])where it is some number of fully initialized buffers and the initialized portion of the partially initialized buffer.sfackler commentedon Nov 8, 2020
Sure, that makes sense.
sfackler commentedon Dec 5, 2020
@drmeepster are you still working on this?
beepster4096 commentedon Dec 5, 2020
Yeah, I am. Although I'm currently working on #79607 because I needed it for this.
beepster4096 commentedon Dec 17, 2020
Okay, I can continue working on this now that we have
MaybeUninit::write_slice101 remaining items
Rollup merge of #150129 - a1phyr:improve_buf_api, r=joshtriplett
`BorrowedBuf`: Update outdated safety comments in `set_init` users.
`BufWriter`: Note non-obvious safety assumption in `BorrowedBuf::set_…
`std::io::Take`: Clarify & optimize `BorrowedBuf::set_init` usage.
Rollup merge of rust-lang#155314 - briansmith:b/comments, r=joshtriplett
Unrolled build for #155314
tgross35 commentedon Aug 2, 2026
FCP has started on this at #117693 (comment)
Rollup merge of rust-lang#160477 - tgross35:borrowed-buf-init-trackin…
Rollup merge of rust-lang#160477 - tgross35:borrowed-buf-init-trackin…
Rollup merge of rust-lang#160477 - tgross35:borrowed-buf-init-trackin…
Unrolled build for #160477
Rollup merge of #160477 - tgross35:borrowed-buf-init-tracking, r=jhpratt