Skip to content

Change "A non-empty glob must import something with the glob's visibility" to be a lint? #62334

Closed
@fpoli

Description

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() {}
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions