diff options
| author | bors <bors@rust-lang.org> | 2018-02-18 03:12:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-02-18 03:12:14 +0000 |
| commit | e8f03b9438d6516fd7067cfda2f09c925d6d92f2 (patch) | |
| tree | 8cbee3557fe3f889b4b3eaed1761b1ba348a7360 /src/libstd | |
| parent | 5313e8728f028cb7914f3c9f02804158a5732b52 (diff) | |
| parent | 7948afdc53cabf9330662ec894bf668839880a3c (diff) | |
| download | rust-e8f03b9438d6516fd7067cfda2f09c925d6d92f2.tar.gz rust-e8f03b9438d6516fd7067cfda2f09c925d6d92f2.zip | |
Auto merge of #47544 - U007D:master, r=nikomatsakis
Relax termination_trait's error bound As per [this conversation](https://github.com/withoutboats/failure/issues/130#issuecomment-358572413) with @withoutboats and @bkchr
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/termination.rs | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/libstd/termination.rs b/src/libstd/termination.rs index 93a913bb540..dc7fa53aab6 100644 --- a/src/libstd/termination.rs +++ b/src/libstd/termination.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use error::Error; +use fmt::Debug; #[cfg(target_arch = "wasm32")] mod exit { pub const SUCCESS: i32 = 0; @@ -45,12 +45,12 @@ impl Termination for () { } #[unstable(feature = "termination_trait", issue = "43301")] -impl<T: Termination, E: Error> Termination for Result<T, E> { +impl<T: Termination, E: Debug> Termination for Result<T, E> { fn report(self) -> i32 { match self { Ok(val) => val.report(), Err(err) => { - print_error(err); + eprintln!("Error: {:?}", err); exit::FAILURE } } @@ -58,15 +58,6 @@ impl<T: Termination, E: Error> Termination for Result<T, E> { } #[unstable(feature = "termination_trait", issue = "43301")] -fn print_error<E: Error>(err: E) { - eprintln!("Error: {}", err.description()); - - if let Some(ref err) = err.cause() { - eprintln!("Caused by: {}", err.description()); - } -} - -#[unstable(feature = "termination_trait", issue = "43301")] impl Termination for ! { fn report(self) -> i32 { unreachable!(); } } |
