ZenGo-X / curv

Rust language general purpose elliptic curve cryptography.
MIT License
265 stars 111 forks source link

Fix compiler error for wasm32-unknown-unknown #183

Closed tmpfs closed 1 year ago

tmpfs commented 1 year ago

When compiling curv-kzen on a recent nightly channel with the num-bigint feature I hit this error:

error[E0308]: mismatched types
   --> /Users/muji/.cargo/registry/src/index.crates.io-6f17d22bba15001f/curv-kzen-0.10.0/src/arithmetic/big_native/primes.rs:506:35
    |
506 |         let bytes = bits.div_ceil(&8);
    |                          -------- ^^ expected `u64`, found `&{integer}`
    |                          |
    |                          arguments to this method are incorrect
    |
note: method defined here
   --> /rustc/ca62d2c445628587660ae48013f460b08b1f5552/library/core/src/num/mod.rs:1166:5
    = note: this error originates in the macro `uint_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider removing the borrow
    |
506 -         let bytes = bits.div_ceil(&8);
506 +         let bytes = bits.div_ceil(8);
    |

For more information about this error, try `rustc --explain E0308`.
error: could not compile `curv-kzen` (lib) due to previous error

By removing the reference the compiler error is fixed. I am using patch.crates-io as a workaround for now but would be great if you could merge this tiny fix please.

Thanks 🙏

tmpfs commented 1 year ago

This is a not a problem on the stable channel so we migrated to stable to fix this.