File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
src/test/ui/generic-associated-types Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 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( generic_associated_types) ]
6+
7+ trait Foo {
8+ type Item < ' a > ;
9+ }
10+
11+ fn foo ( x : & impl Foo < Item < ' _ > = u32 > ) { }
12+ //~^ ERROR missing lifetime specifier
13+
14+ fn bar ( x : & impl for < ' a > Foo < Item < ' a > = & ' _ u32 > ) { }
15+ //~^ ERROR missing lifetime specifier
16+
17+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0106]: missing lifetime specifier
2+ --> $DIR/issue-95305.rs:11:26
3+ |
4+ LL | fn foo(x: &impl Foo<Item<'_> = u32>) { }
5+ | ^^ expected named lifetime parameter
6+ |
7+ help: consider introducing a named lifetime parameter
8+ |
9+ LL | fn foo<'a>(x: &impl Foo<Item<'a> = u32>) { }
10+ | ++++ ~~
11+
12+ error[E0106]: missing lifetime specifier
13+ --> $DIR/issue-95305.rs:14:41
14+ |
15+ LL | fn bar(x: &impl for<'a> Foo<Item<'a> = &'_ u32>) { }
16+ | ^^ expected named lifetime parameter
17+ |
18+ help: consider using the `'a` lifetime
19+ |
20+ LL | fn bar(x: &impl for<'a> Foo<Item<'a> = &'a u32>) { }
21+ | ~~
22+
23+ error: aborting due to 2 previous errors
24+
25+ For more information about this error, try `rustc --explain E0106`.
You can’t perform that action at this time.
0 commit comments