Skip to content

rustdoc: pub use re-exports of private re-exports of public items show the private path #94336

Open
@lilyball

Description

@lilyball

I tried this code:

/// bar docs
pub mod bar {
    /// the docs for Bar
    pub trait Bar {}
}

mod qux {
    pub use crate::bar::Bar;
}

pub use qux::Bar;

I expected to see this happen: The Bar item should be documented as a re-export of bar::Bar

Instead, this happened: It shows up as a re-export of qux::Bar (though the link takes me to bar::Bar):

Re-exports

pub use qux::Bar;

Modules

bar    bar docs

This is very odd, it shouldn't be exposing a private module path like that, it should instead show it as pub use bar::Bar.

Meta

rustdoc --version --verbose:

rustdoc 1.58.1 (db9d1b20b 2022-01-20)
binary: rustdoc
commit-hash: db9d1b20bba1968c1ec1fc49616d4742c1725b4b
commit-date: 2022-01-20
host: x86_64-apple-darwin
release: 1.58.1
LLVM version: 13.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-local-reexportsArea: Documentation that has been locally re-exported (i.e., non-cross-crate)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