diff options
Diffstat (limited to 'gcc/testsuite/rust/compile/match-tuplestructpattern-err.rs')
| -rw-r--r-- | gcc/testsuite/rust/compile/match-tuplestructpattern-err.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/match-tuplestructpattern-err.rs b/gcc/testsuite/rust/compile/match-tuplestructpattern-err.rs new file mode 100644 index 0000000..efd1a89 --- /dev/null +++ b/gcc/testsuite/rust/compile/match-tuplestructpattern-err.rs @@ -0,0 +1,14 @@ +fn main() { + struct A (i32, i32); + let a = A (0, 1); + + match a { + A (1, 2, 3, 4) => {}, + // { dg-error "this pattern has 4 fields but the corresponding tuple variant has 2 fields .E0023." "" { target *-*-* } .-1 } + A (1, 2, .., 3, 4) => {}, + // { dg-error "this pattern has 4 fields but the corresponding tuple variant has 2 fields .E0023." "" { target *-*-* } .-1 } + A (.., 3, 4, 5) => {}, + // { dg-error "this pattern has 3 fields but the corresponding tuple variant has 2 fields .E0023." "" { target *-*-* } .-1 } + _ => {} + } +}
\ No newline at end of file |
