From: Kushal Pal <kushalpal...@gmail.com>

Fixes #2788

gcc/rust/ChangeLog:

        * parse/rust-parse-impl.h (Parser::parse_inherent_impl_item):
        Added switch-case for ASYNC token.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Kushal Pal <kushalpal...@gmail.com>
---
 gcc/rust/parse/rust-parse-impl.h         |  1 +
 gcc/testsuite/rust/compile/issue-2788.rs | 10 ++++++++++
 2 files changed, 11 insertions(+)
 create mode 100644 gcc/testsuite/rust/compile/issue-2788.rs

diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index 3055a3959cf..c14c75ce70d 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -5600,6 +5600,7 @@ Parser<ManagedTokenSource>::parse_inherent_impl_item ()
            return nullptr;
          }
       }
+    case ASYNC:
     case EXTERN_KW:
     case UNSAFE:
     case FN_KW:
diff --git a/gcc/testsuite/rust/compile/issue-2788.rs 
b/gcc/testsuite/rust/compile/issue-2788.rs
new file mode 100644
index 00000000000..b3828fca6cb
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-2788.rs
@@ -0,0 +1,10 @@
+// { dg-additional-options "-frust-compile-until=lowering" }
+struct Foo {
+    arg_1: u32,
+    arg_2: i32,
+}
+
+impl Foo {
+    async fn asynchronous_function_1(&self) {}
+    async fn asynchronous_function_2() {}
+}
-- 
2.42.1

Reply via email to