aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/parse/rust-parse-impl.h
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2023-02-02 15:32:17 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2023-02-03 11:50:00 +0100
commit38bad2bf21ef0649b3e89bcccfe7e8f7c366de68 (patch)
treefb72a0b4c247dd653648b1a32ba146d8970ba781 /gcc/rust/parse/rust-parse-impl.h
parent776c4247de465dd93438a738fff48d5b2076ec11 (diff)
downloadgcc-38bad2bf21ef0649b3e89bcccfe7e8f7c366de68.zip
gcc-38bad2bf21ef0649b3e89bcccfe7e8f7c366de68.tar.gz
gcc-38bad2bf21ef0649b3e89bcccfe7e8f7c366de68.tar.bz2
parser: Fix parsing of closure param list
gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_closure_expr): Advance tokens properly when parsing closure param list. gcc/testsuite/ChangeLog: * rust/compile/closure_move_expr.rs: New test.
Diffstat (limited to 'gcc/rust/parse/rust-parse-impl.h')
-rw-r--r--gcc/rust/parse/rust-parse-impl.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index f60d34f..a3fc9f3 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -7590,6 +7590,7 @@ Parser<ManagedTokenSource>::parse_closure_expr (AST::AttrVec outer_attrs)
case PIPE:
// actually may have parameters
lexer.skip_token ();
+ t = lexer.peek_token ();
while (t->get_id () != PIPE)
{
@@ -7606,6 +7607,7 @@ Parser<ManagedTokenSource>::parse_closure_expr (AST::AttrVec outer_attrs)
if (lexer.peek_token ()->get_id () != COMMA)
{
+ lexer.skip_token ();
// not an error but means param list is done
break;
}