Skip to content

Commit

Permalink
Rollup merge of #95452 - yaahc:termination-version-correction, r=ehuss
Browse files Browse the repository at this point in the history
fix since field version for termination stabilization

fixes incorrect version fields in stabilization of #93840

r? `@ehuss`
  • Loading branch information
Dylan-DPC committed Mar 30, 2022
2 parents 33730c8 + 09e7b0b commit abb02d4
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions library/std/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1705,25 +1705,25 @@ impl crate::error::Error for ExitStatusError {}
/// }
/// ```
#[derive(Clone, Copy, Debug)]
#[stable(feature = "process_exitcode", since = "1.60.0")]
#[stable(feature = "process_exitcode", since = "1.61.0")]
pub struct ExitCode(imp::ExitCode);

#[stable(feature = "process_exitcode", since = "1.60.0")]
#[stable(feature = "process_exitcode", since = "1.61.0")]
impl ExitCode {
/// The canonical `ExitCode` for successful termination on this platform.
///
/// Note that a `()`-returning `main` implicitly results in a successful
/// termination, so there's no need to return this from `main` unless
/// you're also returning other possible codes.
#[stable(feature = "process_exitcode", since = "1.60.0")]
#[stable(feature = "process_exitcode", since = "1.61.0")]
pub const SUCCESS: ExitCode = ExitCode(imp::ExitCode::SUCCESS);

/// The canonical `ExitCode` for unsuccessful termination on this platform.
///
/// If you're only returning this and `SUCCESS` from `main`, consider
/// instead returning `Err(_)` and `Ok(())` respectively, which will
/// return the same codes (but will also `eprintln!` the error).
#[stable(feature = "process_exitcode", since = "1.60.0")]
#[stable(feature = "process_exitcode", since = "1.61.0")]
pub const FAILURE: ExitCode = ExitCode(imp::ExitCode::FAILURE);
}

Expand All @@ -1747,7 +1747,7 @@ impl ExitCode {
}
}

#[stable(feature = "process_exitcode", since = "1.60.0")]
#[stable(feature = "process_exitcode", since = "1.61.0")]
impl From<u8> for ExitCode {
/// Construct an `ExitCode` from an arbitrary u8 value.
fn from(code: u8) -> Self {
Expand Down Expand Up @@ -2092,27 +2092,27 @@ pub fn id() -> u32 {
/// standard library's runtime for convenience. Other runtimes are not required
/// to provide similar functionality.
#[cfg_attr(not(test), lang = "termination")]
#[stable(feature = "termination_trait_lib", since = "1.60.0")]
#[stable(feature = "termination_trait_lib", since = "1.61.0")]
#[rustc_on_unimplemented(
message = "`main` has invalid return type `{Self}`",
label = "`main` can only return types that implement `{Termination}`"
)]
pub trait Termination {
/// Is called to get the representation of the value as status code.
/// This status code is returned to the operating system.
#[stable(feature = "termination_trait_lib", since = "1.60.0")]
#[stable(feature = "termination_trait_lib", since = "1.61.0")]
fn report(self) -> ExitCode;
}

#[stable(feature = "termination_trait_lib", since = "1.60.0")]
#[stable(feature = "termination_trait_lib", since = "1.61.0")]
impl Termination for () {
#[inline]
fn report(self) -> ExitCode {
ExitCode::SUCCESS.report()
}
}

#[stable(feature = "termination_trait_lib", since = "1.60.0")]
#[stable(feature = "termination_trait_lib", since = "1.61.0")]
impl<E: fmt::Debug> Termination for Result<(), E> {
fn report(self) -> ExitCode {
match self {
Expand All @@ -2122,14 +2122,14 @@ impl<E: fmt::Debug> Termination for Result<(), E> {
}
}

#[stable(feature = "termination_trait_lib", since = "1.60.0")]
#[stable(feature = "termination_trait_lib", since = "1.61.0")]
impl Termination for ! {
fn report(self) -> ExitCode {
self
}
}

#[stable(feature = "termination_trait_lib", since = "1.60.0")]
#[stable(feature = "termination_trait_lib", since = "1.61.0")]
impl<E: fmt::Debug> Termination for Result<!, E> {
fn report(self) -> ExitCode {
let Err(err) = self;
Expand All @@ -2138,15 +2138,15 @@ impl<E: fmt::Debug> Termination for Result<!, E> {
}
}

#[stable(feature = "termination_trait_lib", since = "1.60.0")]
#[stable(feature = "termination_trait_lib", since = "1.61.0")]
impl<E: fmt::Debug> Termination for Result<Infallible, E> {
fn report(self) -> ExitCode {
let Err(err) = self;
Err::<!, _>(err).report()
}
}

#[stable(feature = "termination_trait_lib", since = "1.60.0")]
#[stable(feature = "termination_trait_lib", since = "1.61.0")]
impl Termination for ExitCode {
#[inline]
fn report(self) -> ExitCode {
Expand Down

0 comments on commit abb02d4

Please sign in to comment.