From 49e27f1c5f2415b01101f3c1201ebe9f37b8aaa3 Mon Sep 17 00:00:00 2001 From: Dirk Gadsden Date: Fri, 22 Jan 2016 13:38:28 -0500 Subject: Implement error::Error and fmt::Display for string::ParseError Fixes #31106. --- 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 c44a4bfe0f1..59dc0ea8649 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -182,6 +182,13 @@ impl Error for string::FromUtf16Error { } } +#[stable(feature = "str_parse_error2", since = "1.8.0")] +impl Error for string::ParseError { + fn description(&self) -> &str { + "parse error" + } +} + // copied from any.rs impl Error + 'static { /// Returns true if the boxed type is the same as `T` -- cgit 1.4.1-3-g733a5 From 365deeb19a2cff74e3d215622b1ab411581b99e9 Mon Sep 17 00:00:00 2001 From: Dirk Gadsden Date: Fri, 22 Jan 2016 14:34:39 -0500 Subject: Simplify return for error::Error impl for string::ParseError --- src/libstd/error.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 59dc0ea8649..ee367193e45 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -185,7 +185,7 @@ impl Error for string::FromUtf16Error { #[stable(feature = "str_parse_error2", since = "1.8.0")] impl Error for string::ParseError { fn description(&self) -> &str { - "parse error" + match *self {} } } -- cgit 1.4.1-3-g733a5