about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorKevin Butler <haqkrs@gmail.com>2015-04-02 21:10:25 +0100
committerKevin Butler <haqkrs@gmail.com>2015-04-02 21:10:25 +0100
commit8b719eefc0a772986dc33d6d9193c2cfd04b82f7 (patch)
treed0a68612614a4cd7f67074ecb28cbe828c2e707d /src/libstd
parentedac3ce6fba1063b01ca0e83841c762909d4df5d (diff)
downloadrust-8b719eefc0a772986dc33d6d9193c2cfd04b82f7.tar.gz
rust-8b719eefc0a772986dc33d6d9193c2cfd04b82f7.zip
std: impl From<String> for Box<Error + Send>
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/error.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/libstd/error.rs b/src/libstd/error.rs
index 150ffcdd77a..c9babeb3230 100644
--- a/src/libstd/error.rs
+++ b/src/libstd/error.rs
@@ -88,8 +88,8 @@ impl<'a, E: Error + Send + 'a> From<E> for Box<Error + Send + 'a> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, 'b> From<&'b str> for Box<Error + Send + 'a> {
-    fn from(err: &'b str) -> Box<Error + Send + 'a> {
+impl From<String> for Box<Error + Send> {
+    fn from(err: String) -> Box<Error + Send> {
         #[derive(Debug)]
         struct StringError(String);
 
@@ -103,7 +103,14 @@ impl<'a, 'b> From<&'b str> for Box<Error + Send + 'a> {
             }
         }
 
-        Box::new(StringError(String::from_str(err)))
+        Box::new(StringError(err))
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<'a, 'b> From<&'b str> for Box<Error + Send + 'a> {
+    fn from(err: &'b str) -> Box<Error + Send + 'a> {
+        From::from(String::from_str(err))
     }
 }