1 #![feature(box_patterns)]
5 let mut vec = [Box::new(1), Box::new(2), Box::new(3)];
7 [box ref _a, _, _] => {
8 //~^ NOTE borrow of `vec[_]` occurs here
9 vec[0] = Box::new(4); //~ ERROR cannot assign
10 //~^ NOTE assignment to borrowed `vec[_]` occurs here
12 //~^ NOTE borrow later used here
18 let mut vec = vec![Box::new(1), Box::new(2), Box::new(3)];
19 let vec: &mut [Box<isize>] = &mut vec;
21 &mut [ref _b @ ..] => {
22 //~^ borrow of `vec[_]` occurs here
23 vec[0] = Box::new(4); //~ ERROR cannot assign
24 //~^ NOTE assignment to borrowed `vec[_]` occurs here
26 //~^ NOTE borrow later used here
32 let mut vec = vec![Box::new(1), Box::new(2), Box::new(3)];
33 let vec: &mut [Box<isize>] = &mut vec;
35 //~^ ERROR cannot move out
36 //~| NOTE cannot move out
38 //~^ NOTE data moved here
39 //~| NOTE move occurs because `_a` has type
40 //~| HELP consider removing the `&mut`
46 let a = vec[0]; //~ ERROR cannot move out
47 //~| NOTE cannot move out of here
48 //~| NOTE move occurs because
49 //~| HELP consider borrowing here
53 let mut vec = vec![Box::new(1), Box::new(2), Box::new(3)];
54 let vec: &mut [Box<isize>] = &mut vec;
56 //~^ ERROR cannot move out
57 //~| NOTE cannot move out
59 //~^ HELP consider removing the `&mut`
61 //~^ NOTE data moved here
62 //~| NOTE move occurs because `_b` has type
65 let a = vec[0]; //~ ERROR cannot move out
66 //~| NOTE cannot move out of here
67 //~| NOTE move occurs because
68 //~| HELP consider borrowing here
72 let mut vec = vec![Box::new(1), Box::new(2), Box::new(3)];
73 let vec: &mut [Box<isize>] = &mut vec;
75 //~^ ERROR cannot move out
76 //~| NOTE cannot move out
77 //~| NOTE move occurs because these variables have types
78 &mut [_a, _b, _c] => {}
79 //~^ NOTE data moved here
82 //~| HELP consider removing the `&mut`
85 let a = vec[0]; //~ ERROR cannot move out
86 //~| NOTE cannot move out of here
87 //~| NOTE move occurs because
88 //~| HELP consider borrowing here
93 trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
94 impl<T> Fake for T { }