1 #![feature(box_patterns)]
2 #![feature(box_syntax)]
3 #![feature(slice_patterns)]
6 let mut vec
= [box 1, box 2, box 3];
8 [box ref _a
, _
, _
] => {
9 //~^ NOTE borrow of `vec[_]` occurs here
10 vec
[0] = box 4; //~ ERROR cannot assign
11 //~^ NOTE assignment to borrowed `vec[_]` occurs here
13 //~^ NOTE borrow later used here
19 let mut vec
= vec
![box 1, box 2, box 3];
20 let vec
: &mut [Box
<isize>] = &mut vec
;
22 &mut [ref _b @
..] => {
23 //~^ borrow of `vec[_]` occurs here
24 vec
[0] = box 4; //~ ERROR cannot assign
25 //~^ NOTE assignment to borrowed `vec[_]` occurs here
27 //~^ NOTE borrow later used here
33 let mut vec
= vec
![box 1, box 2, box 3];
34 let vec
: &mut [Box
<isize>] = &mut vec
;
36 //~^ ERROR cannot move out
37 //~| NOTE cannot move out
39 //~^ NOTE data moved here
40 //~| NOTE move occurs because `_a` has type
41 //~| HELP consider removing the `&mut`
47 let a
= vec
[0]; //~ ERROR cannot move out
48 //~| NOTE cannot move out of here
49 //~| NOTE move occurs because
50 //~| HELP consider borrowing here
54 let mut vec
= vec
![box 1, box 2, box 3];
55 let vec
: &mut [Box
<isize>] = &mut vec
;
57 //~^ ERROR cannot move out
58 //~| NOTE cannot move out
60 //~^ HELP consider removing the `&mut`
62 //~^ NOTE data moved here
63 //~| NOTE move occurs because `_b` has type
66 let a
= vec
[0]; //~ ERROR cannot move out
67 //~| NOTE cannot move out of here
68 //~| NOTE move occurs because
69 //~| HELP consider borrowing here
73 let mut vec
= vec
![box 1, box 2, box 3];
74 let vec
: &mut [Box
<isize>] = &mut vec
;
76 //~^ ERROR cannot move out
77 //~| NOTE cannot move out
78 //~| NOTE move occurs because these variables have types
79 &mut [_a
, _b
, _c
] => {}
80 //~^ NOTE data moved here
83 //~| HELP consider removing the `&mut`
86 let a
= vec
[0]; //~ ERROR cannot move out
87 //~| NOTE cannot move out of here
88 //~| NOTE move occurs because
89 //~| HELP consider borrowing here
94 trait Fake { fn use_mut(&mut self) { }
fn use_ref(&self) { }
}
95 impl<T
> Fake
for T { }