Skip to content

Commit

Permalink
Auto merge of #114589 - ijackson:exit-code-default, r=dtolnay
Browse files Browse the repository at this point in the history
impl Default for ExitCode

As suggested here
  #106425 (comment)

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.
  • Loading branch information
bors committed Oct 13, 2023
2 parents 193e8a1 + 01494da commit d963224
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions library/std/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1960,6 +1960,14 @@ impl ExitCode {
}
}

/// 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.
Expand Down

0 comments on commit d963224

Please sign in to comment.