Skip to content

private_interfaces reports the visability of items in pseudocode #131220

Closed
@lolbinarycat

Description

@lolbinarycat
Contributor

Code

#![allow(dead_code)]

mod a {
    pub mod b {
        pub(in crate::a) struct Huh;
        pub fn eee() -> Huh { Huh }
    }
}

Current output


warning: type `Huh` is more private than the item `eee`
 --> src/lib.rs:6:9
  |
6 |         pub fn eee() -> Huh { Huh }
  |         ^^^^^^^^^^^^^^^^^^^ function `eee` is reachable at visibility `pub(crate)`
  |
note: but type `Huh` is only usable at visibility `pub(a)`
 --> src/lib.rs:5:9
  |
5 |         pub(in crate::a) struct Huh;
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  = note: `#[warn(private_interfaces)]` on by default

Desired output


warning: type `Huh` is more private than the item `eee`
 --> src/lib.rs:6:9
  |
6 |         pub fn eee() -> Huh { Huh }
  |         ^^^^^^^^^^^^^^^^^^^ function `eee` is reachable at visibility `pub(crate)`
  |
note: but type `Huh` is only usable at visibility `pub(in crate::a)`
 --> src/lib.rs:5:9
  |
5 |         pub(in crate::a) struct Huh;
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  = note: `#[warn(private_interfaces)]` on by default

Rationale and extra context

pub(a) is not valid rust code in any edition.

Other cases

No response

Rust Version

rustc 1.83.0-nightly (2bd1e89 2024-09-26)
binary: rustc
commit-hash: 2bd1e89
commit-date: 2024-09-26
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

Anything else?

No response

Activity

added
A-diagnosticsArea: Messages for errors, warnings, and lints
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Oct 3, 2024
added
D-papercutDiagnostics: An error or lint that needs small tweaks.
on Oct 3, 2024
yuk1ty

yuk1ty commented on Apr 26, 2025

@yuk1ty
Contributor

@rustbot claim

added a commit that references this issue on May 7, 2025

Rollup merge of rust-lang#140614 - yuk1ty:fix-invalid-module-name-vis…

f7a9c67
added a commit that references this issue on May 8, 2025
ea2299d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsD-papercutDiagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @fmease@lolbinarycat@yuk1ty

    Issue actions

      private_interfaces reports the visability of items in pseudocode · Issue #131220 · rust-lang/rust