Rollup merge of #64676 - estebank:assoc-type-bound-in-generic, r=petrochenkov

Parse assoc type bounds in generic params and provide custom diagnostic

Fix #26271.
This commit is contained in:
Mazdak Farrokhzad 2019-09-23 00:36:37 +02:00 committed by GitHub
commit cb449d26ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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 bounds on associated types do not belong here
item: Item,
item_sub: &'a <Item as Tr>::TrSubtype,
}
fn main() {}

View file

@ -0,0 +1,8 @@
error: bounds on associated types 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