Skip to content

Thread safety error while compiling jmt crate #119

Open
@mw2000

Description

@mw2000

Running into the following error when I try to compile my program which imports the jmt = 0.10.0 crate. How can I get around this? I implement a wrapper KeccakHasher around alloy_primitives::Keccak for which I implement the SimpleHasher trait.

my_program:dev: error[E0277]: `T` cannot be sent between threads safely
my_program:dev:    --> /Users/mw2000/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jmt-0.10.0/src/lib.rs:327:34
my_program:dev:     |
my_program:dev: 327 | impl<T: Digest> SimpleHasher for T
my_program:dev:     |                                  ^ `T` cannot be sent between threads safely
my_program:dev:     |
my_program:dev: note: required by a bound in `SimpleHasher`
my_program:dev:    --> /Users/mw2000/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jmt-0.10.0/src/lib.rs:312:40
my_program:dev:     |
my_program:dev: 312 | pub trait SimpleHasher: Sized + Sync + Send {
my_program:dev:     |                                        ^^^^ required by this bound in `SimpleHasher`
my_program:dev: help: consider further restricting this bound
my_program:dev:     |
my_program:dev: 327 | impl<T: Digest + core::marker::Send> SimpleHasher for T
my_program:dev:     |                ++++++++++++++++++++
my_program:dev: 
my_program:dev: error[E0277]: `T` cannot be shared between threads safely
my_program:dev:    --> /Users/mw2000/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jmt-0.10.0/src/lib.rs:327:34
my_program:dev:     |
my_program:dev: 327 | impl<T: Digest> SimpleHasher for T
my_program:dev:     |                                  ^ `T` cannot be shared between threads safely
my_program:dev:     |
my_program:dev: note: required by a bound in `SimpleHasher`
my_program:dev:    --> /Users/mw2000/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jmt-0.10.0/src/lib.rs:312:33
my_program:dev:     |
my_program:dev: 312 | pub trait SimpleHasher: Sized + Sync + Send {
my_program:dev:     |                                 ^^^^ required by this bound in `SimpleHasher`
my_program:dev: help: consider further restricting this bound
my_program:dev:     |
my_program:dev: 327 | impl<T: Digest + core::marker::Sync> SimpleHasher for T

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions