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