1 // Copyright 2014 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.
12 let mut vec = [~1, ~2, ~3];
15 vec[0] = ~4; //~ ERROR cannot assign
21 let mut vec = ~[~1, ~2, ~3];
22 let vec: &mut [~int] = vec;
25 vec[0] = ~4; //~ ERROR cannot assign
31 let mut vec = ~[~1, ~2, ~3];
32 let vec: &mut [~int] = vec;
35 //~^ ERROR cannot move out
37 // Note: `_a` is *moved* here, but `b` is borrowing,
40 // See comment in middle/borrowck/gather_loans/mod.rs
41 // in the case covering these sorts of vectors.
45 let a = vec[0]; //~ ERROR cannot move out
49 let mut vec = ~[~1, ~2, ~3];
50 let vec: &mut [~int] = vec;
53 //~^ ERROR cannot move out
57 let a = vec[0]; //~ ERROR cannot move out
61 let mut vec = ~[~1, ~2, ~3];
62 let vec: &mut [~int] = vec;
64 [_a, _b, _c] => {} //~ ERROR cannot move out
65 //~^ ERROR cannot move out
66 //~^^ ERROR cannot move out
69 let a = vec[0]; //~ ERROR cannot move out