Skip to content

Fix error message for duplicate mods #7322

Closed
@emberian

Description

@emberian

Code like

mod foo {
    struct S;
}
mod foo {
    struct P;
}

Generates the error

foo.rs:4:0: 6:1 error: duplicate definition of type `foo`
foo.rs:4 mod foo {
foo.rs:5     struct P;
foo.rs:6 }
foo.rs:1:0: 3:1 note: first definition of type foo here:
foo.rs:1 mod foo {
foo.rs:2     struct S;
foo.rs:3 }

Which is wrong. foo is not a type, it's a module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions