Skip to content

Commit d963224

Browse files
committed
Auto merge of rust-lang#114589 - ijackson:exit-code-default, r=dtolnay
impl Default for ExitCode As suggested here rust-lang#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.
2 parents 193e8a1 + 01494da commit d963224

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

library/std/src/process.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1960,6 +1960,14 @@ impl ExitCode {
19601960
}
19611961
}
19621962

1963+
/// The default value is [`ExitCode::SUCCESS`]
1964+
#[stable(feature = "process-exitcode-default", since = "CURRENT_RUSTC_VERSION")]
1965+
impl Default for ExitCode {
1966+
fn default() -> Self {
1967+
ExitCode::SUCCESS
1968+
}
1969+
}
1970+
19631971
#[stable(feature = "process_exitcode", since = "1.61.0")]
19641972
impl From<u8> for ExitCode {
19651973
/// Construct an `ExitCode` from an arbitrary u8 value.

0 commit comments

Comments
 (0)