Rust and Flamegraph: Bunch of errors when installing using cargo

402 views Asked by At

I wanted to install flamegraph for Rust. Following the instructions available in the README I run cargo install flamegraph. However, at some point it throws a bunch of errors:

Compiling env_logger v0.8.3
Compiling atty v0.2.14
Compiling num_cpus v1.13.0
Compiling signal-hook-registry v1.3.0
Compiling quick-xml v0.20.0
Compiling clap v2.33.3
error[E0277]: the trait bound `K: std::cmp::Eq` is not satisfied
  --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_map.rs:36:18
   |
34 | impl<K, V> AHashMap<K, V, RandomState> {
   |      - help: consider restricting this bound: `K: std::cmp::Eq`
35 |     pub fn new() -> Self {
36 |         AHashMap(HashMap::with_hasher(RandomState::default()))
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `K`
   |
   = note: required by `std::collections::HashMap::<K, V, S>::with_hasher`

error[E0277]: the trait bound `K: std::hash::Hash` is not satisfied
  --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_map.rs:36:18
   |
34 | impl<K, V> AHashMap<K, V, RandomState> {
   |      - help: consider restricting this bound: `K: std::hash::Hash`
35 |     pub fn new() -> Self {
36 |         AHashMap(HashMap::with_hasher(RandomState::default()))
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::hash::Hash` is not implemented for `K`
   |
   = note: required by `std::collections::HashMap::<K, V, S>::with_hasher`

error[E0277]: the trait bound `K: std::cmp::Eq` is not satisfied
  --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_map.rs:40:18
   |
34 | impl<K, V> AHashMap<K, V, RandomState> {
   |      - help: consider restricting this bound: `K: std::cmp::Eq`
...
40 |         AHashMap(HashMap::with_capacity_and_hasher(capacity, RandomState::default()))
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `K`
   |
   = note: required by `std::collections::HashMap::<K, V, S>::with_capacity_and_hasher`

error[E0277]: the trait bound `K: std::hash::Hash` is not satisfied
  --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_map.rs:40:18
   |
34 | impl<K, V> AHashMap<K, V, RandomState> {
   |      - help: consider restricting this bound: `K: std::hash::Hash`
...
40 |         AHashMap(HashMap::with_capacity_and_hasher(capacity, RandomState::default()))
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::hash::Hash` is not implemented for `K`
   |
   = note: required by `std::collections::HashMap::<K, V, S>::with_capacity_and_hasher`

error[E0277]: the trait bound `K: std::cmp::Eq` is not satisfied
  --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_map.rs:47:18
   |
44 | impl<K, V, S> AHashMap<K, V, S> where S: BuildHasher {
   |                                                     - help: consider further restricting type parameter `K`: `, K: std::cmp::Eq`
...
47 |         AHashMap(HashMap::with_hasher(hash_builder))
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `K`
   |
   = note: required by `std::collections::HashMap::<K, V, S>::with_hasher`

error[E0277]: the trait bound `K: std::hash::Hash` is not satisfied
  --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_map.rs:47:18
   |
44 | impl<K, V, S> AHashMap<K, V, S> where S: BuildHasher {
   |                                                     - help: consider further restricting type parameter `K`: `, K: std::hash::Hash`
...
47 |         AHashMap(HashMap::with_hasher(hash_builder))
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::hash::Hash` is not implemented for `K`
   |
   = note: required by `std::collections::HashMap::<K, V, S>::with_hasher`

error[E0277]: the trait bound `K: std::cmp::Eq` is not satisfied
  --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_map.rs:51:18
   |
44 | impl<K, V, S> AHashMap<K, V, S> where S: BuildHasher {
   |                                                     - help: consider further restricting type parameter `K`: `, K: std::cmp::Eq`
...
51 |         AHashMap(HashMap::with_capacity_and_hasher(capacity, hash_builder))
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `K`
   |
   = note: required by `std::collections::HashMap::<K, V, S>::with_capacity_and_hasher`

error[E0277]: the trait bound `K: std::hash::Hash` is not satisfied
  --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_map.rs:51:18
   |
44 | impl<K, V, S> AHashMap<K, V, S> where S: BuildHasher {
   |                                                     - help: consider further restricting type parameter `K`: `, K: std::hash::Hash`
...
51 |         AHashMap(HashMap::with_capacity_and_hasher(capacity, hash_builder))
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::hash::Hash` is not implemented for `K`
   |
   = note: required by `std::collections::HashMap::<K, V, S>::with_capacity_and_hasher`

error[E0599]: no method named `fmt` found for struct `std::collections::HashMap<K, V, S>` in the current scope
   --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_map.rs:258:16
    |
258 |         self.0.fmt(fmt)
    |                ^^^ method not found in `std::collections::HashMap<K, V, S>`
    |
    = note: the method `fmt` exists but the following trait bounds were not satisfied:
            `std::collections::HashMap<K, V, S> : std::fmt::Debug`

error[E0277]: the trait bound `T: std::cmp::Eq` is not satisfied
  --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_set.rs:34:18
   |
32 | impl<T> AHashSet<T, RandomState> {
   |      - help: consider restricting this bound: `T: std::cmp::Eq`
33 |     pub fn new() -> Self {
34 |         AHashSet(HashSet::with_hasher(RandomState::default()))
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `T`
   |
   = note: required by `std::collections::HashSet::<T, S>::with_hasher`

error[E0277]: the trait bound `T: std::hash::Hash` is not satisfied
  --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_set.rs:34:18
   |
32 | impl<T> AHashSet<T, RandomState> {
   |      - help: consider restricting this bound: `T: std::hash::Hash`
33 |     pub fn new() -> Self {
34 |         AHashSet(HashSet::with_hasher(RandomState::default()))
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::hash::Hash` is not implemented for `T`
   |
   = note: required by `std::collections::HashSet::<T, S>::with_hasher`

error[E0277]: the trait bound `T: std::cmp::Eq` is not satisfied
  --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_set.rs:38:18
   |
32 | impl<T> AHashSet<T, RandomState> {
   |      - help: consider restricting this bound: `T: std::cmp::Eq`
...
38 |         AHashSet(HashSet::with_capacity_and_hasher(capacity, RandomState::default()))
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `T`
   |
   = note: required by `std::collections::HashSet::<T, S>::with_capacity_and_hasher`

error[E0277]: the trait bound `T: std::hash::Hash` is not satisfied
  --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_set.rs:38:18
   |
32 | impl<T> AHashSet<T, RandomState> {
   |      - help: consider restricting this bound: `T: std::hash::Hash`
...
38 |         AHashSet(HashSet::with_capacity_and_hasher(capacity, RandomState::default()))
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::hash::Hash` is not implemented for `T`
   |
   = note: required by `std::collections::HashSet::<T, S>::with_capacity_and_hasher`

error[E0277]: the trait bound `T: std::cmp::Eq` is not satisfied
  --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_set.rs:45:18
   |
42 | impl<T, S> AHashSet<T, S> where S: BuildHasher {
   |                                               - help: consider further restricting type parameter `T`: `, T: std::cmp::Eq`
...
45 |         AHashSet(HashSet::with_hasher(hash_builder))
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `T`
   |
   = note: required by `std::collections::HashSet::<T, S>::with_hasher`

error[E0277]: the trait bound `T: std::hash::Hash` is not satisfied
  --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_set.rs:45:18
   |
42 | impl<T, S> AHashSet<T, S> where S: BuildHasher {
   |                                               - help: consider further restricting type parameter `T`: `, T: std::hash::Hash`
...
45 |         AHashSet(HashSet::with_hasher(hash_builder))
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::hash::Hash` is not implemented for `T`
   |
   = note: required by `std::collections::HashSet::<T, S>::with_hasher`

error[E0277]: the trait bound `T: std::cmp::Eq` is not satisfied
  --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_set.rs:49:18
   |
42 | impl<T, S> AHashSet<T, S> where S: BuildHasher {
   |                                               - help: consider further restricting type parameter `T`: `, T: std::cmp::Eq`
...
49 |         AHashSet(HashSet::with_capacity_and_hasher(capacity, hash_builder))
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `T`
   |
   = note: required by `std::collections::HashSet::<T, S>::with_capacity_and_hasher`

error[E0277]: the trait bound `T: std::hash::Hash` is not satisfied
  --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_set.rs:49:18
   |
42 | impl<T, S> AHashSet<T, S> where S: BuildHasher {
   |                                               - help: consider further restricting type parameter `T`: `, T: std::hash::Hash`
...
49 |         AHashSet(HashSet::with_capacity_and_hasher(capacity, hash_builder))
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::hash::Hash` is not implemented for `T`
   |
   = note: required by `std::collections::HashSet::<T, S>::with_capacity_and_hasher`

error[E0599]: no method named `fmt` found for struct `std::collections::HashSet<T, S>` in the current scope
   --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_set.rs:217:16
    |
217 |         self.0.fmt(fmt)
    |                ^^^ method not found in `std::collections::HashSet<T, S>`
    |
    = note: the method `fmt` exists but the following trait bounds were not satisfied:
            `std::collections::HashSet<T, S> : std::fmt::Debug`

error[E0277]: the trait bound `T: std::cmp::Eq` is not satisfied
   --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_set.rs:274:18
    |
270 | impl<T> Default for AHashSet<T, RandomState> {
    |      - help: consider restricting this bound: `T: std::cmp::Eq`
...
274 |         AHashSet(HashSet::default())
    |                  ^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `T`
    |
    = note: required because of the requirements on the impl of `std::default::Default` for `std::collections::HashSet<T, random_state::RandomState>`
    = note: required by `std::default::Default::default`

error[E0277]: the trait bound `T: std::hash::Hash` is not satisfied
   --> /Users/ania/.cargo/registry/src/github.com-1ecc6299db9ec823/ahash-0.6.3/src/hash_set.rs:274:18
    |
270 | impl<T> Default for AHashSet<T, RandomState> {
    |      - help: consider restricting this bound: `T: std::hash::Hash`
...
274 |         AHashSet(HashSet::default())
    |                  ^^^^^^^^^^^^^^^^^^ the trait `std::hash::Hash` is not implemented for `T`
    |
    = note: required because of the requirements on the impl of `std::default::Default` for `std::collections::HashSet<T, random_state::RandomState>`
    = note: required by `std::default::Default::default`

error: aborting due to 20 previous errors

Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `ahash`.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `flamegraph v0.4.0`, intermediate artifacts can be found at `/var/folders/fl/dr1_kh0d5xjdsxcd5x8pvb_w0000gn/T/cargo-installllCFHI`

Caused by:
  build failed

Anyone can help with that? Is there additional stuff I should install first?

1

There are 1 answers

0
mcarton On

flamegraph appears to be taking advantage of relaxed trait bounds on Hashmap, which were released in Rust 1.43:

Version 1.43.0 (2020-04-23)

Libraries

If you want to use flamegraph, you therefore must update your version of rustc.