]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: ast: Fix match case comma output
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Tue, 4 Apr 2023 09:26:51 +0000 (11:26 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:28:43 +0000 (18:28 +0100)
Even though the comma may be optional with blocks of expressions, it is
mandatory for a single expression alone. By changing this behavior we
ensure a working behavior with any kind of expressions.

gcc/rust/ChangeLog:

* ast/rust-ast-tokenstream.cc (TokenStream::visit): Make comma
mandatory.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/ast/rust-ast-tokenstream.cc

index b9473091d19177be95891d1554ed44e070cf3e9d..b248aeedea3ea576b27599b37d5e438d219847e9 100644 (file)
@@ -1509,7 +1509,7 @@ TokenStream::visit (MatchCase &match_case)
   visit (match_case.get_arm ());
   tokens.push_back (Rust::Token::make (MATCH_ARROW, Location ()));
   visit (match_case.get_expr ());
-  trailing_comma ();
+  tokens.push_back (Rust::Token::make (COMMA, Location ()));
 }
 
 void