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
7 #![feature(box_syntax)]
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>) {
20 // In this instance, the freeze starts before the mut borrow.
22 let mut v
: Box
<_
> = box 3;
24 borrow_mut(&mut *v
); //~ ERROR cannot borrow
29 // In this instance, the const alias starts after the borrow.
31 let mut v
: Box
<_
> = box 3;
38 trait Fake { fn use_mut(&mut self) { }
fn use_ref(&self) { }
}
39 impl<T
> Fake
for T { }