-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add back BorrowedBuf::filled_mut
#139
Labels
ACP-accepted
API Change Proposal is accepted (seconded with no objections)
api-change-proposal
A proposal to add or alter unstable APIs in the standard libraries
T-libs-api
Comments
SUPERCILEX
added
api-change-proposal
A proposal to add or alter unstable APIs in the standard libraries
T-libs-api
labels
Nov 28, 2022
We briefly discussed this in today's meeting. Adding filled_mut back is fine. :) |
Amanieu
added
the
ACP-accepted
API Change Proposal is accepted (seconded with no objections)
label
Jul 11, 2023
Thank you so much! 🙏 |
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jul 11, 2023
Add back BorrowedBuf::filled_mut This is useful if you want to do some processing on the bytes while still using the BorrowedBuf. The API was removed in rust-lang#97015 with no explanation. The RFC also has it as part of its API, so this just seems like a mistake: [RFC](https://rust-lang.github.io/rfcs/2930-read-buf.html#:~:text=inline%5D%0A%20%20%20%20pub%20fn-,filled_mut,-(%26mut%20self)) ACP: rust-lang/libs-team#139
RalfJung
pushed a commit
to RalfJung/miri
that referenced
this issue
Jul 12, 2023
Add back BorrowedBuf::filled_mut This is useful if you want to do some processing on the bytes while still using the BorrowedBuf. The API was removed in rust-lang/rust#97015 with no explanation. The RFC also has it as part of its API, so this just seems like a mistake: [RFC](https://rust-lang.github.io/rfcs/2930-read-buf.html#:~:text=inline%5D%0A%20%20%20%20pub%20fn-,filled_mut,-(%26mut%20self)) ACP: rust-lang/libs-team#139
thomcc
pushed a commit
to tcdi/postgrestd
that referenced
this issue
Oct 17, 2023
Add back BorrowedBuf::filled_mut This is useful if you want to do some processing on the bytes while still using the BorrowedBuf. The API was removed in rust-lang/rust#97015 with no explanation. The RFC also has it as part of its API, so this just seems like a mistake: [RFC](https://rust-lang.github.io/rfcs/2930-read-buf.html#:~:text=inline%5D%0A%20%20%20%20pub%20fn-,filled_mut,-(%26mut%20self)) ACP: rust-lang/libs-team#139
lnicola
pushed a commit
to lnicola/rust-analyzer
that referenced
this issue
Apr 7, 2024
Add back BorrowedBuf::filled_mut This is useful if you want to do some processing on the bytes while still using the BorrowedBuf. The API was removed in rust-lang/rust#97015 with no explanation. The RFC also has it as part of its API, so this just seems like a mistake: [RFC](https://rust-lang.github.io/rfcs/2930-read-buf.html#:~:text=inline%5D%0A%20%20%20%20pub%20fn-,filled_mut,-(%26mut%20self)) ACP: rust-lang/libs-team#139
RalfJung
pushed a commit
to RalfJung/rust-analyzer
that referenced
this issue
Apr 27, 2024
Add back BorrowedBuf::filled_mut This is useful if you want to do some processing on the bytes while still using the BorrowedBuf. The API was removed in rust-lang/rust#97015 with no explanation. The RFC also has it as part of its API, so this just seems like a mistake: [RFC](https://rust-lang.github.io/rfcs/2930-read-buf.html#:~:text=inline%5D%0A%20%20%20%20pub%20fn-,filled_mut,-(%26mut%20self)) ACP: rust-lang/libs-team#139
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
ACP-accepted
API Change Proposal is accepted (seconded with no objections)
api-change-proposal
A proposal to add or alter unstable APIs in the standard libraries
T-libs-api
Proposal
Problem statement
The current
BorrowedBuf
API has no way to modify the filled data without using unsafe. This blocks several use cases:filled
buf.Motivation, use-cases
Need to mutate the initialized buffer for various reasons.
Solution sketches
See rust-lang/rust#103754. TL;DR: add
Links and related work
filled_mut
was part of the original RFC, but was removed during the split into BorrowedBuf and BorrowedCursor. The cited rationale is to make BorrowedBuf read-only and BorrowedCursor write-only. I don't believe this logic holds up for a number of reasons:filled_mut
.filled_mut
does not weaken the guarantees made by BorrowedBuf in any way.BorrowedBuf
(which can be annoying for a number of reasons) and manually convert the underlying MaybeUninit buffer to initialized u8s using unsafe.The text was updated successfully, but these errors were encountered: