[COMMITTED,054/101] gccrs: Add a regression test for async const functions

Message ID 20240130121026.807464-57-arthur.cohen@embecosm.com
State Committed
Commit ac501a75b263a7dd7fa437c01aae53d41e30a515
Headers
Series [COMMITTED,001/101] gccrs: Add visibility to trait item |

Commit Message

Arthur Cohen Jan. 30, 2024, 12:07 p.m. UTC
  From: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

Functions that are both async and const shall be rejected during the
AST validation pass. This new test highlight this behavior.

gcc/testsuite/ChangeLog:

	* rust/compile/const_async_function.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
---
 gcc/testsuite/rust/compile/const_async_function.rs | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 gcc/testsuite/rust/compile/const_async_function.rs
  

Patch

diff --git a/gcc/testsuite/rust/compile/const_async_function.rs b/gcc/testsuite/rust/compile/const_async_function.rs
new file mode 100644
index 00000000000..fb1c4dd4c1d
--- /dev/null
+++ b/gcc/testsuite/rust/compile/const_async_function.rs
@@ -0,0 +1,3 @@ 
+// { dg-additional-options "-frust-edition=2018" }
+const async fn weird_function() {}
+// { dg-error "functions cannot be both .const. and .async." "" { target *-*-* } .-1 }