-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Conversation
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
Some changes occurred in HTML/CSS. |
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. |
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comic Sans MS
welp.
Sorry about that, pushed a fix |
Is it possible to do this via |
@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 |
☔ The latest upstream changes (presumably #45233) made this pull request unmergeable. Please resolve the merge conflicts. |
Friendly ping to keep this on your radar @Nemo157! |
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! |
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.