summaryrefslogtreecommitdiffstats
path: root/tests/ui/regions/regions-escape-via-trait-or-not.rs
blob: ac0e56de4a0300eb73839fae3503dd2250bd64a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#![allow(dead_code)]

trait Deref {
    fn get(self) -> isize;
}

impl<'a> Deref for &'a isize {
    fn get(self) -> isize {
        *self
    }
}

fn with<R:Deref, F>(f: F) -> isize where F: FnOnce(&isize) -> R {
    f(&3).get()
}

fn return_it() -> isize {
    with(|o| o) //~ ERROR lifetime may not live long enough
}

fn main() {
}