diff options
Diffstat (limited to 'gcc/testsuite/rust/compile/issue-3140.rs')
-rw-r--r-- | gcc/testsuite/rust/compile/issue-3140.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/issue-3140.rs b/gcc/testsuite/rust/compile/issue-3140.rs new file mode 100644 index 0000000..dcf86db --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3140.rs @@ -0,0 +1,27 @@ +enum State { + Succeeded, + Failed, +} + +fn print_on_failure(state: &State) { + let mut num = 0; + match *state { + // error: expected unit struct, unit variant or constant, found tuple + // variant `State::Failed` + State::Failed => { + num = 1; + } + State::Succeeded => { + num = 2; + } + _ => (), + } +} + +fn main() { + let b = State::Failed(1); + // { dg-error "expected function, tuple struct or tuple variant, found struct .State." "" { target *-*-* } .-1 } + + print_on_failure(&b); + // { dg-error "cannot find value .b. in this scope" "" { target *-*-* } .-1 } +} |