@@ -150,6 +150,148 @@ attribute. Such a function must have the following type signature:
150
150
```
151
151
fn(isize, *const *const u8) -> isize
152
152
```
153
+ "## ,
154
+
155
+ E0184 : r##"
156
+ Explicitly implementing both Drop and Copy for a type is currently disallowed.
157
+ This feature can make some sense in theory, but the current implementation is
158
+ incorrect and can lead to memory unsafety (see [issue #20126][iss20126]), so
159
+ it has been disabled for now.
160
+
161
+ [iss20126]: https://github.com/rust-lang/rust/issues/20126
162
+ "## ,
163
+
164
+ E0204 : r##"
165
+ An attempt to implement the `Copy` trait for a struct failed because one of the
166
+ fields does not implement `Copy`. To fix this, you must implement `Copy` for the
167
+ mentioned field. Note that this may not be possible, as in the example of
168
+
169
+ ```
170
+ struct Foo {
171
+ foo : Vec<u32>,
172
+ }
173
+
174
+ impl Copy for Foo { }
175
+ ```
176
+
177
+ This fails because `Vec<T>` does not implement `Copy` for any `T`.
178
+
179
+ Here's another example that will fail:
180
+
181
+ ```
182
+ #[derive(Copy)]
183
+ struct Foo<'a> {
184
+ ty: &'a mut bool,
185
+ }
186
+ ```
187
+
188
+ This fails because `&mut T` is not `Copy`, even when `T` is `Copy` (this
189
+ differs from the behavior for `&T`, which is `Copy` when `T` is `Copy`).
190
+ "## ,
191
+
192
+ E0205 : r##"
193
+ An attempt to implement the `Copy` trait for an enum failed because one of the
194
+ variants does not implement `Copy`. To fix this, you must implement `Copy` for
195
+ the mentioned variant. Note that this may not be possible, as in the example of
196
+
197
+ ```
198
+ enum Foo {
199
+ Bar(Vec<u32>),
200
+ Baz,
201
+ }
202
+
203
+ impl Copy for Foo { }
204
+ ```
205
+
206
+ This fails because `Vec<T>` does not implement `Copy` for any `T`.
207
+
208
+ Here's another example that will fail:
209
+
210
+ ```
211
+ #[derive(Copy)]
212
+ enum Foo<'a> {
213
+ Bar(&'a mut bool),
214
+ Baz
215
+ }
216
+ ```
217
+
218
+ This fails because `&mut T` is not `Copy`, even when `T` is `Copy` (this
219
+ differs from the behavior for `&T`, which is `Copy` when `T` is `Copy`).
220
+ "## ,
221
+
222
+ E0206 : r##"
223
+ You can only implement `Copy` for a struct or enum. Both of the following
224
+ examples will fail, because neither `i32` (primitive type) nor `&'static Bar`
225
+ (reference to `Bar`) is a struct or enum:
226
+
227
+ ```
228
+ type Foo = i32;
229
+ impl Copy for Foo { } // error
230
+
231
+ #[derive(Copy, Clone)]
232
+ struct Bar;
233
+ impl Copy for &'static Bar { } // error
234
+ ```
235
+ "## ,
236
+
237
+ E0243 : r##"
238
+ This error indicates that not enough type parameters were found in a type or
239
+ trait.
240
+
241
+ For example, the `Foo` struct below is defined to be generic in `T`, but the
242
+ type parameter is missing in the definition of `Bar`:
243
+
244
+ ```
245
+ struct Foo<T> { x: T }
246
+
247
+ struct Bar { x: Foo }
248
+ ```
249
+ "## ,
250
+
251
+ E0244 : r##"
252
+ This error indicates that too many type parameters were found in a type or
253
+ trait.
254
+
255
+ For example, the `Foo` struct below has no type parameters, but is supplied
256
+ with two in the definition of `Bar`:
257
+
258
+ ```
259
+ struct Foo { x: bool }
260
+
261
+ struct Bar<S, T> { x: Foo<S, T> }
262
+ ```
263
+ "## ,
264
+
265
+ E0249 : r##"
266
+ This error indicates a constant expression for the array length was found, but
267
+ it was not an integer (signed or unsigned) expression.
268
+
269
+ Some examples of code that produces this error are:
270
+
271
+ ```
272
+ const A: [u32; "hello"] = []; // error
273
+ const B: [u32; true] = []; // error
274
+ const C: [u32; 0.0] = []; // error
275
+ "## ,
276
+
277
+ E0250 : r##"
278
+ This means there was an error while evaluating the expression for the length of
279
+ a fixed-size array type.
280
+
281
+ Some examples of code that produces this error are:
282
+
283
+ ```
284
+ // divide by zero in the length expression
285
+ const A: [u32; 1/0] = [];
286
+
287
+ // Rust currently will not evaluate the function `foo` at compile time
288
+ fn foo() -> usize { 12 }
289
+ const B: [u32; foo()] = [];
290
+
291
+ // it is an error to try to add `u8` and `f64`
292
+ use std::{f64, u8};
293
+ const C: [u32; u8::MAX + f64::EPSILON] = [];
294
+ ```
153
295
"##
154
296
155
297
}
@@ -164,18 +306,18 @@ register_diagnostics! {
164
306
E0030 ,
165
307
E0031 ,
166
308
E0033 ,
167
- E0034 ,
168
- E0035 ,
169
- E0036 ,
170
- E0038 ,
309
+ E0034 , // multiple applicable methods in scope
310
+ E0035 , // does not take type parameters
311
+ E0036 , // incorrect number of type parameters given for this method
312
+ E0038 , // cannot convert to a trait object because trait is not object-safe
171
313
E0040 , // explicit use of destructor method
172
- E0044 ,
173
- E0045 ,
314
+ E0044 , // foreign items may not have type parameters
315
+ E0045 , // variadic function must have C calling convention
174
316
E0049 ,
175
317
E0050 ,
176
318
E0053 ,
177
- E0055 ,
178
- E0057 ,
319
+ E0055 , // method has an incompatible type for trait
320
+ E0057 , // method has an incompatible type for trait
179
321
E0059 ,
180
322
E0060 ,
181
323
E0061 ,
@@ -232,7 +374,6 @@ register_diagnostics! {
232
374
E0178 ,
233
375
E0182 ,
234
376
E0183 ,
235
- E0184 ,
236
377
E0185 ,
237
378
E0186 ,
238
379
E0187 , // can't infer the kind of the closure
@@ -254,12 +395,6 @@ register_diagnostics! {
254
395
E0202 , // associated items are not allowed in inherent impls
255
396
E0203 , // type parameter has more than one relaxed default bound,
256
397
// and only one is supported
257
- E0204 , // trait `Copy` may not be implemented for this type; field
258
- // does not implement `Copy`
259
- E0205 , // trait `Copy` may not be implemented for this type; variant
260
- // does not implement `copy`
261
- E0206 , // trait `Copy` may not be implemented for this type; type is
262
- // not a structure or enumeration
263
398
E0207 , // type parameter is not constrained by the impl trait, self type, or predicate
264
399
E0208 ,
265
400
E0209 , // builtin traits can only be implemented on structs or enums
@@ -296,14 +431,10 @@ register_diagnostics! {
296
431
E0240 ,
297
432
E0241 ,
298
433
E0242 , // internal error looking up a definition
299
- E0243 , // wrong number of type arguments
300
- E0244 , // wrong number of type arguments
301
434
E0245 , // not a trait
302
435
E0246 , // illegal recursive type
303
436
E0247 , // found module name used as a type
304
437
E0248 , // found value name used as a type
305
- E0249 , // expected constant expr for array length
306
- E0250 , // expected constant expr for array length
307
438
E0318 , // can't create default impls for traits outside their crates
308
439
E0319 , // trait impls for defaulted traits allowed just for structs/enums
309
440
E0320 , // recursive overflow during dropck
0 commit comments