summary refs log tree commit diff
path: root/tests/ui/mut-function-arguments.rs
blob: 01c264fce0389d215589e670d3a57c201d99b9b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//@ run-pass

fn f(mut y: Box<isize>) {
    *y = 5;
    assert_eq!(*y, 5);
}

fn g() {
    let frob = |mut q: Box<isize>| { *q = 2; assert_eq!(*q, 2); };
    let w = Box::new(37);
    frob(w);

}

pub fn main() {
    let z = Box::new(17);
    f(z);
    g();
}