Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5692c94

Browse files
authoredAug 15, 2023
Rollup merge of rust-lang#114588 - ijackson:exit-status-default-2, r=m-ou-se
Improve docs for impl Default for ExitStatus This addresses a review comment in rust-lang#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 rust-lang#106425~~
2 parents c57393e + a741a5a commit 5692c94

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed
 

‎library/std/src/process.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -1530,10 +1530,19 @@ impl From<fs::File> for Stdio {
15301530
// vs `_exit`. Naming of Unix system calls is not standardised across Unices, so terminology is a
15311531
// matter of convention and tradition. For clarity we usually speak of `exit`, even when we might
15321532
// mean an underlying system call such as `_exit`.
1533-
#[derive(PartialEq, Eq, Clone, Copy, Debug, Default)]
1533+
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
15341534
#[stable(feature = "process", since = "1.0.0")]
15351535
pub struct ExitStatus(imp::ExitStatus);
15361536

1537+
/// The default value is one which indicates successful completion.
1538+
#[stable(feature = "process-exitcode-default", since = "CURRENT_RUSTC_VERSION")]
1539+
impl Default for ExitStatus {
1540+
fn default() -> Self {
1541+
// Ideally this would be done by ExitCode::default().into() but that is complicated.
1542+
ExitStatus::from_inner(imp::ExitStatus::default())
1543+
}
1544+
}
1545+
15371546
/// Allows extension traits within `std`.
15381547
#[unstable(feature = "sealed", issue = "none")]
15391548
impl crate::sealed::Sealed for ExitStatus {}

0 commit comments

Comments
 (0)
Please sign in to comment.