impl Default for ExitStatus #158
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
It is not possible for code outside std to portably create an
ExitStatus
without actually running a process.Motivation, use-cases
In some cases it might be convenient to use
Option<ExitStatus>
; butExitStatus
is already kind of option-ish in that it can represent an error, or no error.It is IMO not reasonable to have a type that a user can mostly-portably create, but to require a user to run a dummy process to do so. This type can already be non-portably constructed on Unix and Windows via
ExitStatusExt
.Solution sketches
The obvious-to-me answer is to
impl Default for ExitStatus
.I did that in rust-lang/rust#106425 and am now belatedly making this ACP.
A consequence is that
ExitStatus
now becomes inhabited even on platforms without subprocesses. This seems reasonable.Links and related work
See also the tracking issue for thec currently-unstable
ExitStatusError
, rust-lang/rust#84908. I'm postponing addressing the same question forExitStatusError
, but it should be considered before stabilisation.What happens now?
This issue is part of the libs-api team API change proposal process. Once this issue is filed the libs-api team will review open proposals in its weekly meeting. You should receive feedback within a week or two.
The text was updated successfully, but these errors were encountered: