summaryrefslogtreecommitdiffstats
path: root/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.rs
blob: 63d81a57d5d97703a0cf5ca875c847d0df0e2190 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
struct Foo {
    field: i32,
}

impl Foo {
    fn foo<'a>(&self, x: &'a Foo) -> &'a Foo {

        if true { x } else { self }
        //~^ ERROR lifetime may not live long enough

    }
}

fn main() {}