fork/rust

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

borsAuto merge of #69854 - pietroalbini:stable-next, r=Centrilb8cedc00407

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