Skip to content

Issue a warning when a file is included twice #10569

Closed
@alexcrichton

Description

@alexcrichton

It's a common mistake to have code like:

mod foo;
mod bar {
  mod foo;
}

Many newcomers expect this to have two instances of the same module foo. This in fact declares two separate foo modules which have different types (even though they have the same contents).

We should print a suppressable warning about when this happens. Something along the lines of second inclusion of foo.rs, did you mean to "use" the module instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parserArea: The lexing & parsing of Rust source code to an AST

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions