rust/src/test/ui/mut-function-arguments.rs
2019-07-27 18:56:16 +03:00

22 lines
272 B
Rust

// run-pass
#![feature(box_syntax)]
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 37;
frob(w);
}
pub fn main() {
let z = box 17;
f(z);
g();
}