Uh oh!
There was an error while loading. Please reload this page.
rustdoc: expose #[target_feature] attributes as doc(cfg) flags - #48759
Conversation
rust-highfive
commented
Mar 5, 2018
(rust_highfive has picked a reviewer for you, use r? to override) |
QuietMisdreavus
commented
Mar 5, 2018
(btw, expect a PR to stdsimd to add some doc(cfg) so we can render as many arches as possible |
QuietMisdreavus
commented
Mar 5, 2018
One matter this raises is that it uses the |
GuillaumeGomez
commented
Mar 6, 2018
I think we should precise this is a target feature. Like this, if I didn't know I'd have no idea what id'd be about. |
bors
commented
Mar 14, 2018
☔ The latest upstream changes (presumably #48811) made this pull request unmergeable. Please resolve the merge conflicts. |
a643386 to
017bfc3CompareQuietMisdreavus
commented
Mar 14, 2018
Fixed the merge conflict. @GuillaumeGomez I'm not sure i understand. Are you saying we should say "target feature" all the time? My assumption for abbreviating it on the module view was that you're already looking in |
GuillaumeGomez
commented
Mar 15, 2018
When looking and the page, if I didn't know what this text was for, I'd be completely lost. Any kind of indication would help users a lot. |
QuietMisdreavus
commented
Mar 15, 2018
And you can click through to see what it means. The "full version" is printed on the function's page. For configurations like |
GuillaumeGomez
commented
Mar 22, 2018
Thanks! @bors: r+ |
bors
commented
Mar 22, 2018
📌 Commit b3fb0d1 has been approved by |
…r=GuillaumeGomez rustdoc: expose #[target_feature] attributes as doc(cfg) flags This change exposes `#[target_feature(enable = "feat")]` attributes on an item as if they were also `#[doc(cfg(target_feature = "feat"))]` attributes. This gives them a banner on their documentation listing which feature is required to use the item. It also modifies the rendering code for doc(cfg) tags to handle `target_feature` tags. I made it print just the feature name on "short" printings (as in the function listing on a module page), and use "target feature `feat`" in the full banner on the item page itself. This way, the function listing in `std::arch` shows which feature is required for each function:  
…ures, r=GuillaumeGomez add target features when extracting and running doctests When rendering documentation, rustdoc will happily load target features into the cfg environment from the current target, but fails to do this when doing anything with doctests. This would lead to situations where, thanks to rust-lang#48759, functions tagged with `#[target_feature]` couldn't run doctests, thanks to the automatic `#[doc(cfg(target_feature = "..."))]`. Currently, there's no way to pass codegen options to rustdoc that will affect its rustc sessions, but for now this will let you use target features that come default on the platform you're targeting. Fixesrust-lang#49723
This change exposes
#[target_feature(enable = "feat")]attributes on an item as if they were also#[doc(cfg(target_feature = "feat"))]attributes. This gives them a banner on their documentation listing which feature is required to use the item. It also modifies the rendering code for doc(cfg) tags to handletarget_featuretags. I made it print just the feature name on "short" printings (as in the function listing on a module page), and use "target featurefeat" in the full banner on the item page itself.This way, the function listing in
std::archshows which feature is required for each function: