-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.T-cargoRelevant to the cargo team, which will review and decide on the PR/issue.Relevant to the cargo team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Description
Right now this is possible and compiles without warning:
Given a cargo crate with name "foo":
// src/lib.rs
// src/main.rs
mod lib;
fn main() {}
... even though we now have duplicated code in the library "foo" and the submodule "lib"
This can be confusing for a beginner because the code can still compile or just breaks "late" depending on what you do:
// src/lib.rs
pub struct Foo;
// src/main.rs
mod lib;
// either of those work (though not at the same time):
use foo::Foo;
use crate::lib::Foo;
fn main() {}
cargo or rustc should detect if we use lib.rs
as a submodule, and warn or error against it.
This issue assumes 2018 edition without uniform paths syntax.
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.T-cargoRelevant to the cargo team, which will review and decide on the PR/issue.Relevant to the cargo team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team