]> git.lizzy.rs Git - rust.git/blob - src/test/ui/structs-enums/struct-like-variant-match.rs
Pin panic-in-drop=abort test to old pass manager
[rust.git] / src / test / ui / structs-enums / struct-like-variant-match.rs
1 // run-pass
2 #![allow(non_shorthand_field_patterns)]
3
4 enum Foo {
5     Bar {
6         x: isize,
7         y: isize
8     },
9     Baz {
10         x: f64,
11         y: f64
12     }
13 }
14
15 fn f(x: &Foo) {
16     match *x {
17         Foo::Baz { x: x, y: y } => {
18             assert_eq!(x, 1.0);
19             assert_eq!(y, 2.0);
20         }
21         Foo::Bar { y: y, x: x } => {
22             assert_eq!(x, 1);
23             assert_eq!(y, 2);
24         }
25     }
26 }
27
28 pub fn main() {
29     let x = Foo::Bar { x: 1, y: 2 };
30     f(&x);
31     let y = Foo::Baz { x: 1.0, y: 2.0 };
32     f(&y);
33 }