Skip to content

Commit

Permalink
Handle async keyword for regular implementations
Browse files Browse the repository at this point in the history
Fixes Rust-GCC#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 <[email protected]>
  • Loading branch information
braw-lee authored and P-E-P committed Jan 17, 2024
1 parent 6d85a80 commit 0cd26bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions gcc/rust/parse/rust-parse-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5600,6 +5600,7 @@ Parser<ManagedTokenSource>::parse_inherent_impl_item ()
return nullptr;
}
}
case ASYNC:
case EXTERN_KW:
case UNSAFE:
case FN_KW:
Expand Down
10 changes: 10 additions & 0 deletions gcc/testsuite/rust/compile/issue-2788.rs
Original file line number Diff line number Diff line change
@@ -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() {}
}

0 comments on commit 0cd26bd

Please sign in to comment.