paritytech / primitives

Other
33 stars 23 forks source link

Fix `ethbloom tests` by switching to `hex_literal crate` instead of `rustc-hex` #52

Closed niklasad1 closed 6 years ago

niklasad1 commented 6 years ago

This happens when using rustc-hex 2.0:

   Compiling ethbloom v0.5.1 (file:///home/niklasad1/Github/Parity/primitives/ethbloom)
error[E0277]: the trait bound `[u8]: std::marker::Sized` is not satisfied
   --> ethbloom/src/lib.rs:264:7
    |
264 |         let address = "ef2d6d194084c2de36e0dabfce45d046b37d1106".from_hex().unwrap();
    |             ^^^^^^^ `[u8]` does not have a constant size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `[u8]`
    = note: all local variables must have a statically known size

error[E0277]: the trait bound `[u8]: std::marker::Sized` is not satisfied
   --> ethbloom/src/lib.rs:264:71
    |
264 |         let address = "ef2d6d194084c2de36e0dabfce45d046b37d1106".from_hex().unwrap();
    |                                                                             ^^^^^^ `[u8]` does not have a constant size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `[u8]`

error[E0277]: the trait bound `[u8]: std::iter::FromIterator<u8>` is not satisfied
   --> ethbloom/src/lib.rs:264:60
    |
264 |         let address = "ef2d6d194084c2de36e0dabfce45d046b37d1106".from_hex().unwrap();
    |                                                                  ^^^^^^^^ a collection of type `[u8]` cannot be built from an iterator over elements of type `u8`
    |
    = help: the trait `std::iter::FromIterator<u8>` is not implemented for `[u8]`

error[E0277]: the trait bound `[u8]: std::marker::Sized` is not satisfied
   --> ethbloom/src/lib.rs:265:7
    |
265 |         let topic = "02c69be41d0b7e40352fc85be1cd65eb03d40ef8427a0ca4596b1ead9a00e9fc".from_hex().unwrap();
    |             ^^^^^ `[u8]` does not have a constant size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `[u8]`
    = note: all local variables must have a statically known size

error[E0277]: the trait bound `[u8]: std::marker::Sized` is not satisfied
   --> ethbloom/src/lib.rs:265:93
    |
265 |         let topic = "02c69be41d0b7e40352fc85be1cd65eb03d40ef8427a0ca4596b1ead9a00e9fc".from_hex().unwrap();
    |                                                                                                   ^^^^^^ `[u8]` does not have a constant size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `[u8]`

error[E0277]: the trait bound `[u8]: std::iter::FromIterator<u8>` is not satisfied
   --> ethbloom/src/lib.rs:265:82
    |
265 |         let topic = "02c69be41d0b7e40352fc85be1cd65eb03d40ef8427a0ca4596b1ead9a00e9fc".from_hex().unwrap();
    |                                                                                        ^^^^^^^^ a collection of type `[u8]` cannot be built from an iterator over elements of type `u8`
    |
    = help: the trait `std::iter::FromIterator<u8>` is not implemented for `[u8]`

error: aborting due to 6 previous errors

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

So, for now let's fallback to rustc-hex version 1.0!

niklasad1 commented 6 years ago

Oops, you mean not use rustc-hex use https://docs.rs/hex-literal/0.1.1/hex_literal/ instead?

dvdplm commented 6 years ago

not use rustc-hex

Exactly. For tests, prefer hex!. Ideally we'd like rustc-hex to be replaced by the hex crate but it's sort of low-priority.