Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reexports from other crate are listen in docs even when hidden by other types #70390

Closed
DomantasJ opened this issue Mar 25, 2020 · 1 comment
Closed
Labels
A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@DomantasJ
Copy link

Given a two crate set up:

  • Crate a:

    [package]
    name = "a"
    version = "0.1.0"
    edition = "2018"
    /// I am `a::Foo`
    pub struct Foo;
  • Crate b:

    [package]
    name = "b"
    version = "0.1.0"
    edition = "2018"
    
    [dependencies]
    a = { path = "../a" }
    pub use a::*;
    
    /// I am `b::Foo`
    pub struct Foo;

Documentation for crate b lists two Foo types, with the a::Foo one being inaccessible because it is actually hidden by b::Foo:

image

If you change a to a module instead of a separate crate, then only b::Foo type is listed in docs.

mod a {
    /// I am `b::a::Foo`
    pub struct Foo;
}

pub use self::a::*;

/// I am `b::Foo`
pub struct Foo;

rustc --version --verbose:

rustc 1.42.0 (b8cedc004 2020-03-09)
binary: rustc
commit-hash: b8cedc00407a4c56a3bda1ed605c6fc166655447
commit-date: 2020-03-09
host: x86_64-pc-windows-msvc
release: 1.42.0
LLVM version: 9.0

Real world example of this: diesel::r2d2 lists a struct Error which is defined by diesel, and an enum Error which is glob-reexported from r2d2.

@DomantasJ DomantasJ added the C-bug Category: This is a bug. label Mar 25, 2020
@jonas-schievink jonas-schievink added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Mar 25, 2020
@fmease fmease added the A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate label Nov 23, 2024
@fmease
Copy link
Member

fmease commented Nov 23, 2024

Seems to have been fixed. As for regression tests, we have src/test/rustdoc/issue-99221-multiple-structs-w-same-name.rs (and similar ones like tests/rustdoc/multiple-mods-w-same-name-99734.rs). So it's likely that PR #99344 fixed this issue (#99738 close second).

Closing as fixed.

@fmease fmease closed this as completed Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants