Skip to content

Rustdoc impl blocks refer to private names #41072

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

Open
dtolnay opened this issue Apr 4, 2017 · 9 comments
Open

Rustdoc impl blocks refer to private names #41072

dtolnay opened this issue Apr 4, 2017 · 9 comments
Assignees
Labels
A-local-reexports Area: Documentation that has been locally re-exported (i.e., non-cross-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

@dtolnay
Copy link
Member

dtolnay commented Apr 4, 2017

The flate2 crate is structured roughly like this:

mod gz {
    pub struct EncoderReader;

    impl EncoderReader {
        pub fn new() -> EncoderReader {
            unimplemented!()
        }
    }
}

pub use gz::EncoderReader as GzEncoder;

The rustdoc of GzEncoder is correctly titled but the impl blocks on the page refer to the private name of the type. I would expect the impl blocks and methods to use the public name, just like the top of the page does.


selection_030

@GuillaumeGomez GuillaumeGomez added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Apr 25, 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
@dtolnay
Copy link
Member Author

dtolnay commented May 29, 2017

This bug affects reqwest as well. There is a type called reqwest::UrlError which is re-exported from url::ParseError so all of the rustdoc refers to the wrong name ParseError.

@camelid
Copy link
Member

camelid commented Dec 15, 2021

I believe this bug is fixed now. Let me know if this issue can be closed, or close it yourself. Thanks.

@camelid camelid closed this as completed Dec 15, 2021
@dtolnay
Copy link
Member Author

dtolnay commented Dec 15, 2021

This is not fixed as of current nightly. cargo doc of the same code from above:

Screenshot from 2021-12-14 16-37-39

@dtolnay dtolnay reopened this Dec 15, 2021
@camelid
Copy link
Member

camelid commented Dec 15, 2021

Hmm, I went to the latest version of the docs.rs page in the OP, but couldn't find GzEncoder in the crate root: https://docs.rs/flate2/1.0.22/flate2/index.html?search=gzencoder

@camelid
Copy link
Member

camelid commented Dec 15, 2021

Also, oops: I didn't mean to close this issue! Thanks for re-opening it.

@camelid
Copy link
Member

camelid commented Dec 15, 2021

I just ran cargo doc locally, and I'm still not seeing GzEncoder in the crate root, either via searching or the listing on the crate root's page. Where do you see GzEncoder?

@dtolnay
Copy link
Member Author

dtolnay commented Dec 15, 2021

$ cat Cargo.toml 
[package]
name = "flate2"
version = "0.0.0"
edition = "2021"

$ cat src/lib.rs 
mod gz {
    pub struct EncoderReader;

    impl EncoderReader {
        pub fn new() -> EncoderReader {
            unimplemented!()
        }
    }
}

pub use gz::EncoderReader as GzEncoder;

$ cargo doc --open
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Opening target/doc/flate2/index.html

Screenshot from 2021-12-14 16-47-37

@camelid
Copy link
Member

camelid commented Dec 15, 2021

Ah, I thought your screenshot was from the crate itself.

@camelid camelid added A-local-reexports Area: Documentation that has been locally re-exported (i.e., non-cross-crate) and removed T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. labels Dec 15, 2021
@camelid camelid self-assigned this Dec 15, 2021
@camelid
Copy link
Member

camelid commented Dec 15, 2021

Assigning myself for now to look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-local-reexports Area: Documentation that has been locally re-exported (i.e., non-cross-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

5 participants