diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-04-04 10:53:22 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-04-04 10:53:22 +0530 |
| commit | d0c32834f412b78967d035c0ae739dfba8483936 (patch) | |
| tree | 4ca5ce364f004b8fa6afc3ab0152197f47df9649 /src | |
| parent | f207ecbe021e2a81fbff4ea1904b955a156aa340 (diff) | |
| parent | 8b719eefc0a772986dc33d6d9193c2cfd04b82f7 (diff) | |
| download | rust-d0c32834f412b78967d035c0ae739dfba8483936.tar.gz rust-d0c32834f412b78967d035c0ae739dfba8483936.zip | |
Rollup merge of #23979 - Ryman:error_from_string, r=alexcrichton
Diffstat (limited to 'src')
| -rw-r--r-- | src/libstd/error.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 150ffcdd77a..c9babeb3230 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -88,8 +88,8 @@ impl<'a, E: Error + Send + 'a> From<E> for Box<Error + Send + 'a> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b> From<&'b str> for Box<Error + Send + 'a> { - fn from(err: &'b str) -> Box<Error + Send + 'a> { +impl From<String> for Box<Error + Send> { + fn from(err: String) -> Box<Error + Send> { #[derive(Debug)] struct StringError(String); @@ -103,7 +103,14 @@ impl<'a, 'b> From<&'b str> for Box<Error + Send + 'a> { } } - 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<Error + Send + 'a> { + fn from(err: &'b str) -> Box<Error + Send + 'a> { + From::from(String::from_str(err)) } } |
