问题描述
我想为 Rust
安装 flamegraph。按照 README 中的说明运行 cargo install flamegraph
。然而,在某些时候它会抛出一堆错误:
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,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,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,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,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,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,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,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,S> AHashMap<K,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,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,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,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,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,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,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,S>::with_capacity_and_hasher`
error[E0599]: no method named `fmt` found for struct `std::collections::HashMap<K,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,S>`
|
= note: the method `fmt` exists but the following trait bounds were not satisfied:
`std::collections::HashMap<K,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,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,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,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
有人可以帮忙吗?我应该先安装其他东西吗?
解决方法
flamegraph
似乎利用了 Hashmap
上的宽松特征边界,即 released in Rust 1.43:
版本 1.43.0 (2020-04-23)
…
图书馆
…
如果你想使用火焰图,你必须更新你的 rustc 版本。