Add an impl for Box<Error> from &str.

This commit is contained in:
Michael Sproul
2016-01-13 10:38:25 +11:00
parent 9520354115
commit c1e527f11d
2 changed files with 9 additions and 0 deletions

View File

@@ -135,6 +135,13 @@ impl<'a, 'b> From<&'b str> for Box<Error + Send + Sync + 'a> {
}
}
#[stable(feature = "string_box_error", since = "1.7.0")]
impl<'a> From<&'a str> for Box<Error> {
fn from(err: &'a str) -> Box<Error> {
From::from(String::from(err))
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl Error for str::ParseBoolError {
fn description(&self) -> &str { "failed to parse bool" }