Skip to content

Resolve: incorrect error messages after a duplicate module definition #31644

Closed
@jseyfried

Description

@jseyfried

For example,

mod foo {
    fn bar() -> bool { bar() }
}

mod foo {
    fn baz() { baz() }
    fn bar() { bar() }
}

reports the duplicate definition of foo, but also reports

<anon>:6:16: 6:19 error: unresolved name `baz` [E0425]
<anon>:6     fn baz() { baz() }
                        ^~~
<anon>:6:16: 6:19 help: see the detailed explanation for E0425
<anon>:7:16: 7:21 error: mismatched types:
 expected `()`,
    found `bool`
(expected (),
    found bool) [E0308]
<anon>:7     fn bar() { bar() }

The example compiles without errors if one of the modules' name is changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions