]> git.lizzy.rs Git - rust.git/blob - tests/ui/nll/move-errors.stderr
Auto merge of #101138 - Rejyr:diagnostic-migration-rustc-lint-pt2, r=davidtwco
[rust.git] / tests / ui / nll / move-errors.stderr
1 error[E0507]: cannot move out of `*a` which is behind a shared reference
2   --> $DIR/move-errors.rs:6:13
3    |
4 LL |     let b = *a;
5    |             ^^ move occurs because `*a` has type `A`, which does not implement the `Copy` trait
6    |
7 help: consider removing the dereference here
8    |
9 LL -     let b = *a;
10 LL +     let b = a;
11    |
12
13 error[E0508]: cannot move out of type `[A; 1]`, a non-copy array
14   --> $DIR/move-errors.rs:12:13
15    |
16 LL |     let b = a[0];
17    |             ^^^^
18    |             |
19    |             cannot move out of here
20    |             move occurs because `a[_]` has type `A`, which does not implement the `Copy` trait
21    |
22 help: consider borrowing here
23    |
24 LL |     let b = &a[0];
25    |             +
26
27 error[E0507]: cannot move out of `**r` which is behind a shared reference
28   --> $DIR/move-errors.rs:19:13
29    |
30 LL |     let s = **r;
31    |             ^^^ move occurs because `**r` has type `A`, which does not implement the `Copy` trait
32    |
33 help: consider removing the dereference here
34    |
35 LL -     let s = **r;
36 LL +     let s = *r;
37    |
38
39 error[E0507]: cannot move out of an `Rc`
40   --> $DIR/move-errors.rs:27:13
41    |
42 LL |     let s = *r;
43    |             ^^ move occurs because value has type `A`, which does not implement the `Copy` trait
44    |
45 help: consider removing the dereference here
46    |
47 LL -     let s = *r;
48 LL +     let s = r;
49    |
50
51 error[E0508]: cannot move out of type `[A; 1]`, a non-copy array
52   --> $DIR/move-errors.rs:32:13
53    |
54 LL |     let a = [A("".to_string())][0];
55    |             ^^^^^^^^^^^^^^^^^^^^^^
56    |             |
57    |             cannot move out of here
58    |             move occurs because value has type `A`, which does not implement the `Copy` trait
59    |
60 help: consider borrowing here
61    |
62 LL |     let a = &[A("".to_string())][0];
63    |             +
64
65 error[E0507]: cannot move out of `a` which is behind a shared reference
66   --> $DIR/move-errors.rs:38:16
67    |
68 LL |     let A(s) = *a;
69    |           -    ^^
70    |           |
71    |           data moved here
72    |           move occurs because `s` has type `String`, which does not implement the `Copy` trait
73    |
74 help: consider removing the dereference here
75    |
76 LL -     let A(s) = *a;
77 LL +     let A(s) = a;
78    |
79
80 error[E0509]: cannot move out of type `D`, which implements the `Drop` trait
81   --> $DIR/move-errors.rs:44:19
82    |
83 LL |     let C(D(s)) = c;
84    |             -     ^ cannot move out of here
85    |             |
86    |             data moved here
87    |             move occurs because `s` has type `String`, which does not implement the `Copy` trait
88    |
89 help: consider borrowing the pattern binding
90    |
91 LL |     let C(D(ref s)) = c;
92    |             +++
93
94 error[E0507]: cannot move out of `*a` which is behind a shared reference
95   --> $DIR/move-errors.rs:51:9
96    |
97 LL |     b = *a;
98    |         ^^ move occurs because `*a` has type `A`, which does not implement the `Copy` trait
99
100 error[E0508]: cannot move out of type `[B; 1]`, a non-copy array
101   --> $DIR/move-errors.rs:74:11
102    |
103 LL |     match x[0] {
104    |           ^^^^ cannot move out of here
105 LL |
106 LL |         B::U(d) => (),
107    |              - data moved here
108 LL |         B::V(s) => (),
109    |              - ...and here
110    |
111    = note: move occurs because these variables have types that don't implement the `Copy` trait
112 help: consider borrowing here
113    |
114 LL |     match &x[0] {
115    |           +
116
117 error[E0509]: cannot move out of type `D`, which implements the `Drop` trait
118   --> $DIR/move-errors.rs:83:11
119    |
120 LL |     match x {
121    |           ^ cannot move out of here
122 ...
123 LL |         B::U(D(s)) => (),
124    |                -
125    |                |
126    |                data moved here
127    |                move occurs because `s` has type `String`, which does not implement the `Copy` trait
128    |
129 help: consider borrowing the pattern binding
130    |
131 LL |         B::U(D(ref s)) => (),
132    |                +++
133
134 error[E0509]: cannot move out of type `D`, which implements the `Drop` trait
135   --> $DIR/move-errors.rs:92:11
136    |
137 LL |     match x {
138    |           ^ cannot move out of here
139 ...
140 LL |         (D(s), &t) => (),
141    |            -
142    |            |
143    |            data moved here
144    |            move occurs because `s` has type `String`, which does not implement the `Copy` trait
145    |
146 help: consider borrowing the pattern binding
147    |
148 LL |         (D(ref s), &t) => (),
149    |            +++
150
151 error[E0507]: cannot move out of `*x.1` which is behind a shared reference
152   --> $DIR/move-errors.rs:92:11
153    |
154 LL |     match x {
155    |           ^
156 ...
157 LL |         (D(s), &t) => (),
158    |                 -
159    |                 |
160    |                 data moved here
161    |                 move occurs because `t` has type `String`, which does not implement the `Copy` trait
162    |
163 help: consider borrowing the pattern binding
164    |
165 LL |         (D(s), &ref t) => (),
166    |                 +++
167
168 error[E0509]: cannot move out of type `F`, which implements the `Drop` trait
169   --> $DIR/move-errors.rs:102:11
170    |
171 LL |     match x {
172    |           ^ cannot move out of here
173 LL |
174 LL |         F(s, mut t) => (),
175    |           -  ----- ...and here
176    |           |
177    |           data moved here
178    |
179    = note: move occurs because these variables have types that don't implement the `Copy` trait
180 help: consider borrowing the pattern binding
181    |
182 LL |         F(ref s, mut t) => (),
183    |           +++
184 help: consider borrowing the pattern binding
185    |
186 LL |         F(s, ref mut t) => (),
187    |              +++
188
189 error[E0507]: cannot move out of `x` as enum variant `Err` which is behind a shared reference
190   --> $DIR/move-errors.rs:110:11
191    |
192 LL |     match *x {
193    |           ^^
194 LL |
195 LL |         Ok(s) | Err(s) => (),
196    |            -
197    |            |
198    |            data moved here
199    |            move occurs because `s` has type `String`, which does not implement the `Copy` trait
200    |
201 help: consider removing the dereference here
202    |
203 LL -     match *x {
204 LL +     match x {
205    |
206
207 error: aborting due to 14 previous errors
208
209 Some errors have detailed explanations: E0507, E0508, E0509.
210 For more information about an error, try `rustc --explain E0507`.