fork/rust

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

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

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