public inbox for gcc-rust@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED 01/25] gccrs: Parse normal functions with `self` parameter correctly
@ 2024-02-07 11:43 arthur.cohen
  2024-02-07 11:43 ` [COMMITTED 02/25] gccrs: Implement quick-check for Unicode arthur.cohen
                   ` (23 more replies)
  0 siblings, 24 replies; 30+ messages in thread
From: arthur.cohen @ 2024-02-07 11:43 UTC (permalink / raw)
  To: gcc-patches; +Cc: gcc-rust, Kushal Pal

From: Kushal Pal <kushalpal109@gmail.com>

Fixes #2812

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_function):
	Skip token if its a COMMA.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2812.rs: New test.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
---
 gcc/rust/parse/rust-parse-impl.h         | 4 ++--
 gcc/testsuite/rust/compile/issue-2812.rs | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/rust/compile/issue-2812.rs

diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index c622ed7bc97..89e3731a898 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -2946,8 +2946,8 @@ Parser<ManagedTokenSource>::parse_function (AST::Visibility vis,
       && initial_param.error () != ParseSelfError::NOT_SELF)
     return nullptr;
 
-  if (initial_param.has_value ())
-    skip_token (COMMA);
+  if (initial_param.has_value () && lexer.peek_token ()->get_id () == COMMA)
+    skip_token ();
 
   // parse function parameters (only if next token isn't right paren)
   std::vector<std::unique_ptr<AST::Param>> function_params;
diff --git a/gcc/testsuite/rust/compile/issue-2812.rs b/gcc/testsuite/rust/compile/issue-2812.rs
new file mode 100644
index 00000000000..173259b1291
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-2812.rs
@@ -0,0 +1,4 @@
+// { dg-additional-options "-frust-compile-until=astvalidation" }
+fn foo_1(&self);
+fn foo_1(&mut self);
+fn foo_1(self);
-- 
2.42.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2024-02-15 12:12 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-07 11:43 [COMMITTED 01/25] gccrs: Parse normal functions with `self` parameter correctly arthur.cohen
2024-02-07 11:43 ` [COMMITTED 02/25] gccrs: Implement quick-check for Unicode arthur.cohen
2024-02-07 11:43 ` [COMMITTED 03/25] gccrs: Typecheck: lifetime interning and resolution tool arthur.cohen
2024-02-07 11:43 ` [COMMITTED 04/25] gccrs: TyTy: Region (lifetime) representation arthur.cohen
2024-02-07 11:43 ` [COMMITTED 05/25] gccrs: HIR: Add mising getter arthur.cohen
2024-02-07 11:43 ` [COMMITTED 06/25] gccrs: Typecheck: add regions (lifetimes) to TyTy arthur.cohen
2024-02-07 11:43 ` [COMMITTED 07/25] gccrs: TyTy: Store region constraints arthur.cohen
2024-02-07 15:26   ` Bernhard Reutner-Fischer
2024-02-07 14:46     ` Arthur Cohen
2024-02-07 11:43 ` [COMMITTED 08/25] gccrs: TyTy: Store reference to type before any substitutions arthur.cohen
2024-02-07 11:43 ` [COMMITTED 09/25] gccrs: Set the default ABI to C for extern blocks and extern functions arthur.cohen
2024-02-07 11:43 ` [COMMITTED 10/25] gccrs: add testcase to prove issue has already been fixed arthur.cohen
2024-02-07 11:43 ` [COMMITTED 11/25] gccrs: add test cases to prove type inference is working arthur.cohen
2024-02-07 11:43 ` [COMMITTED 12/25] gccrs: Fix ICE accessing empty vector without check arthur.cohen
2024-02-07 11:43 ` [COMMITTED 13/25] gccrs: remove old generics hack to reuse generic symbols from previous seg arthur.cohen
2024-02-09 10:03   ` Jakub Jelinek
2024-02-15  9:10     ` [PATCH] gccrs: Avoid *.bak suffixed tests - use dg-skip-if instead Jakub Jelinek
2024-02-15 13:12       ` Arthur Cohen
2024-02-07 11:44 ` [COMMITTED 14/25] gccrs: remove similar hack in type paths as we had in path expressions arthur.cohen
2024-02-07 11:44 ` [COMMITTED 15/25] gccrs: refactor inference variable computation into a seperate method arthur.cohen
2024-02-07 11:44 ` [COMMITTED 16/25] gccrs: Move the Implementation of implitem lowering into its own file arthur.cohen
2024-02-07 11:44 ` [COMMITTED 17/25] gccrs: Add testcase to show issue is already fixed arthur.cohen
2024-02-07 11:44 ` [COMMITTED 18/25] gccrs: fix bug in pattern check for tuples arthur.cohen
2024-02-07 11:44 ` [COMMITTED 19/25] gccrs: Use AssociatedItem in place of TraitItem arthur.cohen
2024-02-07 11:44 ` [COMMITTED 20/25] gccrs: Add checks for Trait functions arthur.cohen
2024-02-07 11:44 ` [COMMITTED 21/25] gccrs: Add missing visitors for AST::Function arthur.cohen
2024-02-07 11:44 ` [COMMITTED 22/25] gccrs: Fix inconsistent formatting arthur.cohen
2024-02-07 11:44 ` [COMMITTED 23/25] gccrs: Parse trait functions as `AST::Function` arthur.cohen
2024-02-07 11:44 ` [COMMITTED 24/25] gccrs: Remove obsolete classes and functions arthur.cohen
2024-02-07 11:44 ` [COMMITTED 25/25] gccrs: Fix macro parsing for trait items arthur.cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).