]> git.lizzy.rs Git - rust.git/blob - src/test/ui/pattern/pattern-error-continue.rs
f21da3b55dc35e05c10a94a820366cbf16dfdf2b
[rust.git] / src / test / ui / pattern / pattern-error-continue.rs
1 // Test that certain pattern-match type errors are non-fatal
2
3 enum A {
4     B(isize, isize),
5     C(isize, isize, isize),
6     D
7 }
8
9 struct S {
10     a: isize
11 }
12
13 fn f(_c: char) {}
14
15 fn main() {
16     match A::B(1, 2) {
17         A::B(_, _, _) => (), //~ ERROR this pattern has 3 fields, but
18         A::D(_) => (), //~ ERROR expected tuple struct or tuple variant, found unit variant `A::D`
19         _ => ()
20     }
21     match 'c' {
22         S { .. } => (),
23         //~^ ERROR mismatched types
24         //~| expected char, found struct `S`
25         //~| expected type `char`
26         //~| found struct `S`
27
28         _ => ()
29     }
30     f(true);
31     //~^ ERROR mismatched types
32     //~| expected char, found bool
33
34     match () {
35         E::V => {} //~ ERROR failed to resolve: use of undeclared type or module `E`
36     }
37 }