about summary refs log tree commit diff
path: root/src/libstd/error.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-09-29 22:35:23 +0000
committerbors <bors@rust-lang.org>2017-09-29 22:35:23 +0000
commitb7041bfab3a83702a8026fb7a18d8ea7d54cc648 (patch)
tree7f22fe35983186a4d48ea90d70c6461d11ef1269 /src/libstd/error.rs
parent6f87d20a7cce70b8cc59a1adf3037d14bc83f237 (diff)
parent27d95d3645761252caf42c77fc53b76b4278520a (diff)
downloadrust-b7041bfab3a83702a8026fb7a18d8ea7d54cc648.tar.gz
rust-b7041bfab3a83702a8026fb7a18d8ea7d54cc648.zip
Auto merge of #44174 - jimmycuadra:try-from-infallible, r=sfackler
Add blanket TryFrom impl when From is implemented.

Adds `impl<T, U> TryFrom<T> for U where U: From<T>`.

Removes `impl<'a, T> TryFrom<&'a str> for T where T: FromStr` (originally added in #40281) due to overlapping impls caused by the new blanket impl. This removal is to be discussed further on the tracking issue for TryFrom.

Refs #33417.

/cc @sfackler, @scottmcm (thank you for the help!), and @aturon
Diffstat (limited to 'src/libstd/error.rs')
-rw-r--r--src/libstd/error.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libstd/error.rs b/src/libstd/error.rs
index 6d64ea0d503..166439692d4 100644
--- a/src/libstd/error.rs
+++ b/src/libstd/error.rs
@@ -56,6 +56,7 @@ use any::TypeId;
 use borrow::Cow;
 use cell;
 use char;
+use convert;
 use fmt::{self, Debug, Display};
 use mem::transmute;
 use num;
@@ -362,6 +363,13 @@ impl Error for char::ParseCharError {
     }
 }
 
+#[unstable(feature = "try_from", issue = "33417")]
+impl Error for convert::Infallible {
+    fn description(&self) -> &str {
+        match *self {
+        }
+    }
+}
 
 // copied from any.rs
 impl Error + 'static {