Skip to content

Commit c44455a

Browse files
authored
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.
2 parents 73ec27d + 2433d37 commit c44455a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

library/std/src/process.rs

+9
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ mod tests;
106106

107107
use crate::io::prelude::*;
108108

109+
use crate::convert::Infallible;
109110
use crate::ffi::OsStr;
110111
use crate::fmt;
111112
use crate::fs;
@@ -2065,6 +2066,14 @@ impl<E: fmt::Debug> Termination for Result<!, E> {
20652066
}
20662067
}
20672068

2069+
#[unstable(feature = "termination_trait_lib", issue = "43301")]
2070+
impl<E: fmt::Debug> Termination for Result<Infallible, E> {
2071+
fn report(self) -> i32 {
2072+
let Err(err) = self;
2073+
Err::<!, _>(err).report()
2074+
}
2075+
}
2076+
20682077
#[unstable(feature = "termination_trait_lib", issue = "43301")]
20692078
impl Termination for ExitCode {
20702079
#[inline]

0 commit comments

Comments
 (0)