From: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@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.pa...@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

Reply via email to