Skip to content

Commit bcae782

Browse files
committed
Auto merge of #23979 - Ryman:error_from_string, r=alexcrichton
2 parents f207ecb + 8b719ee commit bcae782

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/libstd/error.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ impl<'a, E: Error + Send + 'a> From<E> for Box<Error + Send + 'a> {
8888
}
8989

9090
#[stable(feature = "rust1", since = "1.0.0")]
91-
impl<'a, 'b> From<&'b str> for Box<Error + Send + 'a> {
92-
fn from(err: &'b str) -> Box<Error + Send + 'a> {
91+
impl From<String> for Box<Error + Send> {
92+
fn from(err: String) -> Box<Error + Send> {
9393
#[derive(Debug)]
9494
struct StringError(String);
9595

@@ -103,7 +103,14 @@ impl<'a, 'b> From<&'b str> for Box<Error + Send + 'a> {
103103
}
104104
}
105105

106-
Box::new(StringError(String::from_str(err)))
106+
Box::new(StringError(err))
107+
}
108+
}
109+
110+
#[stable(feature = "rust1", since = "1.0.0")]
111+
impl<'a, 'b> From<&'b str> for Box<Error + Send + 'a> {
112+
fn from(err: &'b str) -> Box<Error + Send + 'a> {
113+
From::from(String::from_str(err))
107114
}
108115
}
109116

0 commit comments

Comments
 (0)