|
| 1 | +error[E0803]: cannot infer an appropriate lifetime for lifetime parameter '_ in generic type due to conflicting requirements |
| 2 | + --> $DIR/impl-trait-lifetime-conflict-hashmap-keys.rs:13:5 |
| 3 | + | |
| 4 | +LL | fn key_set(&self) -> Subject<'static, Keys<K, V>, (), R> { |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 6 | + | |
| 7 | +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... |
| 8 | + --> $DIR/impl-trait-lifetime-conflict-hashmap-keys.rs:12:6 |
| 9 | + | |
| 10 | +LL | impl<'a, K, V, R> MapAssertion<'a, K, V, R> for Subject<'a, HashMap<K, V>, (), R> { |
| 11 | + | ^^ |
| 12 | +note: ...so that the reference type `&Subject<'a, HashMap<K, V>, (), R>` does not outlive the data it points at |
| 13 | + --> $DIR/impl-trait-lifetime-conflict-hashmap-keys.rs:13:5 |
| 14 | + | |
| 15 | +LL | fn key_set(&self) -> Subject<'static, Keys<K, V>, (), R> { |
| 16 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 17 | + = note: but, the lifetime must be valid for the static lifetime... |
| 18 | +note: ...so that the type `std::collections::hash_map::Keys<'_, K, V>` will meet its required lifetime bounds... |
| 19 | + --> $DIR/impl-trait-lifetime-conflict-hashmap-keys.rs:13:5 |
| 20 | + | |
| 21 | +LL | fn key_set(&self) -> Subject<'static, Keys<K, V>, (), R> { |
| 22 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 23 | +note: ...that is required by this bound |
| 24 | + --> $DIR/impl-trait-lifetime-conflict-hashmap-keys.rs:10:29 |
| 25 | + | |
| 26 | +LL | struct Subject<'a, T, V, R>(PhantomData<(&'a T, V, R)>); |
| 27 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 28 | + |
| 29 | +error[E0308]: mismatched types |
| 30 | + --> $DIR/impl-trait-lifetime-conflict-hashmap-keys.rs:13:26 |
| 31 | + | |
| 32 | +LL | fn key_set(&self) -> Subject<'static, Keys<K, V>, (), R> { |
| 33 | + | ------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Subject<'_, Keys<'_, K, V>, (), R>`, found `()` |
| 34 | + | | |
| 35 | + | implicitly returns `()` as its body has no tail or `return` expression |
| 36 | + | |
| 37 | + = note: expected struct `Subject<'static, std::collections::hash_map::Keys<'_, K, V>, (), R>` |
| 38 | + found unit type `()` |
| 39 | + |
| 40 | +error: aborting due to 2 previous errors |
| 41 | + |
| 42 | +Some errors have detailed explanations: E0308, E0803. |
| 43 | +For more information about an error, try `rustc --explain E0308`. |
0 commit comments