Auto merge of #114589 - ijackson:exit-code-default, r=dtolnay
impl Default for ExitCode As suggested here https://github.com/rust-lang/rust/pull/106425#issuecomment-1382952598 Needs FCP since this is an insta-stable impl. Ideally we would have `impl From<ExitCode> for ExitStatus` and implement the default `ExitStatus` using that. That is sadly not so easy because of the various strange confusions about `ExitCode` (unix: exit status) vs `ExitStatus` (unix: wait status) in the not-really-unix platforms in `library//src/sys/unix/process`. I'll try to follow that up.
This commit is contained in:
commit
58352c0649
@ -1594,7 +1594,7 @@ fn from(inherit: io::Stderr) -> Stdio {
|
||||
pub struct ExitStatus(imp::ExitStatus);
|
||||
|
||||
/// The default value is one which indicates successful completion.
|
||||
#[stable(feature = "process-exitcode-default", since = "1.73.0")]
|
||||
#[stable(feature = "process_exitstatus_default", since = "1.73.0")]
|
||||
impl Default for ExitStatus {
|
||||
fn default() -> Self {
|
||||
// Ideally this would be done by ExitCode::default().into() but that is complicated.
|
||||
@ -1960,6 +1960,14 @@ pub fn to_i32(self) -> i32 {
|
||||
}
|
||||
}
|
||||
|
||||
/// The default value is [`ExitCode::SUCCESS`]
|
||||
#[stable(feature = "process_exitcode_default", since = "CURRENT_RUSTC_VERSION")]
|
||||
impl Default for ExitCode {
|
||||
fn default() -> Self {
|
||||
ExitCode::SUCCESS
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "process_exitcode", since = "1.61.0")]
|
||||
impl From<u8> for ExitCode {
|
||||
/// Construct an `ExitCode` from an arbitrary u8 value.
|
||||
|
Loading…
Reference in New Issue
Block a user