summaryrefslogtreecommitdiffstats
path: root/src/test/ui/regions/region-object-lifetime-2.rs
blob: cfdb8fefed35dac3a133e1e40b8eb379ff09f077 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Various tests related to testing how region inference works
// with respect to the object receivers.

trait Foo {
    fn borrowed<'a>(&'a self) -> &'a ();
}

// Borrowed receiver but two distinct lifetimes, we get an error.
fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () {
    x.borrowed()
    //~^ ERROR lifetime may not live long enough
}

fn main() {}