1 // Test that we detect nested calls that could free pointers evaluated
2 // for earlier arguments.
6 fn rewrite(v: &mut Box<usize>) -> usize {
11 fn add(v: &usize, w: usize) -> usize {
16 let mut a: Box<_> = Box::new(1);
18 // Note the danger here:
20 // the pointer for the first argument has already been
21 // evaluated, but it gets freed when evaluating the second
25 rewrite(&mut a)); //~ ERROR cannot borrow
29 let mut a: Box<_> = Box::new(1);
32 rewrite(&mut a)); //~ ERROR cannot borrow