Closed
Description
trait Foo { }
struct Foo { }
fn main() {}
error[E0428]: a trait named `Foo` has already been defined in this module
--> <anon>:2:1
|
1 | trait Foo { }
| ------------- previous definition of `Foo` here
2 | struct Foo { }
| ^^^^^^^^^^^^^^ `Foo` already defined
Two things are confusing here:
-
Using "already" here is confusing because it makes you think that the compiler is talking about two conflicting traits, when the conflict is that we're declaring a struct with the same name as a trait.
-
"
Foo
already defined" looks like it's trying to indicate the place of the first definition, and not the place of the second.
Random recommendation:
- "Two definitions with the name
Foo
" Foo
redefined here