diff options
| author | Michael Sproul <micsproul@gmail.com> | 2016-01-13 10:38:25 +1100 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2016-01-19 19:00:49 +0000 |
| commit | 1d39aed701a44113cbde2729b64562332f15d0b2 (patch) | |
| tree | bdd1b8bf93c355fddd197127d05970644b1faba9 /src/libstd | |
| parent | 89002904233f4bd15e4b8d272e1d40987f43bada (diff) | |
| download | rust-1d39aed701a44113cbde2729b64562332f15d0b2.tar.gz rust-1d39aed701a44113cbde2729b64562332f15d0b2.zip | |
Add an impl for Box<Error> from &str.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/error.rs | 7 |
1 files changed, 7 insertions, 0 deletions
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<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" } |
