-
Notifications
You must be signed in to change notification settings - Fork 831
Deprecate Error::description #419
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
Conversation
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.
utACK. Good, I've always hated this API.
Will need to figure out what we're going to do when the compiler folks actually remove it though...
@apoelstra I don't think it will ever get removed, as per Rust's standard library backward compatibility guarantees. AFAIU, even editions can't break stdlib backward compat. |
Nit: Did you mean std::error::Error::description? |
Yeah, it will probably only be removed on Rust 2.X. Pretty sure they only ever removed a function from stdlib when it had a clear vulnerability and practically no-one has used it. You can still do |
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.
One small mistake in a display. Otherwise concept ACK.
src/network/mod.rs
Outdated
@@ -47,7 +47,8 @@ impl fmt::Display for Error { | |||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |||
match *self { | |||
Error::Io(ref e) => fmt::Display::fmt(e, f), | |||
Error::SocketMutexPoisoned | Error::SocketNotConnectedToPeer => f.write_str(error::Error::description(self)), | |||
Error::SocketMutexPoisoned => f.write_str("socket mutex was poisoned"), | |||
Error::SocketNotConnectedToPeer => f.write_str("socket mutex was poisoned"), |
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.
this message doesn't seem right
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.
You're right!
Thanks for catching this, I re-reviewed my PR to make sure I didn't miss anything else
173d726
to
654232a
Compare
Codecov Report
@@ Coverage Diff @@
## master #419 +/- ##
==========================================
+ Coverage 85.74% 87.19% +1.45%
==========================================
Files 40 40
Lines 7483 8627 +1144
==========================================
+ Hits 6416 7522 +1106
- Misses 1067 1105 +38
Continue to review full report at Codecov.
|
@elichai FYI it's UB only if you take reference to a field, which requires |
You sure about that? |
Ah, good point, so it's not yet, but at least one gets a warning. |
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.
LGTM
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.
LGTM let's get this in, the warnings annoy me so much!
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.
utACK, great stuff
Now that 1.42.0 is out
std::error::Error::description
is officially deprecated.sadly we can't stop using it because of our MSRV, but at least we lay the ground and encourage our users to stop using it too.