Skip to content

Commit

Permalink
fix(codectable): set correct dependencies
Browse files Browse the repository at this point in the history
Some hashers depend on the `Digest` trait, which needs to be imported
and hency relied upon correctly.

Without this change you might get an error like this:

    error[E0599]: no method named `update` found for struct `CoreWrapper` in the current scope
       --> /home/vmx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/multihash-codetable-0.1.1/src/hasher_impl.rs:168:28
        |
    168 |                 self.state.update(input)
        |                            ^^^^^^ method not found in `CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, UInt<UInt<..., ...>, ...>, ...>>`
    ...
    208 |     derive_rustcrypto_hasher!(::sha2::Sha256, Sha2_256, 32);
        |     ------------------------------------------------------- in this macro invocation
        |
        = note: the full type name has been written to '/home/vmx/src/pl/codec-fixtures/rust/target/debug/deps/multihash_codetable-9512ee5a3ec79ea2.long-type-14493071964420482871.txt'
        = help: items from traits can only be used if the trait is in scope
        = note: this error originates in the macro `derive_rustcrypto_hasher` (in Nightly builds, run with -Z macro-backtrace for more info)
    help: the following traits are implemented but not in scope; perhaps add a `use` for one of them:
        |
    208 +     use multihash_derive::Hasher;
        |
    208 +     use sha2::Digest;
        |
    208 +     use sha2::digest::DynDigest;
        |
    208 +     use sha2::digest::Update;
  • Loading branch information
vmx committed Feb 23, 2024
1 parent d69f012 commit 2fe932f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion codetable/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ edition = "2021"
[features]
default = ["std"]
std = ["blake2b_simd?/std", "blake2s_simd?/std", "blake3?/std", "digest?/std", "sha1?/std", "sha2?/std", "sha3?/std", "strobe-rs?/std", "ripemd?/std", "multihash-derive/std", "core2/std"]
sha1 = ["dep:sha1"]
ripemd = ["dep:ripemd", "dep:digest"]
sha1 = ["dep:sha1", "dep:digest"]
sha2 = ["dep:sha2", "dep:digest"]
sha3 = ["dep:sha3", "dep:digest"]
strobe = ["dep:strobe-rs"]
blake2b = ["dep:blake2b_simd"]
blake2s = ["dep:blake2s_simd"]
Expand Down

0 comments on commit 2fe932f

Please sign in to comment.