Sign in
rust
/
rust
/
52dff85c4e5b68b8a5a871cf7a35b1bf9cbb5028
/
.
/
tests
/
ui
/
binding
/
match-ref-binding-mut.rs
blob: ab48148083260c92cb2eca580854524e0f8498ea [
file
]
//@ run-pass
#![
allow
(
non_shorthand_field_patterns
)]
struct
Rec
{
f
:
isize
}
fn
destructure
(
x
:
&
mut
Rec
)
{
match
*
x
{
Rec
{
f
:
ref
mut
f
}
=>
*
f
+=
1
}
}
pub
fn
main
()
{
let
mut
v
=
Rec
{
f
:
22
};
destructure
(&
mut
v
);
assert_eq
!(
v
.
f
,
23
);
}