You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Kimundi opened this issue
Nov 28, 2018
· 6 comments
Labels
A-lintsArea: 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.T-langRelevant to the language team, which will review and decide on the PR/issue.
This would have to be done in Cargo, because only cargo even knows if there's another project being built.
additionally, it's a bit more general than this; while lib.rs is the default, you can name it anything.
Centril
added
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
T-cargo
Relevant to the cargo team, which will review and decide on the PR/issue.
labels
Nov 28, 2018
@Centril: Just wanted to document what I based this issue on, since I was not sure if something influences the behavior here.
@steveklabnik: Right, it could be named anything, hm...
How about this: rustc gets a new flag used by cargo to inform it about "possible extern crate roots" or more general "possible extern source files". Cargo then looks at whether there are crates in the dependency chain that share source directories, and passes the module file paths as needed.
Whenever rustc sees a modulefile, it checks it against the list from the flag and emits an warning.
A-lintsArea: 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.T-langRelevant to the language team, which will review and decide on the PR/issue.
Right now this is possible and compiles without warning:
Given a cargo crate with name "foo":
// src/lib.rs
... 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:
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.
The text was updated successfully, but these errors were encountered: