Skip to content

A type with static methods with the same name as a module generates incorrect error message #14564

Closed
@huonw

Description

@huonw
mod Foo { fn x() {} }

struct Foo;

impl Foo { fn y() {} }

fn main() {}
<anon>:5:1: 5:23 error: duplicate definition of module `Foo`
<anon>:5 impl Foo { fn y() {} }
         ^~~~~~~~~~~~~~~~~~~~~~
<anon>:3:1: 3:12 note: first definition of module `Foo` here
<anon>:3 struct Foo;
         ^~~~~~~~~~~
error: aborting due to previous error

The "first definition" error should be pointing to the mod Foo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions