| error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements |
| --> $DIR/mismatched_trait_impl.rs:9:5 |
| | |
| LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| | |
| note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 9:5... |
| --> $DIR/mismatched_trait_impl.rs:9:5 |
| | |
| LL | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { |
| LL | | x |
| LL | | } |
| | |_____^ |
| note: ...but the lifetime must also be valid for the lifetime 'a as defined on the method body at 9:32... |
| --> $DIR/mismatched_trait_impl.rs:9:32 |
| | |
| LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { |
| | ^^ |
| = note: ...so that the method type is compatible with trait: |
| expected fn(&i32, &'a u32, &u32) -> &'a u32 |
| found fn(&i32, &u32, &u32) -> &u32 |
| |
| error[E0623]: lifetime mismatch |
| --> $DIR/mismatched_trait_impl.rs:10:9 |
| | |
| LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { |
| | ---- ------- |
| | | |
| | this parameter and the return type are declared with different lifetimes... |
| LL | x |
| | ^ ...but data from `x` is returned here |
| |
| error: aborting due to 2 previous errors |
| |