-
Notifications
You must be signed in to change notification settings - Fork 216
digest: add newtype macros #1799
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
base: master
Are you sure you want to change the base?
Conversation
I'm a bit worried we have to list all the traits in the invocation of the macro and that consumers will drift inconsistent over time. We can't centrally add/implement a trait (like we could with the CoreWrapper or my set of macros (#1775)). |
What do you mean by "drift"? The list of traits should not change across semver-compatible releases of To make the list of traits less annoying, I plan to add several templates for the most common cases. In other words, instead of: newtype!(
/// SHA-256 hash
Sha256(..);
delegate:
Debug AlgorithmName
Clone Default Reset
BlockSizeUser OutputSizeUser HashMarker
Update FixedOutput FixedOutputReset
); We will write: newtype!(
/// SHA-256 hash
Sha256(..);
delegate_template: FixedOutputHash
); |
We've added traits in the previous cycle: #1098 (released in digest 0.10.4) We may continue to do so in the next one. Having to list the traits means we have to each consumers and bump the list everywhere and release them. |
Together with #1799 users would need to implement `AssociatedOid` manually for created newtypes. Also replaces `feature = "const-oid"` with `feature = "oid"`.
@newpavlov can we get this wrapped up? |
@tarcieri |
How do we deal with https://github.com/RustCrypto/MACs/blob/cf736659b45d82dc3d95e6240030a3326381ec96/hmac/src/optim.rs#L27 |
About MACs, I believe you mentioned you wanted to introduce a similar macro. Could this be done in a followup? Just so we can get back to a usable master. |
I do not understand why existence of this PR makes master "unusable". |
[package]
name = "foobar"
version = "0.1.0"
edition = "2024"
[dependencies]
p256 = "=0.14.0-pre.2"
[patch.crates-io]
digest = { git = "https://github.com/RustCrypto/traits.git" }
elliptic-curve = { git = "https://github.com/RustCrypto/traits.git" }
signature = { git = "https://github.com/RustCrypto/traits.git" }
ecdsa = { git = "https://github.com/RustCrypto/signatures.git" }
rfc6979 = { git = "https://github.com/RustCrypto/signatures.git" }
p256 = { git = "https://github.com/RustCrypto/elliptic-curves.git" }
sha2 = { git = "https://github.com/RustCrypto/hashes.git" } Unless I miss something, #1810 merged too early and should have been included here (and this PR should fix master and I'd love to have it land as early as possible) Error output
|
Ah, I see. We indeed shouldn't have merged the PR without this one. One alternative workaround could be to use in your patch sections hash of the commit right before the merge. |
yeah but then I don't get the other fixes I'm interested in from master. Anyway, for now I just have a branch that merges both this and master, and I get away with it, but it's not ideal. |
(the alternative is to revisit #1784 without it I can't pick particular version of a single crate from |
We also could revert #1810 and move its changes into this PR. UPD: Unfortunately, it can not be reverted automatically, so we would've to do it manually. |
It would be good to either do that or get this merged ASAP |
I will try to finalize the remaining parts during this weekend. If I will not be able to do it for some reason, we can revert #1810. |
Closes #1069
TODO: