Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion compiler/rustc_parse/src/parser/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,11 @@ impl<'a> Parser<'a> {
let x = self.parse_seq_to_before_end(
&token::Gt,
SeqSep::trailing_allowed(token::Comma),
|p| p.parse_generic_arg(None),
|p| match p.parse_generic_arg(None)? {
Some(arg) => Ok(arg),
// If we didn't eat a generic arg, then we should error.
None => p.unexpected_any(),
},
);
match x {
Ok((_, _, Recovered::No)) => {
Expand Down
6 changes: 6 additions & 0 deletions tests/ui/parser/recover/turbofish-arg-with-stray-colon.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fn foo() {
let x = Tr<A, A:>;
//~^ ERROR expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,`
}

fn main() {}
14 changes: 14 additions & 0 deletions tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,`
--> $DIR/turbofish-arg-with-stray-colon.rs:2:17
|
LL | let x = Tr<A, A:>;
| ^ expected one of 8 possible tokens
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
help: maybe write a path separator here
|
LL | let x = Tr<A, A::>;
| ~~

error: aborting due to 1 previous error