summaryrefslogtreecommitdiffstats
path: root/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs
blob: a1126d6bb1543db5d9c60121ac7137c50ffe74f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
struct Foo {
  field: i32
}

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

    if true { &self.field } else { x } //~ ERROR explicit lifetime

  }

}

fn main() { }