Skip to content

trying to import a use statement should not talk of privacy #42909

Closed
@Manishearth

Description

@Manishearth
fn main() {
    use foo::mem;
}

pub mod foo {
    use std::mem;
}

gives the error:

error: module `mem` is private
 --> <anon>:2:9
  |
2 |     use foo::mem;
  |         ^^^^^^^^

error: aborting due to previous error

However, really, we don't consider use std::mem to be introducing a module, so it's confusing when we say that it's private. This gives off the impression that we typed the correct path, but the library author neglected to make it public.

We should instead give an error that the module/type/etc does not exist, but perhaps note that there is a use statement that could be made pub use if the error is from the same crate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-diagnosticsWorking group: Diagnostics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions