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

Render cfg(feature) requirements in documentation #44994

Closed
wants to merge 3 commits into from

Conversation

Nemo157
Copy link
Member

@Nemo157 Nemo157 commented Oct 3, 2017

Was based on #35903 when I implemented this almost a year ago, that's been closed since in favour of #1998, but since this is very much a special case for cfg(feature) I don't think it makes sense to update the issue id.

You can see the current output for diesel at https://nemo157.com/rustdoc-features-example/diesel-impl2/diesel/index.html, there is definitely some work on the HTML/CSS that needs to happen (e.g. the implementors section has some really bad alignment issues but getting some feedback on the general structure + ideas about nicer ways to render the details into the docs would be great.

Adds a new rustdoc pass that pre-calculates the sets of features required for
different items so they can be rendered in the documentation.
Render the features required for an item.

Fixes rust-lang#35903
@rust-highfive
Copy link
Collaborator

Some changes occurred in HTML/CSS.

cc @GuillaumeGomez

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @frewsxcv (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@GuillaumeGomez
Copy link
Member

tidy error: /checkout/src/librustdoc/html/render.rs:2632: line longer than 100 chars

I'll take a look at the code when the tests pass.

@@ -598,6 +598,19 @@ body.blur > :not(#help) {
top: 0;
}

.cfg-feature {
padding-left: 10px;
font-family: "Comic Sans MS", monospace;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comic Sans MS
welp.

@Nemo157
Copy link
Member Author

Nemo157 commented Oct 4, 2017

Sorry about that, pushed a fix

@kennytm
Copy link
Member

kennytm commented Oct 5, 2017

Is it possible to do this via #[doc(cfg)] instead? For example make #[cfg(feature = "x")] imply #[doc(cfg(feature = "x"))], and let the existing doc(cfg) code handle the rest (the rendering style would be different though).

@Nemo157
Copy link
Member Author

Nemo157 commented Oct 6, 2017

@kennytm that would definitely help me avoid having to work out a nice rendering style :) I might try and see how that looks over the weekend

@shepmaster shepmaster added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 6, 2017
@frewsxcv frewsxcv assigned nrc and unassigned frewsxcv Oct 9, 2017
@bors
Copy link
Contributor

bors commented Oct 13, 2017

☔ The latest upstream changes (presumably #45233) made this pull request unmergeable. Please resolve the merge conflicts.

@carols10cents
Copy link
Member

Friendly ping to keep this on your radar @Nemo157!

@alexcrichton
Copy link
Member

I'm going to close this now due to inactivity to help clear out the queue, but please feel free to resubmit with a rebase!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.