]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | // run-pass |
0bf4aa26 XL |
2 | #![allow(unused_assignments)] |
3 | #![allow(unused_variables)] | |
b7449926 | 4 | #![allow(non_shorthand_field_patterns)] |
c34b1796 | 5 | |
1a4d82fc | 6 | pub fn main() { |
c34b1796 | 7 | struct Foo { x: isize, y: isize } |
1a4d82fc JJ |
8 | let mut f = Foo { x: 10, y: 0 }; |
9 | match f { | |
10 | Foo { ref mut x, .. } => *x = 11, | |
11 | } | |
12 | match f { | |
13 | Foo { ref x, ref y } => { | |
14 | assert_eq!(f.x, 11); | |
15 | assert_eq!(f.y, 0); | |
970d7e83 | 16 | } |
1a4d82fc JJ |
17 | } |
18 | match f { | |
19 | Foo { mut x, y: ref mut y } => { | |
20 | x = 12; | |
21 | *y = 1; | |
970d7e83 LB |
22 | } |
23 | } | |
1a4d82fc JJ |
24 | assert_eq!(f.x, 11); |
25 | assert_eq!(f.y, 1); | |
223e47cc | 26 | } |