Skip to content

Commit

Permalink
Rollup merge of rust-lang#114588 - ijackson:exit-status-default-2, r=…
Browse files Browse the repository at this point in the history
…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~~
  • Loading branch information
GuillaumeGomez authored Aug 15, 2023
2 parents c57393e + a741a5a commit 5692c94
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion library/std/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down

0 comments on commit 5692c94

Please sign in to comment.