Auto merge of #31124 - dirk:dirk/display-and-error-impls-for-string-parse-error, r=alexcrichton

Fixes #31106.

- [ ] I wasn't sure of the correct `#[stable(...)]` definition to use here. Happy to fix it if it's incorrect.
- [ ] `ParseError` is sort of an ephemeral non-error, but do let me know if the implementation of `error::Error` for it should return something more descriptive than "parse error".
This commit is contained in:
bors 2016-01-23 04:04:26 +00:00
commit 93d03edcb8
2 changed files with 14 additions and 0 deletions

View File

@ -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 {

View File

@ -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 {
match *self {}
}
}
// copied from any.rs
impl Error + 'static {
/// Returns true if the boxed type is the same as `T`