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

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

Closed
jethrogb opened this issue Nov 5, 2016 · 0 comments
Closed

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

jethrogb opened this issue Nov 5, 2016 · 0 comments
Labels
T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jethrogb
Copy link
Contributor

jethrogb commented Nov 5, 2016

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

@jethrogb jethrogb changed the title Many times re-exported type documentation shows wrong documentation page Many times re-exported type shows wrong documentation page Nov 5, 2016
@Mark-Simulacrum Mark-Simulacrum added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label May 15, 2017
@steveklabnik steveklabnik added the T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. label May 18, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue May 23, 2017
…teveklabnik

rustdoc: Fix names of items in cross crate reexported modules

For renamed reexports the new name should be used.

An example of this (as pointed out in rust-lang#27741 (comment)) is two instances of `StepBy` in [`std::iter`](https://doc.rust-lang.org/nightly/std/iter/index.html#structs). [`core::iter`](https://doc.rust-lang.org/nightly/core/iter/index.html#structs) is correct.

Fixes rust-lang#37608
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. 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