Skip to content

Documentation of a re-export doesn't appear on level-two re-export #81893

@jplatte

Description

@jplatte

I have a macro crate with a "peer dependency" on another crate, i.e. I can't write doctests for the macro itself without introducing circular dev-dependencies which are kind of annoying. The other crate re-exports the macro and the macro is actually expected to only ever be used through there, so I documented the re-export instead. However, there's another higher-level crate that re-exports a bunch of other crates entirely including the one that re-exports the macro. In the documentation of the higher-level crate, the documentation for the macro does not appear, while it appears on the "level-one" re-export.

Minimal reproduction:

Crate foo re-exports a type from bar, which is itself a re-export of a type from baz. The docs on each of the declarations (original type definition in baz, re-exports in bar and foo) are simply the crate name

// # baz/src/lib.rs
/// baz
pub struct Type;

// # bar/src/lib.rs
/// bar
pub use baz::Type;

// # foo/src/lib.rs
/// foo
pub use bar::Type;

Here is a repo with this: https://github.com/jplatte/rust-issue-81893

I expected to see this happen: the docs of foo::Type should be foo bar baz

Instead, this happened: the docs of foo::Type are foo baz

Meta

Happens with latest nightly from rustup that has rustfmt:

rustc --version --verbose:

rustc 1.51.0-nightly (04caa632d 2021-01-30)
binary: rustc
commit-hash: 04caa632dd10c2bf64b69524c7f9c4c30a436877
commit-date: 2021-01-30
host: x86_64-unknown-linux-gnu
release: 1.51.0-nightly
LLVM version: 11.0.1

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