blob: dcf86db561614018814ebe0bfa74ec9f72d91fb3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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 }
}
|