| 1 |
enum State { |
| 2 |
Succeeded, |
| 3 |
Failed, |
| 4 |
} |
| 5 |
|
| 6 |
fn print_on_failure(state: &State) { |
| 7 |
let mut num = 0; |
| 8 |
match *state { |
| 9 |
// error: expected unit struct, unit variant or constant, found tuple |
| 10 |
// variant `State::Failed` |
| 11 |
State::Failed => { |
| 12 |
num = 1; |
| 13 |
} |
| 14 |
State::Succeeded => { |
| 15 |
num = 2; |
| 16 |
} |
| 17 |
_ => (), |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
fn main() { |
| 22 |
let b = State::Failed(1); |
| 23 |
// { dg-error "expected function, tuple struct or tuple variant, found struct .State." "" { target *-*-* } .-1 } |
| 24 |
|
| 25 |
print_on_failure(&b); |
| 26 |
// { dg-error "cannot find value .b. in this scope" "" { target *-*-* } .-1 } |
| 27 |
} |