]> git.lizzy.rs Git - rust.git/blob - src/test/ui/binding/match-ref-binding-mut.rs
Add 'src/tools/rust-analyzer/' from commit '977e12a0bdc3e329af179ef3a9d466af9eb613bb'
[rust.git] / src / test / ui / binding / match-ref-binding-mut.rs
1 // run-pass
2 #![allow(non_shorthand_field_patterns)]
3
4 struct Rec {
5     f: isize
6 }
7
8 fn destructure(x: &mut Rec) {
9     match *x {
10       Rec {f: ref mut f} => *f += 1
11     }
12 }
13
14 pub fn main() {
15     let mut v = Rec {f: 22};
16     destructure(&mut v);
17     assert_eq!(v.f, 23);
18 }