about summary refs log tree commit diff
path: root/tests/ui/borrowck/ice-on-non-ref-sig-ty.rs
blob: 1c867bd2378d04f3b4d7896e7e55f182f52a9ab1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Don't ICE when trying to annotate signature and we see `&()`

fn f<'a, T>(_: &'static &'a (), x: &'a T) -> &'static T {
    x
}
trait W<'a> {
    fn g<T>(self, x: &'a T) -> &'static T;
}

// Frankly this error message is impossible to parse, but :shrug:.
impl<'a> W<'a> for &'static () {
    fn g<T>(self, x: &'a T) -> &'static T {
        f(&self, x)
        //~^ ERROR borrowed data escapes outside of method
        //~| ERROR `self` does not live long enough
    }
}

fn main() {}