-
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
Stabilize Bufwriter::into_raw_parts #84770
Conversation
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
r? @dtolnay (rust-highfive has picked a reviewer for you, use r? to override) |
@rustbot modify labels +T-libs +needs-fcp |
Error: Label needs-fcp can only be set by Rust team members Please let |
@rustbot modify labels +T-libs |
Triage note: FCPs are open on these issues: #80690 (comment), #79704 (comment) |
☔ The latest upstream changes (presumably #87413) made this pull request unmergeable. Please resolve the merge conflicts. |
Uh. I did not mean to close this. I meant to update it. Here we are, rebased onto master. |
Stabilise BufWriter::into_parts The FCP for this has already completed, in rust-lang#80690. This was just blocked on rust-lang#85901 (which changed the name), which is now merged. The original stabilisation MR was rust-lang#84770 but that has a lot of noise in it, and I also accidentally deleted the branch while trying to tidy up. So here is a new MR. Sorry for the noise. Closes rust-lang#80690
Update 2021-08-24
The FCP for this has already completed in #80690. This was just blocked on #85901 (which changed the name), which is now merged.
Update 2021-07-24
The methods on
IntoInnerError
were stabilised in #87175 (thanks, @inquisitivecrystal).Stabilisation of
BufWriter::into[_raw]_parts
is blocked on #85901 which fixes some missing exports and changes the name. That MR is awaiting review.Background and discussion
These two sets of methods both relate to disassembling a
BufWriter
. It is most convenient to consider them together:BufWriter::into_raw_parts
(docs)IntoInnerError::into_parts
andinto_error
(docs)Without at least one of these, if the underlying writer is failing, it is not possible to get all of the innards out in a useable form for error recovery, no matter how much you know about the underlying writer and what went wrong.
Strictly speaking,
BufWriter::into_raw_parts
is sufficient. That avoids callingBufWriter::into_inner
and therefore anIntoInnerError
cannot arise. It is possibly also simpler in some cases where the caller wants to take care about errors. Butinto_raw_parts
is clumsy in simpler situations (where what's wanted is a call that does the flush before disassembly and where errors will be considered to invalidate the underlying writer).BufWriter::into_raw_parts
was merged on 2021-01-19, and theIntoInnerError
disassembly methods on 2020-12-05.Alternatives
into_raw_parts
. This would be sufficient, although it does leaveinto_inner
as something of a decoy - ifinto_inner
is used, but later a need to do error recovery arises, the maintenance programmers will have to replaceinto_inner
withinto_raw_parts
, so as to avoid ending up with an intractableIntoInnerError
, and reorganise the deconstruction code. Some of the pain here could be mitigated through documentation, which could explain that that this is what is needed. But it still seems rather perverse: it would be deliberately avoiding providinginto_*
deconstruction methods on a type which could easily have them.into_raw_parts
and deprecateinto_inner
,IntoInnerError
, and never stabilise the new disassembly methods onIntoInnerError
. This seems unfriendly as it makes this complicated in simple situations.BufWriter
's source into their project to add it. This (the current situation on stable) is quite poor.Open questions
None.
Resolved questions
into_raw_parts
be better? No: BufWriter: Provide into_raw_parts #79705 (comment)