1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#[derive(Clone)] enum Foo<'a> { Bar(&'a str), } impl<'a> Foo<'a> { fn bar(&self, other: Foo) -> Foo<'a> { match *self { Foo::Bar(s) => { if s == "test" { other //~ ERROR explicit lifetime } else { self.clone() } } } } } fn main() { }