E0284 type annotations required: cannot resolve `<_ as sha2::Digest>::OutputSize == _`

Hi,

I updated the dependency of sha2 from 0.7 to 0.8 and the code does not compile anymore.
I fiddled with the sha2 errors and fixed them. Then I upgraded sha3 from 0.7 to 0.8 as well and I seem to be unable to get it right.

    Checking libindy v1.9.0 (/home/ignisvulpis/development/hyperledger/indy-sdk/libindy)
error[E0284]: type annotations required: cannot resolve `<_ as sha2::Digest>::OutputSize == _`
   --> src/services/pool/state_proof/node.rs:150:9
    |
150 |         sha3::Digest::digest(encoded.to_vec().as_slice()) as NodeHash
    |         ^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0284`.
error: Could not compile `libindy`.

To learn more, run the command again with --verbose.
ignisvulpis@namenlos:~/development/hyperledger/indy-sdk/libindy$ 

The offending code is here: https://github.com/AxelNennker/indy-sdk/blob/sha2_0.8/libindy/src/services/pool/state_proof/node.rs#L150

Why is the error message about sha2 at all. Everything here should be sha3 anyway.

Thanks,
Axel

What other dependencies do you have?

Many. Please see here.

I think there is a clash between generic_array in Digest, sha2 and sha3, or something.
I already tried a lot. This version moves the hash stuff for node into node.rs trying to get away from other use of e.g. Digest::digest or sha2 or whatnot and keep it reduced to sha3 stuff in node.rs

Inside node.rs at the top is


use rlp::{DecoderError as RlpDecoderError, Prototype as RlpPrototype,
          RlpStream,
          UntrustedRlp,
};

use errors::prelude::*;```

‘solved’ it: sha3::Digest::digest() is a convenience function that creates the hasher, calls input and gets the result.
So I replaced sha3::Digest::digest() with this

        use sha3::Digest;
        let encoded = rlp_encode(self);
        let mut hasher = sha3::Sha3_256::default();
        hasher.input(encoded.to_vec().as_slice());
        hasher.fixed_result()

I still would be interested whether it is possible to tell Rust what the OutputSize needed for sha3::Digest::digest() is and what the syntax for that is.

Isn’t it obvious for rustc that for sha3::Digest::digest something sha3::whatever::OutputSize is needed?