Skip to content

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

Closed
@DomantasJ

Description

@DomantasJ

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cross-crate-reexportsArea: Documentation that has been re-exported from a different crateC-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