]>
Commit | Line | Data |
---|---|---|
970d7e83 LB |
1 | // Test that certain pattern-match type errors are non-fatal |
2 | ||
3 | enum A { | |
1a4d82fc JJ |
4 | B(isize, isize), |
5 | C(isize, isize, isize), | |
970d7e83 LB |
6 | D |
7 | } | |
8 | ||
9 | struct S { | |
1a4d82fc | 10 | a: isize |
970d7e83 LB |
11 | } |
12 | ||
13 | fn f(_c: char) {} | |
14 | ||
15 | fn main() { | |
1a4d82fc JJ |
16 | match A::B(1, 2) { |
17 | A::B(_, _, _) => (), //~ ERROR this pattern has 3 fields, but | |
e74abb32 | 18 | A::D(_) => (), //~ ERROR expected tuple struct or tuple variant, found unit variant `A::D` |
970d7e83 LB |
19 | _ => () |
20 | } | |
21 | match 'c' { | |
1a4d82fc | 22 | S { .. } => (), |
85aaf69f | 23 | //~^ ERROR mismatched types |
60c5eb7d | 24 | //~| expected `char`, found struct `S` |
1a4d82fc | 25 | |
970d7e83 LB |
26 | _ => () |
27 | } | |
85aaf69f SL |
28 | f(true); |
29 | //~^ ERROR mismatched types | |
60c5eb7d | 30 | //~| expected `char`, found `bool` |
a7813a04 XL |
31 | |
32 | match () { | |
1b1a35ee | 33 | E::V => {} //~ ERROR failed to resolve: use of undeclared type `E` |
a7813a04 | 34 | } |
1a4d82fc | 35 | } |