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

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