From 1d39aed701a44113cbde2729b64562332f15d0b2 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Wed, 13 Jan 2016 10:38:25 +1100 Subject: Add an impl for Box from &str. --- src/libstd/error.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/libstd') diff --git a/src/libstd/error.rs b/src/libstd/error.rs index e2a51752eb8..c44a4bfe0f1 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -135,6 +135,13 @@ impl<'a, 'b> From<&'b str> for Box { } } +#[stable(feature = "string_box_error", since = "1.7.0")] +impl<'a> From<&'a str> for Box { + fn from(err: &'a str) -> Box { + 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" } -- cgit 1.4.1-3-g733a5