about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-08-15 20:34:23 +0200
committerGitHub <noreply@github.com>2023-08-15 20:34:23 +0200
commit0587893f6d84bef673c3ec8c5d633b0568428f10 (patch)
tree62118676743b4c10c6dbaf55403f7c7f53d6b0f9 /library/std/src
parentc57393e4f8b88444fbf0985a81a2d662862f2733 (diff)
parenta741a5ad16bd3f136b94b31dbff9d1c8728e2064 (diff)
Rollup merge of #114588 - ijackson:exit-status-default-2, r=m-ou-se
Improve docs for impl Default for ExitStatus

This addresses a review comment in #106425 (which is on the way to being merged I think).

Some of the other followup work is more complicated so I'm going to do individual MRs.

~~Note this branch is on top of #106425~~
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/process.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/library/std/src/process.rs b/library/std/src/process.rs
index f25ad2ece71..f54d5934175 100644
--- a/library/std/src/process.rs
+++ b/library/std/src/process.rs
@@ -1530,10 +1530,19 @@ impl From<fs::File> for Stdio {
 // vs `_exit`.  Naming of Unix system calls is not standardised across Unices, so terminology is a
 // matter of convention and tradition.  For clarity we usually speak of `exit`, even when we might
 // mean an underlying system call such as `_exit`.
-#[derive(PartialEq, Eq, Clone, Copy, Debug, Default)]
+#[derive(PartialEq, Eq, Clone, Copy, Debug)]
 #[stable(feature = "process", since = "1.0.0")]
 pub struct ExitStatus(imp::ExitStatus);
 
+/// The default value is one which indicates successful completion.
+#[stable(feature = "process-exitcode-default", since = "CURRENT_RUSTC_VERSION")]
+impl Default for ExitStatus {
+    fn default() -> Self {
+        // Ideally this would be done by ExitCode::default().into() but that is complicated.
+        ExitStatus::from_inner(imp::ExitStatus::default())
+    }
+}
+
 /// Allows extension traits within `std`.
 #[unstable(feature = "sealed", issue = "none")]
 impl crate::sealed::Sealed for ExitStatus {}