8000 Deprecate Error::description by elichai · Pull Request #419 · rust-bitcoin/rust-bitcoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 1 commit into from
May 23, 2020

Conversation

elichai
Copy link
Member
@elichai elichai commented Mar 29, 2020

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.

apoelstra
apoelstra previously approved these changes Apr 4, 2020
Copy link
Member
@apoelstra apoelstra left a 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...

@dpc
Copy link
Contributor
dpc commented Apr 5, 2020

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

@dpc
Copy link
Contributor
dpc commented Apr 5, 2020

Now that 1.42.0 is out std::error::Error is officially deprecated.

Nit: Did you mean std::error::Error::description?

@elichai
Copy link
Member Author
elichai commented Apr 5, 2020

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 #[repr(packed)] even though it's UB 99% of the time just because it was there and people are using it.

Copy link
Collaborator
@stevenroose stevenroose left a 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.

@@ -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"),
Copy link
Collaborator

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

Copy link
Member Author

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

@codecov-io
Copy link

Codecov Report

Merging #419 into master will increase coverage by 1.45%.
The diff coverage is 12.90%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
src/blockdata/script.rs 78.73% <0.00%> (+0.14%) ⬆️
src/blockdata/transaction.rs 94.75% <ø> (+0.75%) ⬆️
src/consensus/encode.rs 89.24% <ø> (ø)
src/network/mod.rs 0.00% <0.00%> (ø)
src/util/address.rs 86.28% <0.00%> (+0.87%) ⬆️
src/util/base58.rs 88.57% <0.00%> (+4.78%) ⬆️
src/util/bip158.rs 94.29% <ø> (+1.20%) ⬆️
src/util/bip32.rs 91.19% <ø> (+4.05%) ⬆️
src/util/contracthash.rs 81.77% <0.00%> (+3.27%) ⬆️
src/util/key.rs 72.77% <ø> (ø)
... and 14 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a148e06...654232a. Read the comment docs.

@Kixunil
Copy link
Collaborator
Kixunil commented Apr 13, 2020

@elichai FYI it's UB only if you take reference to a field, which requires unsafe ;)

@elichai
Copy link
Member Author
elichai commented Apr 13, 2020

@elichai FYI it's UB only if you take reference to a field, which requires unsafe ;)

You sure about that?
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=20b38411852321db1772ef8559aca709

@Kixunil
Copy link
Collaborator
Kixunil commented Apr 13, 2020

Ah, good point, so it's not yet, but at least one gets a warning.

Copy link
Collaborator
@stevenroose stevenroose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator
@stevenroose stevenroose left a 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!

Copy link
Member
@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK, great stuff

@apoelstra apoelstra merged commit 7efde3a into rust-bitcoin:master May 23, 2020
@elichai elichai deleted the 2020-03-description branch May 23, 2020 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0