]> git.lizzy.rs Git - rust.git/blob - src/test/ui/binding/bind-field-short-with-modifiers.rs
Merge commit '5988bbd24aa87732bfa1d111ba00bcdaa22c481a' into sync_cg_clif-2020-11-27
[rust.git] / src / test / ui / binding / bind-field-short-with-modifiers.rs
1 // run-pass
2 #![allow(unused_assignments)]
3 #![allow(unused_variables)]
4 #![allow(non_shorthand_field_patterns)]
5
6 pub fn main() {
7     struct Foo { x: isize, y: isize }
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);
16         }
17     }
18     match f {
19         Foo { mut x, y: ref mut y } => {
20             x = 12;
21             *y = 1;
22         }
23     }
24     assert_eq!(f.x, 11);
25     assert_eq!(f.y, 1);
26 }