]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mut-function-arguments.rs
Merge commit 'd3a2366ee877075c59b38bd8ced55f224fc7ef51' into sync_cg_clif-2022-07-26
[rust.git] / src / test / ui / mut-function-arguments.rs
1 // run-pass
2
3 fn f(mut y: Box<isize>) {
4     *y = 5;
5     assert_eq!(*y, 5);
6 }
7
8 fn g() {
9     let frob = |mut q: Box<isize>| { *q = 2; assert_eq!(*q, 2); };
10     let w = Box::new(37);
11     frob(w);
12
13 }
14
15 pub fn main() {
16     let z = Box::new(17);
17     f(z);
18     g();
19 }