]>
git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/borrowck/borrowck-uniq-via-lend.rs
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 #![feature(box_syntax)]
13 fn borrow(_v
: &isize) {}
16 let mut v
: Box
<_
> = box 3;
21 struct F { f: Box<isize> }
22 let mut v
= F {f: box 3}
;
29 struct H { h: Box<isize> }
30 let mut v
= F {f: G {g: H {h: box 3}
}};
35 let mut v
: Box
<_
> = box 3;
41 let mut v
: Box
<_
> = box 3;
43 borrow(&*v
); //~ ERROR cannot borrow `*v`
47 let mut v
: Box
<_
> = box 3;
48 let mut w
: Box
<_
> = box 4;
53 fn aliased_other_reassign() {
54 let mut v
: Box
<_
> = box 3;
55 let mut w
: Box
<_
> = box 4;
58 borrow(&*v
); //~ ERROR cannot borrow `*v`