diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 150ffcdd77a9f..c9babeb32301a 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -88,8 +88,8 @@ impl<'a, E: Error + Send + 'a> From for Box { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b> From<&'b str> for Box { - fn from(err: &'b str) -> Box { +impl From for Box { + fn from(err: String) -> Box { #[derive(Debug)] struct StringError(String); @@ -103,7 +103,14 @@ impl<'a, 'b> From<&'b str> for Box { } } - 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 { + fn from(err: &'b str) -> Box { + From::from(String::from_str(err)) } }