]> git.lizzy.rs Git - rust.git/blob - src/test/ui/pattern/pattern-error-continue.rs
Auto merge of #100845 - timvermeulen:iter_compare, r=scottmcm
[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
26         _ => ()
27     }
28     f(true);
29     //~^ ERROR mismatched types
30     //~| expected `char`, found `bool`
31
32     match () {
33         E::V => {} //~ ERROR failed to resolve: use of undeclared type `E`
34     }
35 }