Change "A non-empty glob must import something with the glob's visibility" to be a lint? #62334
Closed
Description
opened on Jul 3, 2019
Consider the following three examples: A and C are accepted and B has a compilation error. However, the message reported in B looks more like a lint than a compilation error.
A consequence of this error is that adding a non-public function to a module (e.g. the bar
in B) may break code that imports from that module. This causes surprises when refactoring.
Shouldn't "A non-empty glob must import something with the glob's visibility" be a lint?
The original discussion is here: https://users.rust-lang.org/t/a-non-empty-glob-must-import-something-with-the-globs-visibility-uhhh-okay-but-why
A
pub use self::a::*;
mod a {
fn foo() {}
}
B
// ERROR: A non-empty glob must import something with the glob's visibility
pub use self::b::*;
mod b {
fn foo() {}
pub(super) fn bar() {}
}
C
// okay: there's a pub item
pub use self::c::*;
mod c {
fn foo() {}
pub(super) fn bar() {}
pub fn baz() {}
}
Metadata
Assignees
Labels
Area: Lints (warnings about flaws in source code) such as unused_mut.Area: Name/path resolution done by `rustc_resolve` specificallyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Relevant to the language team, which will review and decide on the PR/issue.
Activity