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-18 17:30:29 +0000
committerbors <bors@rust-lang.org>2017-09-18 17:30:29 +0000
commit0701b37d97d08da7074ece7a7dcb4449498f4bfa (patch)
tree796f1ce756d1bce72a8462d6d74c28f11263895c /src/libstd/error.rs
parent3a7b960731fd1cf86f1879b1a0d44196a0917c53 (diff)
parent929215db7c598722410709022e69f71702f02e0b (diff)
downloadrust-0701b37d97d08da7074ece7a7dcb4449498f4bfa.tar.gz
rust-0701b37d97d08da7074ece7a7dcb4449498f4bfa.zip
Auto merge of #44678 - alexcrichton:rollup, r=alexcrichton
Rollup of 11 pull requests

- Successful merges: #44364, #44466, #44537, #44548, #44640, #44651, #44657, #44661, #44668, #44671, #44675
- Failed merges:
Diffstat (limited to 'src/libstd/error.rs')
-rw-r--r--src/libstd/error.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libstd/error.rs b/src/libstd/error.rs
index 401552a6ec4..6d64ea0d503 100644
--- a/src/libstd/error.rs
+++ b/src/libstd/error.rs
@@ -53,6 +53,7 @@
 
 use alloc::allocator;
 use any::TypeId;
+use borrow::Cow;
 use cell;
 use char;
 use fmt::{self, Debug, Display};
@@ -217,6 +218,20 @@ impl<'a> From<&'a str> for Box<Error> {
     }
 }
 
+#[stable(feature = "cow_box_error", since = "1.22.0")]
+impl<'a, 'b> From<Cow<'b, str>> for Box<Error + Send + Sync + 'a> {
+    fn from(err: Cow<'b, str>) -> Box<Error + Send + Sync + 'a> {
+        From::from(String::from(err))
+    }
+}
+
+#[stable(feature = "cow_box_error", since = "1.22.0")]
+impl<'a> From<Cow<'a, str>> for Box<Error> {
+    fn from(err: Cow<'a, str>) -> Box<Error> {
+        From::from(String::from(err))
+    }
+}
+
 #[unstable(feature = "never_type_impls", issue = "35121")]
 impl Error for ! {
     fn description(&self) -> &str { *self }