Skip to content

Inconsistent symbol duplication checking #21546

Closed
@vadimcn

Description

This compiles:

mod Foo {}
struct Foo;

fn main() {}

but this doesn't:

mod Foo {}
struct Bar;
type Foo = Bar;

fn main() {}
<anon>:3:1: 3:16 error: duplicate definition of type or module `Foo`
<anon>:3 type Foo = Bar;
         ^~~~~~~~~~~~~~~
<anon>:1:1: 1:11 note: first definition of type or module `Foo` here
<anon>:1 mod Foo {}
         ^~~~~~~~~~

I'd have expected both to either succeed or fail.

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