about summary refs log tree commit diff
path: root/library
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-10-16 02:06:01 +0000
committerbors <bors@rust-lang.org>2023-10-16 02:06:01 +0000
commit58352c06497ac1cc8f7c49d30d6df967134efbaf (patch)
tree53e6d71f6e6442475592b9379247c32da7ff5ad7 /library
parent30d310cc1f7056fa9941b9f9c415d60091ed8fec (diff)
parentb149d16d3a48672a7cfb99d19e075ff8eef4846f (diff)
downloadrust-58352c06497ac1cc8f7c49d30d6df967134efbaf.tar.gz
rust-58352c06497ac1cc8f7c49d30d6df967134efbaf.zip
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.
Diffstat (limited to 'library')
-rw-r--r--library/std/src/process.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/library/std/src/process.rs b/library/std/src/process.rs
index 47e28c27a83..ad29eeb6a0b 100644
--- a/library/std/src/process.rs
+++ b/library/std/src/process.rs
@@ -1594,7 +1594,7 @@ impl From<io::Stderr> for 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 @@ 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.