@@ -119,6 +119,114 @@ construct an instance of the following type using only safe code:
119
119
```
120
120
enum Empty {}
121
121
```
122
+ "## ,
123
+
124
+ E0184 : r##"
125
+ Explicitly implementing both Drop and Copy for a type is currently disallowed.
126
+ This feature can make some sense in theory, but the current implementation is
127
+ incorrect and can lead to memory unsafety (see issue #20126), so it has been
128
+ disabled for now.
129
+ "## ,
130
+
131
+ E0204 : r##"
132
+ An attempt to implement the `Copy` trait for a struct failed because one of the
133
+ fields does not implement `Copy`. To fix this, you must implement `Copy` for the
134
+ mentioned field. Note that this may not be possible, as in the example of
135
+
136
+ ```
137
+ struct Foo {
138
+ foo : Vec<u32>,
139
+ }
140
+
141
+ impl Copy for Foo { }
142
+ ```
143
+
144
+ This fails because `Vec<T>` does not implement `Copy` for any `T`.
145
+
146
+ Here's another example that will fail:
147
+
148
+ ```
149
+ #[derive(Copy)]
150
+ struct Foo<'a> {
151
+ ty: &'a mut bool,
152
+ }
153
+ ```
154
+
155
+ This fails because `&mut T` is not `Copy`, even when `T` is `Copy` (as opposed
156
+ to `&T`, which is).
157
+ "## ,
158
+
159
+ E0205 : r##"
160
+ An attempt to implement the `Copy` trait for an enum failed because one of the
161
+ variants does not implement `Copy`. To fix this, you must implement `Copy` for
162
+ the mentioned variant. Note that this may not be possible, as in the example of
163
+
164
+ ```
165
+ enum Foo {
166
+ Bar(Vec<u32>),
167
+ Baz,
168
+ }
169
+
170
+ impl Copy for Foo { }
171
+ ```
172
+
173
+ This fails because `Vec<T>` does not implement `Copy` for any `T`.
174
+
175
+ Here's another example that will fail:
176
+
177
+ ```
178
+ #[derive(Copy)]
179
+ enum Foo<'a> {
180
+ Bar(&'a mut bool),
181
+ Baz
182
+ }
183
+ ```
184
+
185
+ This fails because `&mut T` is not `Copy`, even when `T` is `Copy` (as opposed
186
+ to `&T`, which is).
187
+ "## ,
188
+
189
+ E0206 : r##"
190
+ You can only implement `Copy` for a struct or enum. For example, both of the
191
+ following examples will fail, because neither `i32` nor `&'static mut Bar` is
192
+ a struct or enum:
193
+
194
+ ```
195
+ type Foo = i32;
196
+ impl Copy for Foo { } // error
197
+
198
+ #[derive(Copy, Clone)]
199
+ struct Bar;
200
+ impl Copy for &'static mut Bar { } // error
201
+ ```
202
+ "## ,
203
+
204
+ E0243 : r##"
205
+ This error indicates that not enough type parameters were found in a type or
206
+ trait.
207
+
208
+ For example, the `Foo` struct below is defined to be generic in `T`, but the
209
+ type parameter is missing in the definition of `Bar`:
210
+
211
+ ```
212
+ struct Foo<T> { x: T }
213
+
214
+ struct Bar { x: Foo }
215
+ ```
216
+ "## ,
217
+
218
+ E0244 : r##"
219
+ This error indicates that too many type parameters were found in a type or
220
+ trait.
221
+
222
+ For example, the `Foo` struct below has no type parameters, but is supplied
223
+ with two in the definition of `Bar`:
224
+
225
+ ```
226
+ struct Foo { x: bool }
227
+
228
+ struct Bar<S, T> { x: Foo<S, T> }
229
+ ```
122
230
"##
123
231
124
232
}
@@ -204,7 +312,6 @@ register_diagnostics! {
204
312
E0178 ,
205
313
E0182 ,
206
314
E0183 ,
207
- E0184 ,
208
315
E0185 ,
209
316
E0186 ,
210
317
E0187 , // can't infer the kind of the closure
@@ -226,12 +333,6 @@ register_diagnostics! {
226
333
E0202 , // associated items are not allowed in inherent impls
227
334
E0203 , // type parameter has more than one relaxed default bound,
228
335
// and only one is supported
229
- E0204 , // trait `Copy` may not be implemented for this type; field
230
- // does not implement `Copy`
231
- E0205 , // trait `Copy` may not be implemented for this type; variant
232
- // does not implement `copy`
233
- E0206 , // trait `Copy` may not be implemented for this type; type is
234
- // not a structure or enumeration
235
336
E0207 , // type parameter is not constrained by the impl trait, self type, or predicate
236
337
E0208 ,
237
338
E0209 , // builtin traits can only be implemented on structs or enums
@@ -268,8 +369,6 @@ register_diagnostics! {
268
369
E0240 ,
269
370
E0241 ,
270
371
E0242 , // internal error looking up a definition
271
- E0243 , // wrong number of type arguments
272
- E0244 , // wrong number of type arguments
273
372
E0245 , // not a trait
274
373
E0246 , // illegal recursive type
275
374
E0247 , // found module name used as a type
0 commit comments