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

arthur.cohen@embecosm.com arthur.cohen@embecosm.com
Tue Jan 30 12:07:10 GMT 2024


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

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 }
-- 
2.42.1



More information about the Gcc-rust mailing list