1
Fork 0

Auto merge of #76406 - GuillaumeGomez:create-e0774, r=pickfire,jyn514

Create E0774
This commit is contained in:
bors 2020-09-09 08:23:33 +00:00
commit 3f5e617e36
14 changed files with 69 additions and 31 deletions

View file

@ -455,6 +455,7 @@ E0769: include_str!("./error_codes/E0769.md"),
E0770: include_str!("./error_codes/E0770.md"),
E0771: include_str!("./error_codes/E0771.md"),
E0773: include_str!("./error_codes/E0773.md"),
E0774: include_str!("./error_codes/E0774.md"),
;
// E0006, // merged with E0005
// E0008, // cannot bind by-move into a pattern guard

View file

@ -0,0 +1,24 @@
`derive` was applied on something which is not a struct, a union or an enum.
Erroneous code example:
```compile_fail,E0774
trait Foo {
#[derive(Clone)] // error!
type Bar;
}
```
As said above, the `derive` attribute is only allowed on structs, unions or
enums:
```
#[derive(Clone)] // ok!
struct Bar {
field: u32,
}
```
You can find more information about `derive` in the [Rust Book].
[Rust Book]: https://doc.rust-lang.org/book/appendix-03-derivable-traits.html