]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-47511.rs
Rollup merge of #60492 - acrrd:issues/54054_chain, r=SimonSapin
[rust.git] / src / test / ui / issues / issue-47511.rs
1 // Regression test for #47511: anonymous lifetimes can appear
2 // unconstrained in a return type, but only if they appear just once
3 // in the input, as the input to a projection.
4
5 fn f(_: X) -> X {
6     //~^ ERROR return type references an anonymous lifetime
7     unimplemented!()
8 }
9
10 fn g<'a>(_: X<'a>) -> X<'a> {
11     //~^ ERROR return type references lifetime `'a`, which is not constrained
12     unimplemented!()
13 }
14
15 type X<'a> = <&'a () as Trait>::Value;
16
17 trait Trait {
18     type Value;
19 }
20
21 impl<'a> Trait for &'a () {
22     type Value = ();
23 }
24
25 fn main() {}