Rollup merge of #88601 - ibraheemdev:termination-result-infallible, r=yaahc
Implement `Termination` for `Result<Infallible, E>` As noted in #43301, `Result<!, E>` is not usable on stable.
This commit is contained in:
commit
c44455af1d
@ -106,6 +106,7 @@ mod tests;
|
||||
|
||||
use crate::io::prelude::*;
|
||||
|
||||
use crate::convert::Infallible;
|
||||
use crate::ffi::OsStr;
|
||||
use crate::fmt;
|
||||
use crate::fs;
|
||||
@ -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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user