public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] parser: Fix parsing closure parameter
@ 2023-03-05 11:42 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-03-05 11:42 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a4c851df0358389970ffe3ce1ad495954729fc5f
commit a4c851df0358389970ffe3ce1ad495954729fc5f
Author: goar5670 <mahadelr19@gmail.com>
Date: Thu Mar 2 21:34:44 2023 +0300
parser: Fix parsing closure parameter
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h (Parser::parse_closure_param):
Replace parse_pattern with parse_pattern_no_alt.
gcc/testsuite/ChangeLog:
* rust/compile/closure_no_type_anno.rs: New test.
Signed-off-by: Mahmoud Mohamed <mahadelr19@gmail.com>
Diff:
---
gcc/rust/parse/rust-parse-impl.h | 2 +-
gcc/testsuite/rust/compile/closure_no_type_anno.rs | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index 46704111f37..9b2bea73c99 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -9055,7 +9055,7 @@ Parser<ManagedTokenSource>::parse_closure_param ()
AST::AttrVec outer_attrs = parse_outer_attributes ();
// parse pattern (which is required)
- std::unique_ptr<AST::Pattern> pattern = parse_pattern ();
+ std::unique_ptr<AST::Pattern> pattern = parse_pattern_no_alt ();
if (pattern == nullptr)
{
// not necessarily an error
diff --git a/gcc/testsuite/rust/compile/closure_no_type_anno.rs b/gcc/testsuite/rust/compile/closure_no_type_anno.rs
new file mode 100644
index 00000000000..beade7607f0
--- /dev/null
+++ b/gcc/testsuite/rust/compile/closure_no_type_anno.rs
@@ -0,0 +1,5 @@
+// { dg-additional-options "-fsyntax-only" }
+
+pub fn foo() {
+ let a = |_| 15;
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-05 11:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-05 11:42 [gcc/devel/rust/master] parser: Fix parsing closure parameter Thomas Schwinge
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).