summaryrefslogtreecommitdiffstats
path: root/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs
blob: 9602d27469427274afda589271d4787b5be8b47f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
enum Example { Ex(String), NotEx }

enum Void {}

enum ManyVariants {
    One,
    Two,
    Three,
    Four,
    Five,
    Six,
    Seven,
    Eight,
    Nine,
    Ten,
}

fn result_test() {
    let x = Option(1); //~ ERROR expected function, tuple struct or tuple variant, found enum

    if let Option(_) = x { //~ ERROR expected tuple struct or tuple variant, found enum
        println!("It is OK.");
    }

    let y = Example::Ex(String::from("test"));

    if let Example(_) = y { //~ ERROR expected tuple struct or tuple variant, found enum
        println!("It is OK.");
    }

    let y = Void(); //~ ERROR expected function, tuple struct or tuple variant, found enum

    let z = ManyVariants(); //~ ERROR expected function, tuple struct or tuple variant, found enum
}

fn main() {}