error[E0495]: cannot infer an appropriate lifetime for lifetime parameter in generic type due to conflicting requirements --> $DIR/mismatched_trait_impl-2.rs:8:5 | LL | fn deref(&self) -> &dyn Trait { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 8:5... --> $DIR/mismatched_trait_impl-2.rs:8:5 | LL | / fn deref(&self) -> &dyn Trait { LL | | unimplemented!(); LL | | } | |_____^ = note: ...but the lifetime must also be valid for the static lifetime... = note: ...so that the method type is compatible with trait: expected fn(&Struct) -> &(dyn Trait + 'static) found fn(&Struct) -> &dyn Trait error: aborting due to previous error