]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.rs
Unit test from #57866.
[rust.git] / src / test / ui / borrowck / borrowck-loan-blocks-mut-uniq.rs
1 #![feature(box_syntax)]
2
3 fn borrow<F>(v: &isize, f: F) where F: FnOnce(&isize) {
4     f(v);
5 }
6
7 fn box_imm() {
8     let mut v: Box<_> = box 3;
9     borrow(&*v,
10            |w| { //~ ERROR cannot borrow `v` as mutable
11             v = box 4;
12             assert_eq!(*v, 3);
13             assert_eq!(*w, 4);
14         })
15 }
16
17 fn main() {
18 }