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

Conditional features should be made clear in generated docs #62188

Closed
jdm opened this issue Jun 27, 2019 · 6 comments
Closed

Conditional features should be made clear in generated docs #62188

jdm opened this issue Jun 27, 2019 · 6 comments
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

@jdm
Copy link
Contributor

jdm commented Jun 27, 2019

I spent a bunch of time looking at https://docs.rs/winapi/0.3.7/x86_64-pc-windows-msvc/winapi/um/fileapi/struct.BY_HANDLE_FILE_INFORMATION.html, seeing that there was a Default implementation for the type, and then hitting errors when trying to call BY_HANDLE_FILE_INFORMATION::default() in code that was using winapi 0.3.7. Eventually I clicked on https://docs.rs/winapi/0.3.7/x86_64-pc-windows-msvc/src/winapi/macros.rs.html#381 and realized that the implementation is only generated if the impl-default feature is enabled. I think it would be very helpful to expose information about conditional compilation in the generated documentation somehow in order to avoid problems like this in the future.

@jdm jdm added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Jun 27, 2019
@silverweed
Copy link

+1
I would love to see all the features of a crate directly in its rustdoc.

@pickfire
Copy link
Contributor

pickfire commented Apr 1, 2020

It would be nice for rustdoc to be able to show which feature enables a function beside it. @QuietMisdreavus Is this feasible? Just wondering if this issue relates to #55938

@jyn514
Copy link
Member

jyn514 commented Aug 27, 2020

This is doc(cfg()) I think: https://doc.rust-lang.org/rustdoc/unstable-features.html#documenting-platform-feature-specific-information. Can this be closed in favor of #43781 ?

@retep998
Copy link
Member

It's unfortunate that we have to add an extra attribute to document that instead of preserving the cfg information so rustdoc can report it directly.

@jyn514
Copy link
Member

jyn514 commented Aug 27, 2020

That's #1998 and is much harder to fix.

@jyn514
Copy link
Member

jyn514 commented Aug 27, 2020

I'm going to close this since I don't think it has any requests that aren't covered by #43781 or #1998. I don't see a way to do this automatically without #1998.

@jyn514 jyn514 closed this as completed Aug 27, 2020
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

No branches or pull requests

5 participants