-
Notifications
You must be signed in to change notification settings - Fork 497
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
Document feature requirements #1264
Conversation
Ah, this is not yet stable so I may opt for a different approach for now. |
This would need major design changes, rustdoc doesn't have knowledge of cargo and doesn't know which features enable other features. |
Fair enough, then I may just generate a simple list with |
Fwiw other projects introduce something like a Secondly you can override the features shown here with |
Thanks, I ended up just generating it myself: #1268 |
@kennykerr Cool - just keep |
@kennykerr I meant using |
@kennykerr So with that trivial set of changes, here's what the rendered docs look like: And the functions: Note that these bubbles don't repeat what is shown at the top of the page for the entire I think this is #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Storage_FileSystem", feature = "Win32_System_SystemServices"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "Win32_Storage_CloudFilters", feature = "Win32_Foundation", feature = "Win32_Storage_FileSystem", feature = "Win32_System_SystemServices"))))] |
FWIW, I would be ok with changing the behavior of rustdoc here, I think it makes sense not to propagate the |
@jyn514 I think either is fine - I may have even hinted to @GuillaumeGomez to want that at some point while working on gtk/gstreamer/gir docs in the past - but also retrospectively not showing feature requirements on items when they are already specified on the surrounding type/impl/mod (but then we're getting in rust-lang/rust#83428 territory). It's probably more interesting to implement @kennykerr's suggestion above: don't show features that are already required for other (explicitly required/overridden) feature(s). I wasn't expecting rustdoc to not know anything about the cargo environment yet, I guess all crate dependencies coming from it are passed on the cmdline? |
@MarijnS95 The |
It's not customizable (feel free to open an issue for that - rust-lang/rust#43781 (comment)), but I think it would be reasonable for rustdoc to make it a comma-separated list instead. |
This issue too. We are talking about how to render the |
|
Fixes #1246
@jyn514 It would be great if it could detect when a feature enables other features and only show the smallest set of features. For example, here
Win32_Storage_CloudFilters
enablesWin32_Storage
which enablesWin32
so it would ideally elide those for brevity and only list the features that must be enabled to actually enable the function. From the Windows crate's Cargo.toml:This is because it is modeling a module hierarchy.