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:
commit
cb449d26ee
3 changed files with 80 additions and 38 deletions
11
src/test/ui/parser/assoc-type-in-type-arg.rs
Normal file
11
src/test/ui/parser/assoc-type-in-type-arg.rs
Normal 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() {}
|
||||
8
src/test/ui/parser/assoc-type-in-type-arg.stderr
Normal file
8
src/test/ui/parser/assoc-type-in-type-arg.stderr
Normal 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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue