1
Fork 0

Create E0777 error code for "invalid literal in derive"

This commit is contained in:
Guillaume Gomez 2020-10-01 18:39:47 +02:00
parent 782013564e
commit de21c3df0e
5 changed files with 44 additions and 4 deletions

View file

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

View file

@ -0,0 +1,19 @@
A literal value was used inside `#[derive]`.
Erroneous code example:
```compile_fail,E0777
#[derive("Clone")] // error!
struct Foo;
```
Only paths to traits are allowed as argument inside `#[derive]`. You can find
more information about the `#[derive]` attribute in the [Rust Book].
```
#[derive(Clone)] // ok!
struct Foo;
```
[Rust Book]: https://doc.rust-lang.org/book/appendix-03-derivable-traits.html