Closed
Description
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=340b1d1f9850c0644977b8c47b00dc77
#[derive(Clone)]
struct Debug;
trait Debug {}
The current output is:
error[[E0428]](https://doc.rust-lang.org/stable/error-index.html#E0428): the name `Debug` is defined multiple times
--> src/lib.rs:3:1
|
2 | struct Debug;
| ------------- previous definition of the type `Debug` here
3 | trait Debug {}
| ^^^^^^^^^^^ `Debug` redefined here
|
= note: `Debug` must be defined only once in the type namespace of this module
error[[E0782]](https://doc.rust-lang.org/stable/error-index.html#E0782): trait objects must include the `dyn` keyword
--> src/lib.rs:1:10
|
1 | #[derive(Clone)]
| ^^^^^
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
help: add `dyn` keyword before this trait
|
1 | #[derive(dyn Clone)]
| +++
Some errors have detailed explanations: E0428, E0782.
For more information about an error, try `rustc --explain E0428`.
Ideally the output should not suggest placing dyn
before Clone
in #[derive(Clone)]
because the dyn
keyword is not valid in that position.
Thank you to @conradludgate for finding the minimum reproducible that I used for this issue.