about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDirk Gadsden <dirk@esherido.com>2016-01-22 13:38:28 -0500
committerDirk Gadsden <dirk@esherido.com>2016-01-22 14:01:29 -0500
commit49e27f1c5f2415b01101f3c1201ebe9f37b8aaa3 (patch)
tree47d79e820d52ba8d4bb4fad217d758422e1c0980
parente1cb0a3508423383250662adb65137be4b86066b (diff)
downloadrust-49e27f1c5f2415b01101f3c1201ebe9f37b8aaa3.tar.gz
rust-49e27f1c5f2415b01101f3c1201ebe9f37b8aaa3.zip
Implement error::Error and fmt::Display for string::ParseError
Fixes #31106.
-rw-r--r--src/libcollections/string.rs7
-rw-r--r--src/libstd/error.rs7
2 files changed, 14 insertions, 0 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index ad9c770a5a5..d9cbc4488fc 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -1692,6 +1692,13 @@ impl fmt::Debug for ParseError {
     }
 }
 
+#[stable(feature = "str_parse_error2", since = "1.8.0")]
+impl fmt::Display for ParseError {
+    fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
+        match *self {}
+    }
+}
+
 #[stable(feature = "str_parse_error", since = "1.5.0")]
 impl PartialEq for ParseError {
     fn eq(&self, _: &ParseError) -> bool {
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`