Remove feature gated enum variants#881
Conversation
|
Needs rebase because of #806, sorry |
9bedc84 to
f4d015e
Compare
|
No changes in force push, rebase only. |
There was a problem hiding this comment.
Regarding derives on dumb error types: while we should not underderive, we can overderive. I.e., if the upstream adds derives to the respective error types this will not be a breaking change for them, but it will break our code. Thus, I suggest to do all possible derives for dumb errors, namely Copy, Eq, PartialEq, Ord, PartialOrd, Hash, Debug (Default for errors is a bad practice, I assume).
apoelstra
left a comment
There was a problem hiding this comment.
ACK f4d015e46653a481d41ed06b025e5d090172b1cc
Though I am also a little confused why we're dropping derives in this PR.
|
Because of this comment: #874 (comment) |
I do not agree with that. Commented there |
|
Oh, I thought your comment was just in the general case. I'll put some more thought into digesting the whole thread of discussion again. Thanks for re-stating you position. |
Feature gating enum variants makes code that uses the library brittle while we do not have `non_exhaustive`, we should avoid doing so. Instead we can add a dummy type that is available when the feature is not turned on. Doing so enables the compiler to enforce that we do not create the error type that is feature gated when the feature is not enabled. Remove the feature gating around `bitcoinconsensus` error enum variants. Closes: rust-bitcoin#645
f4d015e to
6ad2902
Compare
|
Rebased on master and added all derives as suggested by @dr-orlovsky (+ Clone).
PR no longer does this. |
|
Unlike to others PRs having two ACKs, which I didn't merge since I'd liked to see @apoelstra comments, here his comments were clearly addressed and the PR is trivial, so will not take his time on re-reviewing the latest force-push. |
This is the updated version of #874 (which I closed, force pushed, and then was unable to re-open - my bad).
Feature gating enum variants makes code that uses the library brittle while we do not have
non_exhaustive, we should avoid doing so. Instead we can add a dummy type that is available when the feature is not turned on. Doing so enables the compiler to enforce that we do not create the error type that is feature gated when the feature is not enabled.Remove the feature gating around
bitcoinconsensuserror enum variants.Closes: #645