From 38bad2bf21ef0649b3e89bcccfe7e8f7c366de68 Mon Sep 17 00:00:00 2001 From: Arthur Cohen Date: Thu, 2 Feb 2023 15:32:17 +0100 Subject: 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. --- gcc/rust/parse/rust-parse-impl.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/rust/parse/rust-parse-impl.h') 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::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::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; } -- cgit v1.1