1 // Note: the borrowck analysis is currently flow-insensitive.
2 // Therefore, some of these errors are marked as spurious and could be
3 // corrected by a simple change to the analysis. The others are
4 // either genuine or would require more advanced changes. The latter
9 fn borrow(_v: &isize) {}
10 fn borrow_mut(_v: &mut isize) {}
11 fn cond() -> bool { panic!() }
12 fn for_func<F>(_f: F) where F: FnOnce() -> bool { panic!() }
13 fn produce<T>() -> T { panic!(); }
15 fn inc(v: &mut Box<isize>) {
16 *v = Box::new(**v + 1);
19 fn pre_freeze_cond() {
20 // In this instance, the freeze is conditional and starts before
24 let mut v: Box<_> = Box::new(3);
29 borrow_mut(&mut *v); //~ ERROR cannot borrow
33 fn pre_freeze_else() {
34 // In this instance, the freeze and mut borrow are on separate sides
38 let mut v: Box<_> = Box::new(3);
50 trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
51 impl<T> Fake for T { }