Skip to content

Commit

Permalink
Rollup merge of #88601 - ibraheemdev:termination-result-infallible, r…
Browse files Browse the repository at this point in the history
…=yaahc

Implement `Termination` for `Result<Infallible, E>`

As noted in #43301, `Result<!, E>` is not usable on stable.
  • Loading branch information
JohnTitor authored Nov 16, 2021
2 parents 73ec27d + 2433d37 commit c44455a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions library/std/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ mod tests;

use crate::io::prelude::*;

use crate::convert::Infallible;
use crate::ffi::OsStr;
use crate::fmt;
use crate::fs;
Expand Down Expand Up @@ -2065,6 +2066,14 @@ impl<E: fmt::Debug> Termination for Result<!, E> {
}
}

#[unstable(feature = "termination_trait_lib", issue = "43301")]
impl<E: fmt::Debug> Termination for Result<Infallible, E> {
fn report(self) -> i32 {
let Err(err) = self;
Err::<!, _>(err).report()
}
}

#[unstable(feature = "termination_trait_lib", issue = "43301")]
impl Termination for ExitCode {
#[inline]
Expand Down

0 comments on commit c44455a

Please sign in to comment.