]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/issue-95305.rs
Rollup merge of #104024 - noeddl:unused-must-use, r=compiler-errors
[rust.git] / src / test / ui / generic-associated-types / issue-95305.rs
1 // It's not yet clear how '_ and GATs should interact.
2 // Forbid it for now but proper support might be added
3 // at some point in the future.
4
5 #![feature(anonymous_lifetime_in_impl_trait)]
6 trait Foo {
7     type Item<'a>;
8 }
9
10 fn foo(x: &impl Foo<Item<'_> = u32>) { }
11                        //~^ ERROR `'_` cannot be used here [E0637]
12
13 // Ok: the anonymous lifetime is bound to the function.
14 fn bar(x: &impl for<'a> Foo<Item<'a> = &'_ u32>) { }
15
16 // Ok: the anonymous lifetime is bound to the function.
17 fn baz(x: &impl for<'a> Foo<Item<'a> = &u32>) { }
18
19 fn main() {}