Skip to content

Commit 2c0ed7f

Browse files
author
Nick Hamann
committed
---
yaml --- r: 208316 b: refs/heads/snap-stage3 c: d730750 h: refs/heads/master v: v3
1 parent f185e01 commit 2c0ed7f

File tree

2 files changed

+109
-10
lines changed

2 files changed

+109
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 38a97becdf3e6a6157f6f7ec2d98ade8d8edc193
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: a6dc983a604ec3a0e89a08419c57c256ba1a0e4a
4+
refs/heads/snap-stage3: d730750d24e74263e349b0d5f32a8922065829c0
55
refs/heads/try: 7b4ef47b7805a402d756fb8157101f64880a522f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/librustc_typeck/diagnostics.rs

Lines changed: 108 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,114 @@ attribute. Such a function must have the following type signature:
150150
```
151151
fn(isize, *const *const u8) -> isize
152152
```
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), so it has been
159+
disabled for now.
160+
"##,
161+
162+
E0204: r##"
163+
An attempt to implement the `Copy` trait for a struct failed because one of the
164+
fields does not implement `Copy`. To fix this, you must implement `Copy` for the
165+
mentioned field. Note that this may not be possible, as in the example of
166+
167+
```
168+
struct Foo {
169+
foo : Vec<u32>,
170+
}
171+
172+
impl Copy for Foo { }
173+
```
174+
175+
This fails because `Vec<T>` does not implement `Copy` for any `T`.
176+
177+
Here's another example that will fail:
178+
179+
```
180+
#[derive(Copy)]
181+
struct Foo<'a> {
182+
ty: &'a mut bool,
183+
}
184+
```
185+
186+
This fails because `&mut T` is not `Copy`, even when `T` is `Copy` (as opposed
187+
to `&T`, which is).
188+
"##,
189+
190+
E0205: r##"
191+
An attempt to implement the `Copy` trait for an enum failed because one of the
192+
variants does not implement `Copy`. To fix this, you must implement `Copy` for
193+
the mentioned variant. Note that this may not be possible, as in the example of
194+
195+
```
196+
enum Foo {
197+
Bar(Vec<u32>),
198+
Baz,
199+
}
200+
201+
impl Copy for Foo { }
202+
```
203+
204+
This fails because `Vec<T>` does not implement `Copy` for any `T`.
205+
206+
Here's another example that will fail:
207+
208+
```
209+
#[derive(Copy)]
210+
enum Foo<'a> {
211+
Bar(&'a mut bool),
212+
Baz
213+
}
214+
```
215+
216+
This fails because `&mut T` is not `Copy`, even when `T` is `Copy` (as opposed
217+
to `&T`, which is).
218+
"##,
219+
220+
E0206: r##"
221+
You can only implement `Copy` for a struct or enum. For example, both of the
222+
following examples will fail, because neither `i32` nor `&'static mut Bar` is
223+
a struct or enum:
224+
225+
```
226+
type Foo = i32;
227+
impl Copy for Foo { } // error
228+
229+
#[derive(Copy, Clone)]
230+
struct Bar;
231+
impl Copy for &'static mut Bar { } // error
232+
```
233+
"##,
234+
235+
E0243: r##"
236+
This error indicates that not enough type parameters were found in a type or
237+
trait.
238+
239+
For example, the `Foo` struct below is defined to be generic in `T`, but the
240+
type parameter is missing in the definition of `Bar`:
241+
242+
```
243+
struct Foo<T> { x: T }
244+
245+
struct Bar { x: Foo }
246+
```
247+
"##,
248+
249+
E0244: r##"
250+
This error indicates that too many type parameters were found in a type or
251+
trait.
252+
253+
For example, the `Foo` struct below has no type parameters, but is supplied
254+
with two in the definition of `Bar`:
255+
256+
```
257+
struct Foo { x: bool }
258+
259+
struct Bar<S, T> { x: Foo<S, T> }
260+
```
153261
"##
154262

155263
}
@@ -232,7 +340,6 @@ register_diagnostics! {
232340
E0178,
233341
E0182,
234342
E0183,
235-
E0184,
236343
E0185,
237344
E0186,
238345
E0187, // can't infer the kind of the closure
@@ -254,12 +361,6 @@ register_diagnostics! {
254361
E0202, // associated items are not allowed in inherent impls
255362
E0203, // type parameter has more than one relaxed default bound,
256363
// 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
263364
E0207, // type parameter is not constrained by the impl trait, self type, or predicate
264365
E0208,
265366
E0209, // builtin traits can only be implemented on structs or enums
@@ -296,8 +397,6 @@ register_diagnostics! {
296397
E0240,
297398
E0241,
298399
E0242, // internal error looking up a definition
299-
E0243, // wrong number of type arguments
300-
E0244, // wrong number of type arguments
301400
E0245, // not a trait
302401
E0246, // illegal recursive type
303402
E0247, // found module name used as a type

0 commit comments

Comments
 (0)