]> git.lizzy.rs Git - rust.git/blob - src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs
Test `expect` with `forbid` and fix doc errors (RFC-2383)
[rust.git] / src / test / ui / did_you_mean / issue-43871-enum-instead-of-variant.rs
1 enum Example { Ex(String), NotEx }
2
3 enum Void {}
4
5 enum ManyVariants {
6     One,
7     Two,
8     Three,
9     Four,
10     Five,
11     Six,
12     Seven,
13     Eight,
14     Nine,
15     Ten,
16 }
17
18 fn result_test() {
19     let x = Option(1); //~ ERROR expected function, tuple struct or tuple variant, found enum
20
21     if let Option(_) = x { //~ ERROR expected tuple struct or tuple variant, found enum
22         println!("It is OK.");
23     }
24
25     let y = Example::Ex(String::from("test"));
26
27     if let Example(_) = y { //~ ERROR expected tuple struct or tuple variant, found enum
28         println!("It is OK.");
29     }
30
31     let y = Void(); //~ ERROR expected function, tuple struct or tuple variant, found enum
32
33     let z = ManyVariants(); //~ ERROR expected function, tuple struct or tuple variant, found enum
34 }
35
36 fn main() {}