Skip to content

Commit

Permalink
Implement Termination for Option<T: Termination>
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed May 31, 2019
1 parent 02f5786 commit 24c1b73
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/libstd/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1625,6 +1625,16 @@ impl<E: fmt::Debug> Termination for Result<(), E> {
}
}

#[unstable(feature = "termination_trait_lib", issue = "43301")]
impl<T: Termination> Termination for Option<T> {
fn report(self) -> i32 {
match self {
Some(v) => v.report(),
None => 1,
}
}
}

#[unstable(feature = "termination_trait_lib", issue = "43301")]
impl Termination for ! {
fn report(self) -> i32 { self }
Expand Down

0 comments on commit 24c1b73

Please sign in to comment.