-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Implement error::Error and fmt::Display for string::ParseError #31124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement error::Error and fmt::Display for string::ParseError #31124
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @gankro (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
d5b4c2a
to
992a7d3
Compare
992a7d3
to
49e27f1
Compare
#[stable(feature = "str_parse_error2", since = "1.8.0")] | ||
impl Error for string::ParseError { | ||
fn description(&self) -> &str { | ||
"parse error" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah here you can probably do the same match *self {}
trick to avoid the need to return anything here at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexcrichton: Done in dirk@365deeb!
Looks good to me, thanks @dirk! The stability attributes are fine here (impls are insta-stable) and we picking any old name for the feature is fine |
@alexcrichton: Thanks, glad to help out! 😄 |
…arse-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".
Fixes #31106.
Couple of questions:
#[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 oferror::Error
for it should return something more descriptive than "parse error".