Fix parsing of paths with fn-like generic arguments

This commit is contained in:
Vadim Petrochenkov 2017-12-18 23:59:31 +03:00
parent eef85cf0ff
commit d333752f5c
3 changed files with 18 additions and 24 deletions

View file

@ -38,11 +38,9 @@ type G = 'static + (Send)::AssocTy;
//~^ ERROR missing angle brackets in associated item path
//~| ERROR ambiguous associated type
// FIXME
// This is actually a legal path with fn-like generic arguments in the middle!
// Recovery should not apply in this context.
type H = Fn(u8) -> (u8)::Output;
//~^ ERROR missing angle brackets in associated item path
//~| ERROR ambiguous associated type
//~^ ERROR ambiguous associated type
fn main() {}

View file

@ -38,13 +38,7 @@ error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:37:10
|
37 | type G = 'static + (Send)::AssocTy;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `< 'static + Send>::AssocTy`
error: missing angle brackets in associated item path
--> $DIR/bad-assoc-ty.rs:44:20
|
44 | type H = Fn(u8) -> (u8)::Output;
| ^^^^^^^^^^^^ help: try: `<(u8)>::Output`
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `<'static + Send>::AssocTy`
error[E0223]: ambiguous associated type
--> $DIR/bad-assoc-ty.rs:11:10
@ -101,12 +95,12 @@ error[E0223]: ambiguous associated type
= note: specify the type using the syntax `<std::marker::Send + 'static as Trait>::AssocTy`
error[E0223]: ambiguous associated type
--> $DIR/bad-assoc-ty.rs:44:20
--> $DIR/bad-assoc-ty.rs:43:10
|
44 | type H = Fn(u8) -> (u8)::Output;
| ^^^^^^^^^^^^ ambiguous associated type
43 | type H = Fn(u8) -> (u8)::Output;
| ^^^^^^^^^^^^^^^^^^^^^^ ambiguous associated type
|
= note: specify the type using the syntax `<u8 as Trait>::Output`
= note: specify the type using the syntax `<std::ops::Fn(u8) -> u8 + 'static as Trait>::Output`
error: aborting due to 16 previous errors
error: aborting due to 15 previous errors