Repository: rust
Issue: Tracking Issue for RFC 2930 (read-buf)
Labels: B-RFC-approved,T-libs-api,C-tracking-issue,A-io,Libs-Tracked

<!--
Thank you for creating a tracking issue! 📜 Tracking issues are for tracking a
feature from implementation to stabilisation. Make sure to include the relevant
RFC for the feature if it has one. Otherwise provide a short summary of the
feature and link any relevant PRs or issues, and remove any sections that are
not relevant to the feature.

Remember to add team labels to the tracking issue.
For a language team feature, this would e.g., be `T-lang`.
Such a feature should also be labeled with e.g., `F-my_feature`.
This label is used to associate issues (e.g., bugs and design questions) to the feature.
-->

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
<!--
Include each step required to complete the feature. Typically this is a PR
implementing a feature, followed by a PR that stabilises the feature. However
for larger features an implementation could be broken up into multiple PRs.
-->

- [ ] Implement the RFC
  - [x] Initial implementation in https://github.com/rust-lang/rust/pull/81156
  - [ ] Vectorized APIs (`read_buf_vectored`, `ReadBufs`).
- [ ] Adjust documentation ([see instructions on rustc-dev-guide][doc-guide])
- [ ] Stabilization PR ([see instructions on rustc-dev-guide][stabilization-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.

[stabilization-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr
[doc-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#documentation-prs

### Unresolved Questions
<!--
Include any open questions that need to be answered before the feature can be
stabilised.
-->

* Should `read_buf` return the number of bytes read like `read` does or should the `ReadBuf` track it instead? Some operations, like checking for EOF, are a bit simpler if `read_buf` returns the value, but the confusion around what is and is not trustworthy is worrysome for unsafe code working with `Read` implementations.
* [What should `assume_init` be named?](https://github.com/rust-lang/rust/pull/81156#issuecomment-988536835)
* [Should the API use a wrapper around `&mut ReadBuf` to prevent unexpected swapping of the caller-provided `ReadBuf`?](https://github.com/rust-lang/rust/pull/81156#issuecomment-989192555)
* Resolve soundness issue: https://github.com/rust-lang/rust/issues/93305


### Implementation history

<!--
Include a list of all the PRs that were involved in implementing the feature.
-->
- https://github.com/rust-lang/rust/pull/81156


<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_ASSIGN_START -->

<!-- TRIAGEBOT_ASSIGN_DATA_START$${"user":"DrMeepster"}$$TRIAGEBOT_ASSIGN_DATA_END -->

<!-- TRIAGEBOT_ASSIGN_END -->
<!-- TRIAGEBOT_END -->