diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-11-23 14:08:50 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-30 12:36:48 +0100 |
commit | a7991de39ff3ef42cd48bb460a02134af73d7b9d (patch) | |
tree | 6ee197e5b667b21b8b9a6a955a04f6c18eb3b097 /gcc | |
parent | 04fd5a043b08fdc4d4e60499b8fd83d02007a737 (diff) | |
download | gcc-a7991de39ff3ef42cd48bb460a02134af73d7b9d.zip gcc-a7991de39ff3ef42cd48bb460a02134af73d7b9d.tar.gz gcc-a7991de39ff3ef42cd48bb460a02134af73d7b9d.tar.bz2 |
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>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/rust/compile/functions_without_body.rs | 21 |
1 files changed, 21 insertions, 0 deletions
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 0000000..36ddea5 --- /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 } +} |