]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Handle `async` keyword for regular implementations
authorKushal Pal <kushalpal109@gmail.com>
Sat, 6 Jan 2024 05:59:14 +0000 (11:29 +0530)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 30 Jan 2024 11:36:51 +0000 (12:36 +0100)
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 <kushalpal109@gmail.com>
gcc/rust/parse/rust-parse-impl.h
gcc/testsuite/rust/compile/issue-2788.rs [new file with mode: 0644]

index 3055a3959cff120addad6ebd412530a266006097..c14c75ce70dc2f4f35fc1bdace02f992e47ff8fb 100644 (file)
@@ -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 (file)
index 0000000..b3828fc
--- /dev/null
@@ -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() {}
+}