[gcc r14-8588] gccrs: Add a regression test for function body check
Arthur Cohen
cohenarthur@gcc.gnu.org
Tue Jan 30 11:59:42 GMT 2024
https://gcc.gnu.org/g:a7991de39ff3ef42cd48bb460a02134af73d7b9d
commit r14-8588-ga7991de39ff3ef42cd48bb460a02134af73d7b9d
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date: Thu Nov 23 14:08:50 2023 +0100
gccrs: Add a regression test for function body check
Function body check emit an error message when a required function body
is missing.
gcc/testsuite/ChangeLog:
* rust/compile/functions_without_body.rs: New test.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diff:
---
.../rust/compile/functions_without_body.rs | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/gcc/testsuite/rust/compile/functions_without_body.rs b/gcc/testsuite/rust/compile/functions_without_body.rs
new file mode 100644
index 000000000000..36ddea52161e
--- /dev/null
+++ b/gcc/testsuite/rust/compile/functions_without_body.rs
@@ -0,0 +1,21 @@
+struct MyStruct;
+
+trait X {}
+
+fn test_a();
+// { dg-error "free function without a body" "" { target *-*-* } .-1 }
+
+impl MyStruct {
+ fn test_b<T>()
+ // { dg-error "associated function in .impl. without body" "" { target *-*-* } .-1 }
+ where
+ T: Copy;
+
+ fn test_c<T>();
+ // { dg-error "associated function in .impl. without body" "" { target *-*-* } .-1 }
+}
+
+impl X for MyStruct {
+ fn test_d();
+ // { dg-error "associated function in .impl. without body" "" { target *-*-* } .-1 }
+}
More information about the Gcc-cvs
mailing list