1 error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
2 --> $DIR/borrowck-closures-slice-patterns.rs:7:13
5 | -- immutable borrow occurs here
6 LL | let [ref y, ref z @ ..] = x;
7 | - first borrow occurs due to use of `x` in closure
10 | ^^^^^^ mutable borrow occurs here
13 | - immutable borrow later used here
15 error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
16 --> $DIR/borrowck-closures-slice-patterns.rs:16:13
19 | -- mutable borrow occurs here
20 LL | let [ref mut y, ref mut z @ ..] = x;
21 | - first borrow occurs due to use of `x` in closure
24 | ^^ immutable borrow occurs here
27 | - mutable borrow later used here
29 error[E0382]: borrow of moved value: `x`
30 --> $DIR/borrowck-closures-slice-patterns.rs:25:5
32 LL | fn arr_by_move(x: [String; 3]) {
33 | - move occurs because `x` has type `[String; 3]`, which does not implement the `Copy` trait
35 | -- value moved into closure here
36 LL | let [y, z @ ..] = x;
37 | - variable moved due to use in closure
40 | ^^ value borrowed here after move
42 error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
43 --> $DIR/borrowck-closures-slice-patterns.rs:33:13
46 | -- immutable borrow occurs here
47 LL | let [ref y, ref z @ ..] = *x;
48 | -- first borrow occurs due to use of `x` in closure
51 | ^^^^^^^ mutable borrow occurs here
54 | - immutable borrow later used here
56 error[E0501]: cannot borrow `x` as immutable because previous closure requires unique access
57 --> $DIR/borrowck-closures-slice-patterns.rs:42:13
60 | -- closure construction occurs here
61 LL | let [ref mut y, ref mut z @ ..] = *x;
62 | -- first borrow occurs due to use of `x` in closure
65 | ^^ second borrow occurs here
68 | - first borrow later used here
70 error[E0382]: borrow of moved value: `x`
71 --> $DIR/borrowck-closures-slice-patterns.rs:51:5
73 LL | fn arr_box_by_move(x: Box<[String; 3]>) {
74 | - move occurs because `x` has type `Box<[String; 3]>`, which does not implement the `Copy` trait
76 | -- value moved into closure here
77 LL | let [y, z @ ..] = *x;
78 | -- variable moved due to use in closure
81 | ^^ value borrowed here after move
83 error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
84 --> $DIR/borrowck-closures-slice-patterns.rs:59:13
87 | -- immutable borrow occurs here
88 LL | if let [ref y, ref z @ ..] = *x {}
89 | -- first borrow occurs due to use of `x` in closure
92 | ^^^^^^^ mutable borrow occurs here
95 | - immutable borrow later used here
97 error[E0501]: cannot borrow `x` as immutable because previous closure requires unique access
98 --> $DIR/borrowck-closures-slice-patterns.rs:68:13
100 LL | let mut f = || {
101 | -- closure construction occurs here
102 LL | if let [ref mut y, ref mut z @ ..] = *x {}
103 | -- first borrow occurs due to use of `x` in closure
106 | ^^ second borrow occurs here
109 | - first borrow later used here
111 error: aborting due to 8 previous errors
113 Some errors have detailed explanations: E0382, E0501, E0502.
114 For more information about an error, try `rustc --explain E0382`.