blob: 9303a93d196f5a53a760b6ff3d0208c621d490e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
type rec = {
f: int
};
fn destructure(x: &mut rec) {
match *x {
{f: ref mut f} => *f += 1
}
}
fn main() {
let mut v = {f: 22};
destructure(&mut v);
assert v.f == 23;
}
|