Skip to content

Commit 93d03ed

Browse files
committed
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".
2 parents d63b8e5 + 365deeb commit 93d03ed

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/libcollections/string.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,6 +1692,13 @@ impl fmt::Debug for ParseError {
16921692
}
16931693
}
16941694

1695+
#[stable(feature = "str_parse_error2", since = "1.8.0")]
1696+
impl fmt::Display for ParseError {
1697+
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
1698+
match *self {}
1699+
}
1700+
}
1701+
16951702
#[stable(feature = "str_parse_error", since = "1.5.0")]
16961703
impl PartialEq for ParseError {
16971704
fn eq(&self, _: &ParseError) -> bool {

src/libstd/error.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,13 @@ impl Error for string::FromUtf16Error {
182182
}
183183
}
184184

185+
#[stable(feature = "str_parse_error2", since = "1.8.0")]
186+
impl Error for string::ParseError {
187+
fn description(&self) -> &str {
188+
match *self {}
189+
}
190+
}
191+
185192
// copied from any.rs
186193
impl Error + 'static {
187194
/// Returns true if the boxed type is the same as `T`

0 commit comments

Comments
 (0)