]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-loan-blocks-mut-uniq.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrowck-loan-blocks-mut-uniq.rs
1 fn borrow<F>(v: &isize, f: F) where F: FnOnce(&isize) {
2     f(v);
3 }
4
5
6
7 fn box_imm() {
8     let mut v: Box<_> = Box::new(3);
9     borrow(&*v,
10            |w| { //~ ERROR cannot borrow `v` as mutable
11             v = Box::new(4);
12             assert_eq!(*v, 3);
13             assert_eq!(*w, 4);
14         })
15 }
16
17 fn main() {
18 }