]> git.lizzy.rs Git - rust.git/blob - src/test/ui/binding/match-ref-binding-mut.rs
Rollup merge of #104822 - spastorino:selctx-new-instead-of-with_query_mode, r=lcnr
[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 }