]>
Commit | Line | Data |
---|---|---|
74b04a01 | 1 | error: cannot borrow value as mutable because it is also borrowed as immutable |
94222f64 | 2 | --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:36:9 |
74b04a01 XL |
3 | | |
4 | LL | ref foo @ [.., ref mut bar] => (), | |
5 | | -------^^^^^^^^-----------^ | |
6 | | | | | |
7 | | | mutable borrow, by `bar`, occurs here | |
8 | | immutable borrow, by `foo`, occurs here | |
9 | ||
10 | error: cannot borrow value as mutable because it is also borrowed as immutable | |
94222f64 | 11 | --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:120:9 |
74b04a01 XL |
12 | | |
13 | LL | ref foo @ Some(box ref mut s) => (), | |
14 | | -------^^^^^^^^^^^^---------^ | |
15 | | | | | |
16 | | | mutable borrow, by `s`, occurs here | |
17 | | immutable borrow, by `foo`, occurs here | |
18 | ||
19 | error[E0382]: borrow of moved value: `x` | |
94222f64 | 20 | --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:18:5 |
74b04a01 XL |
21 | | |
22 | LL | fn bindings_after_at_slice_patterns_move_binding(x: [String; 4]) { | |
1b1a35ee | 23 | | - move occurs because `x` has type `[String; 4]`, which does not implement the `Copy` trait |
74b04a01 XL |
24 | LL | match x { |
25 | LL | a @ [.., _] => (), | |
26 | | ----------- value moved here | |
27 | ... | |
28 | LL | &x; | |
29 | | ^^ value borrowed here after move | |
30 | ||
31 | error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable | |
94222f64 | 32 | --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:28:5 |
74b04a01 XL |
33 | | |
34 | LL | ref mut foo @ [.., _] => Some(foo), | |
35 | | --------------------- mutable borrow occurs here | |
36 | ... | |
37 | LL | &x; | |
38 | | ^^ immutable borrow occurs here | |
39 | ... | |
40 | LL | drop(r); | |
41 | | - mutable borrow later used here | |
42 | ||
43 | error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable | |
94222f64 | 44 | --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:50:5 |
74b04a01 XL |
45 | | |
46 | LL | [ref foo @ .., ref bar] => Some(foo), | |
47 | | ------------ immutable borrow occurs here | |
48 | ... | |
49 | LL | &mut x; | |
50 | | ^^^^^^ mutable borrow occurs here | |
51 | ... | |
52 | LL | drop(r); | |
53 | | - immutable borrow later used here | |
54 | ||
55 | error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable | |
94222f64 | 56 | --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:62:5 |
74b04a01 XL |
57 | | |
58 | LL | ref foo @ [.., ref bar] => Some(foo), | |
59 | | ----------------------- immutable borrow occurs here | |
60 | ... | |
61 | LL | &mut x; | |
62 | | ^^^^^^ mutable borrow occurs here | |
63 | ... | |
64 | LL | drop(r); | |
65 | | - immutable borrow later used here | |
66 | ||
67 | error[E0382]: borrow of moved value: `x` | |
94222f64 | 68 | --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:76:5 |
74b04a01 XL |
69 | | |
70 | LL | fn bindings_after_at_or_patterns_move(x: Option<Test>) { | |
1b1a35ee | 71 | | - move occurs because `x` has type `Option<Test>`, which does not implement the `Copy` trait |
74b04a01 XL |
72 | LL | match x { |
73 | LL | foo @ Some(Test::Foo | Test::Bar) => (), | |
74 | | --------------------------------- | |
75 | | | | |
76 | | value moved here | |
77 | | value moved here | |
78 | ... | |
79 | LL | &x; | |
80 | | ^^ value borrowed here after move | |
81 | ||
82 | error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable | |
94222f64 | 83 | --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:86:5 |
74b04a01 XL |
84 | | |
85 | LL | ref foo @ Some(Test::Foo | Test::Bar) => Some(foo), | |
86 | | ------------------------------------- immutable borrow occurs here | |
87 | ... | |
88 | LL | &mut x; | |
89 | | ^^^^^^ mutable borrow occurs here | |
90 | ... | |
91 | LL | drop(r); | |
92 | | - immutable borrow later used here | |
93 | ||
94 | error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable | |
94222f64 | 95 | --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:98:5 |
74b04a01 XL |
96 | | |
97 | LL | ref mut foo @ Some(Test::Foo | Test::Bar) => Some(foo), | |
98 | | ----------------------------------------- mutable borrow occurs here | |
99 | ... | |
100 | LL | &x; | |
101 | | ^^ immutable borrow occurs here | |
102 | ... | |
103 | LL | drop(r); | |
104 | | - mutable borrow later used here | |
105 | ||
106 | error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable | |
94222f64 | 107 | --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:112:5 |
74b04a01 XL |
108 | | |
109 | LL | ref foo @ Some(box ref s) => Some(foo), | |
110 | | ------------------------- immutable borrow occurs here | |
111 | ... | |
112 | LL | &mut x; | |
113 | | ^^^^^^ mutable borrow occurs here | |
114 | ... | |
115 | LL | drop(r); | |
116 | | - immutable borrow later used here | |
117 | ||
118 | error[E0382]: borrow of moved value: `x` | |
94222f64 | 119 | --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:134:5 |
74b04a01 XL |
120 | | |
121 | LL | fn bindings_after_at_slice_patterns_or_patterns_moves(x: [Option<Test>; 4]) { | |
1b1a35ee | 122 | | - move occurs because `x` has type `[Option<Test>; 4]`, which does not implement the `Copy` trait |
74b04a01 XL |
123 | LL | match x { |
124 | LL | a @ [.., Some(Test::Foo | Test::Bar)] => (), | |
125 | | ------------------------------------- | |
126 | | | | |
127 | | value moved here | |
128 | | value moved here | |
129 | ... | |
130 | LL | &x; | |
131 | | ^^ value borrowed here after move | |
132 | ||
133 | error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable | |
94222f64 | 134 | --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:144:5 |
74b04a01 XL |
135 | | |
136 | LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(a), | |
137 | | ------------------------------------------------- immutable borrow occurs here | |
138 | ... | |
139 | LL | &mut x; | |
140 | | ^^^^^^ mutable borrow occurs here | |
141 | ... | |
142 | LL | drop(r); | |
143 | | - immutable borrow later used here | |
144 | ||
145 | error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable | |
94222f64 | 146 | --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:156:5 |
74b04a01 XL |
147 | | |
148 | LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(b), | |
149 | | ---------- immutable borrow occurs here | |
150 | ... | |
151 | LL | &mut x; | |
152 | | ^^^^^^ mutable borrow occurs here | |
153 | ... | |
154 | LL | drop(r); | |
155 | | - immutable borrow later used here | |
156 | ||
157 | error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable | |
94222f64 | 158 | --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:170:5 |
74b04a01 XL |
159 | | |
160 | LL | [_, ref a @ Some(box ref b), ..] => Some(a), | |
161 | | ----------------------- immutable borrow occurs here | |
162 | ... | |
163 | LL | &mut x; | |
164 | | ^^^^^^ mutable borrow occurs here | |
165 | ... | |
166 | LL | drop(r); | |
167 | | - immutable borrow later used here | |
168 | ||
169 | error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable | |
94222f64 | 170 | --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:186:5 |
74b04a01 XL |
171 | | |
172 | LL | [_, ref a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a), | |
173 | | ------------------------------------------- immutable borrow occurs here | |
174 | ... | |
175 | LL | &mut x; | |
176 | | ^^^^^^ mutable borrow occurs here | |
177 | ... | |
178 | LL | drop(r); | |
179 | | - immutable borrow later used here | |
180 | ||
181 | error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable | |
94222f64 | 182 | --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:200:5 |
74b04a01 XL |
183 | | |
184 | LL | [_, ref mut a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a), | |
185 | | ----------------------------------------------- mutable borrow occurs here | |
186 | ... | |
187 | LL | &x; | |
188 | | ^^ immutable borrow occurs here | |
189 | ... | |
190 | LL | drop(r); | |
191 | | - mutable borrow later used here | |
192 | ||
193 | error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable | |
94222f64 | 194 | --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:214:5 |
74b04a01 XL |
195 | | |
196 | LL | ref a @ [_, ref b @ Some(box Test::Foo | box Test::Bar), ..] => Some(a), | |
197 | | ------------------------------------------------------------ immutable borrow occurs here | |
198 | ... | |
199 | LL | &mut x; | |
200 | | ^^^^^^ mutable borrow occurs here | |
201 | ... | |
202 | LL | drop(r); | |
203 | | - immutable borrow later used here | |
204 | ||
205 | error: aborting due to 17 previous errors | |
206 | ||
207 | Some errors have detailed explanations: E0382, E0502. | |
208 | For more information about an error, try `rustc --explain E0382`. |