diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 4ceb978f7f443fd4029f6926bdd764b7ec84741d..cc5436cff63e1a47ad137ff5ba527f696b5a917d 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -10926,6 +10926,15 @@ Parser<ManagedTokenSource>::parse_grouped_or_tuple_pattern () return std::unique_ptr<AST::TuplePattern> ( new AST::TuplePattern (std::move (items), paren_locus)); } + else if (lexer.peek_token ()->get_id () == RIGHT_PAREN) + { + skip_token (RIGHT_PAREN); + auto items = std::unique_ptr<AST::TuplePatternItemsMultiple> ( + new AST::TuplePatternItemsMultiple ( + std::vector<std::unique_ptr<AST::Pattern>> ())); + return std::unique_ptr<AST::TuplePattern> ( + new AST::TuplePattern (std::move (items), paren_locus)); + } // parse initial pattern (required) std::unique_ptr<AST::Pattern> initial_pattern = parse_pattern (); diff --git a/gcc/testsuite/rust/compile/parse_empty_tuple_pattern.rs b/gcc/testsuite/rust/compile/parse_empty_tuple_pattern.rs new file mode 100644 index 0000000000000000000000000000000000000000..d974d31b8baec86c587cc6ffd0186fa4635b3528 --- /dev/null +++ b/gcc/testsuite/rust/compile/parse_empty_tuple_pattern.rs @@ -0,0 +1,3 @@ +fn main() { + let () = (); +}