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 { fail!() }
21 fn for_func(_f: || -> bool) { fail!() }
22 fn produce<T>() -> T { fail!(); }
24 fn inc(v: &mut Box<int>) {
28 fn pre_freeze_cond() {
29 // In this instance, the freeze is conditional and starts before
37 borrow_mut(v); //~ ERROR cannot borrow
40 fn pre_freeze_else() {
41 // In this instance, the freeze and mut borrow are on separate sides