]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Handle `async` keyword for regular implementations
authorKushal Pal <kushalpal109@gmail.com>
Sat, 6 Jan 2024 05:59:14 +0000 (11:29 +0530)
committerP-E-P <32375388+P-E-P@users.noreply.github.com>
Wed, 17 Jan 2024 13:24:04 +0000 (13:24 +0000)
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 54885221e18d125943540a76275836af08e308d4..bb00460bd324d0f5a88e1d72fd5b5809efc16f15 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() {}
+}