Skip to content

Double reexport of non-public item is not listed as reexport #108679

Closed

Description

@Kyuuhachi
pub mod a {
    mod b {
        pub struct B;
    }
    pub use b::B;
    pub struct A;
}

pub use a::{A, B};

When running cargo doc with the above code, the docs list the following items:

Docs

Crate foo

Re-exports

pub use a::A;

Modules

a

Structs

B

Module foo::a

Structs

A
B

I would expect a::B to be listed as a reexport, not a struct. The way it is now, it looks like foo::B and foo::a::B are different types, which is not the case.

If a::b is made pub, everything looks as it's supposed to.

@rustbot label +T-rustdoc

Activity

  1. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    on Mar 2, 2023
  2. GuillaumeGomez commented on Mar 3, 2023

    @GuillaumeGomez
    Member

    It's the intended behaviour. Since the b module is private, pub use b::B is inlining the item into a.

  3. Kyuuhachi commented on Mar 3, 2023

    @Kyuuhachi
    ContributorAuthor

    Yes, but crate::a::B is public, so should it really be inlined a second time?

  4. GuillaumeGomez commented on Mar 3, 2023

    @GuillaumeGomez
    Member

    Ok sorry I misunderstood what you meant. No, it shouldn't be inlined a second time.

  5. added a commit that references this issue on Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc 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