Parse assoc type bounds in generic params and provide custom diagnostic

This commit is contained in:
Esteban Küber 2019-09-21 17:11:09 -07:00
parent 9ad1e7c46c
commit 60560bc2a2
3 changed files with 80 additions and 38 deletions

View file

@ -0,0 +1,11 @@
trait Tr {
type TrSubtype;
}
struct Bar<'a, Item: Tr, <Item as Tr>::TrSubtype: 'a> {
//~^ ERROR associated type bounds do not belong here
item: Item,
item_sub: &'a <Item as Tr>::TrSubtype,
}
fn main() {}

View file

@ -0,0 +1,8 @@
error: associated type bounds do not belong here
--> $DIR/assoc-type-in-type-arg.rs:5:26
|
LL | struct Bar<'a, Item: Tr, <Item as Tr>::TrSubtype: 'a> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ belongs in `where` clause
error: aborting due to previous error