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~~
This commit is contained in:
Matthias Krüger 2023-08-15 20:34:23 +02:00 committed by GitHub
commit 0587893f6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1530,10 +1530,19 @@ fn from(file: fs::File) -> Stdio {
// vs `_exit`. Naming of Unix system calls is not standardised across Unices, so terminology is a // 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 // matter of convention and tradition. For clarity we usually speak of `exit`, even when we might
// mean an underlying system call such as `_exit`. // 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")] #[stable(feature = "process", since = "1.0.0")]
pub struct ExitStatus(imp::ExitStatus); 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`. /// Allows extension traits within `std`.
#[unstable(feature = "sealed", issue = "none")] #[unstable(feature = "sealed", issue = "none")]
impl crate::sealed::Sealed for ExitStatus {} impl crate::sealed::Sealed for ExitStatus {}