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

Not all doc-comments on re-exports are displayed #43087

Open
Susurrus opened this issue Jul 6, 2017 · 6 comments · May be fixed by #108001
Open

Not all doc-comments on re-exports are displayed #43087

Susurrus opened this issue Jul 6, 2017 · 6 comments · May be fixed by #108001
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@Susurrus
Copy link
Contributor

Susurrus commented Jul 6, 2017

In nix we're aliasing the libc::termios type using pub use libc::termios as Termios. That type has no documentation in libc, but we'd like to offer documentation for the type in our own crate. Specifying a doc comment above it doesn't support anything in the output. It'd be very useful if you could override documentation when aliasing types.

Originally posted at rust-lang/cargo#4250.

@Mark-Simulacrum Mark-Simulacrum added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jul 6, 2017
@GuillaumeGomez GuillaumeGomez added the T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. label Jul 8, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 28, 2017
@gyscos
Copy link

gyscos commented Oct 3, 2019

Would a type alias work in this case?

/// I cannot comment it here!
pub use libc::termios as Termios

/// But this works fine!
pub type Termios = libc::termios;

I think a type alias works almost identically as a re-export (only it shows up in a different rustdoc category).

@Aaron1011
Copy link
Member

I believe this is fixed on the latest nightly.

@gyscos
Copy link

gyscos commented Oct 3, 2019

Indeed! Thanks.

A related question: when pub-using an undocumented enum from another crate, I can re-document the enum itself but not the variant (similarly for a struct, I couldn't document the fields).

Is there a way to add some attribute to #[doc()] so that I can document these inner elements from outside?

@tavianator
Copy link
Contributor

This doesn't seem fixed (anymore?). Using a type = alias is almost as good but doesn't get you the constructor of a tuple-like struct: #73191

@tavianator
Copy link
Contributor

Oh I see, it works for public re-exports of a private type. In my case I wanted to do something like this:

pub mod a {
    /// A foo.
    pub struct Foo;
}

pub mod b {
    /// This doesn't show up anywhere
    pub use a::Foo as Bar;
}

@jyn514 jyn514 changed the title Doccomments for pub use statements should document the type Not all doc-comments on re-exports are displayed Dec 16, 2020
@jyn514 jyn514 added C-feature-request Category: A feature request, i.e: not implemented / a PR. and removed C-bug Category: This is a bug. labels Dec 16, 2020
@ehuss ehuss removed the T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. label Jan 18, 2022
@GuillaumeGomez
Copy link
Member

If you want the second comment to appear, you can add #[doc(inline)] on the second reexport. It'll generate another page for the Bar type. I think having a lint for this would be quite useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants