diff options
Diffstat (limited to 'gcc/testsuite/rust/compile/match-tuplestructpattern-non-variant.rs')
| -rw-r--r-- | gcc/testsuite/rust/compile/match-tuplestructpattern-non-variant.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/match-tuplestructpattern-non-variant.rs b/gcc/testsuite/rust/compile/match-tuplestructpattern-non-variant.rs new file mode 100644 index 0000000..cf751cb --- /dev/null +++ b/gcc/testsuite/rust/compile/match-tuplestructpattern-non-variant.rs @@ -0,0 +1,20 @@ +enum Empty {} +enum NonEmpty { + Foo(i32), +} + +fn f(e: Empty) { + match e { + Empty(0) => {} // { dg-error "expected tuple struct or tuple variant, found enum 'Empty'" } + } + + match e { + Empty(Empty(..)) => {} // { dg-error "expected tuple struct or tuple variant, found enum 'Empty'" } + } +} + +fn g(e: NonEmpty) { + match e { + NonEmpty(0) => {} // { dg-error "expected tuple struct or tuple variant, found enum 'NonEmpty'" } + } +} |
