fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.0 KiB44 linesraw
1// run-rustfix
2
3#![allow(unused)]
4
5use Foo::{FooB, FooA};
6
7enum Foo {
8    FooA { opt_x: Option<i32>, y: i32 },
9    FooB { x: i32, y: i32 }
10}
11
12fn main() {
13    let f = FooB { x: 3, y: 4 };
14
15    match f {
16        FooB { x: a, y: b } => println!("{} {}", a, b),
17        //~^ ERROR expected tuple struct or tuple variant, found variant `FooB`
18        _ => (),
19    }
20
21    match f {
22        FooB { x, y } => println!("{} {}", x, y),
23        //~^ ERROR expected tuple struct or tuple variant, found variant `FooB`
24        _ => (),
25    }
26
27    match f {
28        FooA { opt_x: Some(x), y } => println!("{} {}", x, y),
29        //~^ ERROR expected tuple struct or tuple variant, found variant `FooA`
30        _ => (),
31    }
32
33    match f {
34        FooB { x: a, y: _ } => println!("{}", a),
35        //~^ ERROR expected tuple struct or tuple variant, found variant `FooB`
36        _ => (),
37    }
38
39    match f {
40        FooB { x, y } => (),
41        //~^ ERROR expected tuple struct or tuple variant, found variant `FooB`
42        _ => (),
43    }
44}