summary refs log tree commit diff
path: root/src/test/ui/issues/issue-47511.rs
blob: 0f33b52577b7071747c1cdc0ad88ef69e5b24e3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Regression test for #47511: anonymous lifetimes can appear
// unconstrained in a return type, but only if they appear just once
// in the input, as the input to a projection.

fn f(_: X) -> X {
    //~^ ERROR return type references an anonymous lifetime
    unimplemented!()
}

fn g<'a>(_: X<'a>) -> X<'a> {
    //~^ ERROR return type references lifetime `'a`, which is not constrained
    unimplemented!()
}

type X<'a> = <&'a () as Trait>::Value;

trait Trait {
    type Value;
}

impl<'a> Trait for &'a () {
    type Value = ();
}

fn main() {}