Skip to content

trait declaration + bare impl on that trait give error messages mentioning "duplication modules" #12569

Closed
@huonw

Description

@huonw
trait Foo {} impl Foo {} fn main() {}

Gives

<anon>:1:14: 1:25 error: duplicate definition of module `Foo`
<anon>:1 trait Foo {} impl Foo {} fn main() {}
                      ^~~~~~~~~~~
<anon>:1:1: 1:13 note: first definition of module `Foo` here
<anon>:1 trait Foo {} impl Foo {} fn main() {}
         ^~~~~~~~~~~~
error: aborting due to previous error

There's no mention of mods in the code, so it would be nice if the error message didn't mention modules at all; and preferably if it just complained that the Foo in impl Foo {} wasn't a type. (Of course, the latter point may change with DST.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions