|
1 |
| -error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements |
| 1 | +error: `impl` item signature doesn't match `trait` item signature |
2 | 2 | --> $DIR/mismatched_trait_impl.rs:9:5
|
3 | 3 | |
|
| 4 | +LL | fn foo(&self, x: &'a u32, y: &u32) -> &'a u32; |
| 5 | + | ---------------------------------------------- expected fn(&i32, &'a u32, &u32) -> &'a u32 |
| 6 | +... |
4 | 7 | LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 {
|
5 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 8 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found fn(&i32, &u32, &u32) -> &u32 |
6 | 9 | |
|
7 |
| -note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 9:5... |
8 |
| - --> $DIR/mismatched_trait_impl.rs:9:5 |
9 |
| - | |
10 |
| -LL | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { |
11 |
| -LL | | x |
12 |
| -LL | | } |
13 |
| - | |_____^ |
14 |
| -note: ...but the lifetime must also be valid for the lifetime `'a` as defined on the method body at 9:32... |
15 |
| - --> $DIR/mismatched_trait_impl.rs:9:32 |
16 |
| - | |
17 |
| -LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { |
18 |
| - | ^^ |
19 |
| - = note: ...so that the method type is compatible with trait: |
20 |
| - expected fn(&i32, &'a u32, &u32) -> &'a u32 |
21 |
| - found fn(&i32, &u32, &u32) -> &u32 |
| 10 | + = note: expected `fn(&i32, &'a u32, &u32) -> &'a u32` |
| 11 | + found `fn(&i32, &u32, &u32) -> &u32` |
22 | 12 |
|
23 | 13 | error: aborting due to previous error
|
24 | 14 |
|
25 |
| -For more information about this error, try `rustc --explain E0495`. |
0 commit comments