1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Note: the borrowck analysis is currently flow-insensitive.
12 // Therefore, some of these errors are marked as spurious and could be
13 // corrected by a simple change to the analysis. The others are
14 // either genuine or would require more advanced changes. The latter
18 fn borrow(_v: &int) {}
19 fn borrow_mut(_v: &mut int) {}
20 fn cond() -> bool { panic!() }
21 fn for_func<F>(_f: F) where F: FnOnce() -> bool { panic!() }
22 fn produce<T>() -> T { panic!(); }
24 fn inc(v: &mut Box<int>) {
29 // In this instance, the freeze starts before the mut borrow.
33 borrow_mut(&mut *v); //~ ERROR cannot borrow
37 // In this instance, the const alias starts after the borrow.