fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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