Skip to content

Many times re-exported type shows wrong documentation page #37608

Closed
@jethrogb

Description

@jethrogb

When a crate B re-exports a type from another crate A under a different name in a private module, and defines a new type with the same name, and the type from the private module is re-exported in a public module using a wildcard, and the other type is also re-exported in that same public module, and a crate C re-exports this public module, the documentation page for that named type for crate C shows the wrong type when the documentation is compiled including dependencies.

Man, that's a mouthful. Here is some code to clarify:

// crate a
pub struct S {
    pub crate_a: ()
}
// crate b
extern crate a;

mod private {
    pub struct S {
        pub crate_b: ()
    }
    pub use a::S as X;
}
    
pub mod public {
    pub use private::*;
}
// crate c
extern crate b;

pub use b::public;

The documentation for c::public::S shows the documentation for a::S but the actual type is b::private::S. There is no page for c::public::X.

This shows up in the wild in the documentation for iron::headers::Cookie, which is hyper::header::Cookie but shows cookie::Cookie.

I don't think this is one of the issues already documented in #24305

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.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