summary refs log tree commit diff
path: root/src/test/run-pass/expr-copy.rs
blob: 279e916b75ad2d3f93f1854e6a329a99ae10d828 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
fn f(arg: {mut a: int}) {
    arg.a = 100;
}

fn main() {
    let x = {mut a: 10};
    f(x);
    assert x.a == 100;
    x.a = 20;
    f(copy x);
    assert x.a == 20;
}