|
1 |
| -error[E0277]: the trait bound `V: Eq` is not satisfied |
2 |
| - --> $DIR/bad-index-due-to-nested.rs:9:9 |
| 1 | +error[E0277]: the trait bound `K: Hash` is not satisfied |
| 2 | + --> $DIR/bad-index-due-to-nested.rs:20:5 |
3 | 3 | |
|
4 |
| -LL | self.node_index_map[&node] |
5 |
| - | ^^^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `V` |
| 4 | +LL | map[k] |
| 5 | + | ^^^ the trait `Hash` is not implemented for `K` |
6 | 6 | |
|
7 |
| -note: required by a bound in `<HashMap<K, V, S> as Index<&Q>>` |
8 |
| - --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL |
9 |
| -help: consider restricting type parameter `V` |
| 7 | +note: required by a bound in `<HashMap<K, V> as Index<&K>>` |
| 8 | + --> $DIR/bad-index-due-to-nested.rs:9:8 |
| 9 | + | |
| 10 | +LL | K: Hash, |
| 11 | + | ^^^^ required by this bound in `<HashMap<K, V> as Index<&K>>` |
| 12 | +help: consider restricting type parameter `K` |
10 | 13 | |
|
11 |
| -LL | impl<V: std::cmp::Eq> Graph<V> { |
12 |
| - | ++++++++++++++ |
| 14 | +LL | fn index<'a, K: std::hash::Hash, V>(map: &'a HashMap<K, V>, k: K) -> &'a V { |
| 15 | + | +++++++++++++++++ |
13 | 16 |
|
14 |
| -error[E0277]: the trait bound `V: Hash` is not satisfied |
15 |
| - --> $DIR/bad-index-due-to-nested.rs:9:9 |
| 17 | +error[E0277]: the trait bound `V: Copy` is not satisfied |
| 18 | + --> $DIR/bad-index-due-to-nested.rs:20:5 |
| 19 | + | |
| 20 | +LL | map[k] |
| 21 | + | ^^^ the trait `Copy` is not implemented for `V` |
16 | 22 | |
|
17 |
| -LL | self.node_index_map[&node] |
18 |
| - | ^^^^^^^^^^^^^^^^^^^ the trait `Hash` is not implemented for `V` |
| 23 | +note: required by a bound in `<HashMap<K, V> as Index<&K>>` |
| 24 | + --> $DIR/bad-index-due-to-nested.rs:10:8 |
19 | 25 | |
|
20 |
| -note: required by a bound in `<HashMap<K, V, S> as Index<&Q>>` |
21 |
| - --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL |
| 26 | +LL | V: Copy, |
| 27 | + | ^^^^ required by this bound in `<HashMap<K, V> as Index<&K>>` |
22 | 28 | help: consider restricting type parameter `V`
|
23 | 29 | |
|
24 |
| -LL | impl<V: std::hash::Hash> Graph<V> { |
25 |
| - | +++++++++++++++++ |
| 30 | +LL | fn index<'a, K, V: std::marker::Copy>(map: &'a HashMap<K, V>, k: K) -> &'a V { |
| 31 | + | +++++++++++++++++++ |
| 32 | + |
| 33 | +error[E0308]: mismatched types |
| 34 | + --> $DIR/bad-index-due-to-nested.rs:20:9 |
| 35 | + | |
| 36 | +LL | fn index<'a, K, V>(map: &'a HashMap<K, V>, k: K) -> &'a V { |
| 37 | + | - this type parameter |
| 38 | +LL | map[k] |
| 39 | + | ^ |
| 40 | + | | |
| 41 | + | expected `&K`, found type parameter `K` |
| 42 | + | help: consider borrowing here: `&k` |
| 43 | + | |
| 44 | + = note: expected reference `&K` |
| 45 | + found type parameter `K` |
| 46 | + |
| 47 | +error[E0308]: mismatched types |
| 48 | + --> $DIR/bad-index-due-to-nested.rs:20:5 |
| 49 | + | |
| 50 | +LL | fn index<'a, K, V>(map: &'a HashMap<K, V>, k: K) -> &'a V { |
| 51 | + | - this type parameter ----- expected `&'a V` because of return type |
| 52 | +LL | map[k] |
| 53 | + | ^^^^^^ |
| 54 | + | | |
| 55 | + | expected `&V`, found type parameter `V` |
| 56 | + | help: consider borrowing here: `&map[k]` |
| 57 | + | |
| 58 | + = note: expected reference `&'a V` |
| 59 | + found type parameter `V` |
26 | 60 |
|
27 |
| -error: aborting due to 2 previous errors |
| 61 | +error: aborting due to 4 previous errors |
28 | 62 |
|
29 |
| -For more information about this error, try `rustc --explain E0277`. |
| 63 | +Some errors have detailed explanations: E0277, E0308. |
| 64 | +For more information about an error, try `rustc --explain E0277`. |
0 commit comments