-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Tracking issue for #[doc(cfg(…))]
, #[doc(cfg_hide(…))]
and doc_auto_cfg
#43781
Comments
There are different implementations and signatures for `get_pollfd` depending on whether the target plateform is unix or windows. When generating the doc, we need both implementations to appear regardless of the target platform. This commit is inspired by the way Rust `std` library deals with `process::Command` OS dependent variants (https://doc.rust-lang.org/std/process/struct.Command.html#impl-CommandExt). Documentation can't be accurate though as we can't use the`std::os::windows` on `unix` and vice versa. As a workaround a fake fd class matching the other platform is declared. This could be further enhanced once `#[doc(cfg(...))]` is stabilized (rust-lang/rust#43781) by declaring `#[doc(cfg(unix))]` or `#[doc(cfg(windows))]` instead of the hard coded comments `This is supported on **Windows/Unix** only`. Unfortunately, these comments disappear when generating will `--all-features` because they are not part of the documentation in the gir file.
There are different implementations and signatures for `get_pollfd` depending on whether the target platform is unix or windows. When generating the doc, we need both implementations to appear regardless of the target platform. This commit is inspired by the way Rust `std` library deals with `process::Command` OS dependent variants (https://doc.rust-lang.org/std/process/struct.Command.html#impl-CommandExt). Documentation can't be accurate though as we can't use the`std::os::windows` on `unix` and vice versa. As a workaround a fake fd class matching the other platform is declared. This could be further enhanced once `#[doc(cfg(...))]` is stabilized (rust-lang/rust#43781) by declaring `#[doc(cfg(unix))]` or `#[doc(cfg(windows))]` instead of the hard coded comments `This is supported on **Windows/Unix** only`. Unfortunately, these comments disappear when generating will `--all-features` because they are not part of the documentation in the gir file.
There are different implementations and signatures for `get_pollfd` depending on whether the target platform is unix or windows. When generating the doc, we need both implementations to appear regardless of the target platform. This commit is inspired by the way Rust `std` library deals with `process::Command` OS dependent variants (https://doc.rust-lang.org/std/process/struct.Command.html#impl-CommandExt). Documentation can't be accurate though as we can't use the`std::os::windows` on `unix` and vice versa. As a workaround a fake fd class matching the other platform is declared. This could be further enhanced once `#[doc(cfg(...))]` is stabilized (rust-lang/rust#43781) by declaring `#[doc(cfg(unix))]` or `#[doc(cfg(windows))]` instead of the hard coded comments `This is supported on **Windows/Unix** only`. Unfortunately, these comments disappear when generating will `--all-features` because they are not part of the documentation in the gir file.
There are different implementations and signatures for `get_pollfd` depending on whether the target platform is unix or windows. When generating the doc, we need both implementations to appear regardless of the target platform. This commit is inspired by the way Rust `std` library deals with `process::Command` OS dependent variants (https://doc.rust-lang.org/std/process/struct.Command.html#impl-CommandExt). Documentation can't be accurate though as we can't use the`std::os::windows` on `unix` and vice versa. As a workaround a fake fd class matching the other platform is declared. This could be further enhanced once `#[doc(cfg(...))]` is stabilized (rust-lang/rust#43781) by declaring `#[doc(cfg(unix))]` or `#[doc(cfg(windows))]` instead of the hard coded comments `This is supported on **Windows/Unix** only`. Unfortunately, these comments disappear when generating will `--all-features` because they are not part of the documentation in the gir file.
There are different implementations and signatures for `get_pollfd` depending on whether the target platform is unix or windows. When generating the doc, we need both implementations to appear regardless of the target platform. This commit is inspired by the way Rust `std` library deals with `process::Command` OS dependent variants (https://doc.rust-lang.org/std/process/struct.Command.html#impl-CommandExt). Documentation can't be accurate though as we can't use the`std::os::windows` on `unix` and vice versa. As a workaround a fake fd class matching the other platform is declared. This could be further enhanced once `#[doc(cfg(...))]` is stabilized (rust-lang/rust#43781) by declaring `#[doc(cfg(unix))]` or `#[doc(cfg(windows))]` instead of the hard coded comments `This is supported on **Windows/Unix** only`. Unfortunately, these comments disappear when generating will `--all-features` because they are not part of the documentation in the gir file.
There are different implementations and signatures for `get_pollfd` depending on whether the target platform is unix or windows. When generating the doc, we need both implementations to appear regardless of the target platform. This commit is inspired by the way Rust `std` library deals with `process::Command` OS dependent variants (https://doc.rust-lang.org/std/process/struct.Command.html#impl-CommandExt). Documentation can't be accurate though as we can't use the`std::os::windows` on `unix` and vice versa. As a workaround a fake fd class matching the other platform is declared. This could be further enhanced once `#[doc(cfg(...))]` is stabilized (rust-lang/rust#43781) by declaring `#[doc(cfg(unix))]` or `#[doc(cfg(windows))]` instead of the hard coded comments `This is supported on **Windows/Unix** only`. Unfortunately, these comments disappear when generating will `--all-features` because they are not part of the documentation in the gir file.
|
I think that |
There is also the issue that it repeats every feature on every item in a page: When I last attempted to do something about rendering features I found it much more useful to separately keep track of "all required features" to render at the top of the items page and "newly introduced features" to render on the sub-items on the page, so you don't get this distracting repetition on every item. |
…c, r=QuietMisdreavus Stabilize cfg(doc) cc rust-lang#43781.
We tried out this feature in Syn (dtolnay/syn#734) and decided against using it yet. What I am happy withI like how the message turns out at the top of the doc page of a single type or function. We had previously displayed this information using an italicized note, which was less noticeable. What I am not happy withOur index page becomes extremely noisy. I wish there were a way to not show all of these in our case. It is enough to have this information on the type's individual page. Cfg combinations are not among the most important information to show on the index page. Also inheriting the same note onto every public field seems unnecessary in our use case. |
Just poking around: it appears that the |
The RFC (which is still under discussion so maybe not its final form) proposes something slightly different than what's currently implemented and adds more attributes to give more control. Currently, to enable this feature, you use |
Two years ago on #100883 I asked about the possibility of stabilizing At the time, the response was that stabilizing But ... it's been two years, and neither is stabilized. I could have been using Can |
@jmillikin This needs an RFC to be stabilized. That's currently awaiting FCP (it needs 3 more checkboxes): rust-lang/rfcs#3631 (comment) |
I understand why Why would |
It's a new, non-trivial language feature. They don't get added on a whim; there's a process to follow. |
While it feels like one feature may be easier to stabilise, I can't imagine that filing a shorter RFC just for So, I get the impatience, just, this is pretty much all volunteer work, so, it's gonna take a while for folks to set aside the time to review everything and sign off on it. |
For reference, writing the following at the top of #![cfg_attr(docsrs, feature(doc_auto_cfg))] |
### [`doc_auto_cfg`: Automatically generate `#[doc(cfg)]`](https://doc.rust-lang.org/rustdoc/unstable-features.html#doc_auto_cfg-automatically-generate-doccfg) - Tracking issue: [#43781](rust-lang/rust#43781) `doc_auto_cfg` is an extension to the `#[doc(cfg)]` feature. With it, you don't need to add `#[doc(cfg(...)]` anymore unless you want to override the default behaviour.
### [`doc_auto_cfg`: Automatically generate `#[doc(cfg)]`](https://doc.rust-lang.org/rustdoc/unstable-features.html#doc_auto_cfg-automatically-generate-doccfg) - Tracking issue: [#43781](rust-lang/rust#43781) `doc_auto_cfg` is an extension to the `#[doc(cfg)]` feature. With it, you don't need to add `#[doc(cfg(...)]` anymore unless you want to override the default behaviour.
|
It's all or nothing. RFC is open and waiting for reviews. Sadly there is nothing more we can do about it. The |
I'm sorry, this may be a really dumb question, but why is it "all or nothing"? I don't understand why |
Theoretically it could be done separately, but it wouldn't be done any faster (which seems to be what you truly want). There is nothing that can be done to speed up stabilization (at least that's within the code of conduct). |
I've frequently seen subsets of a complex feature stabilize separately, most famously the various parts of It could be that there's some aspect of how |
Note that when features are split up it's generally because there are concerns, unresolved questions, or simply too much work to do all at once. None of that applies here. The only blocker (pending concerns being raised) is checkboxes. |
In addition to what @jhpratt said: because it would need to go through an RFC, which means asking people to write another RFC and yet other people to review it. We have limited bandwidth and most contributors are not paid to do so and we're also facing a huge burn-out issue across the project as well so it wouldn't help in this regard either. |
I've pinged the people that the FCP is waiting for (no flak intended towards any of these wonderful people), hopefully that can speed up the progress a little bit. |
|
Apologies then. |
@jmillikin This is the solution I have been using.
[package.metadata.docs.rs]
all-features = true
[build-dependencies]
rustc_version = "0.4.1"
use rustc_version::{version_meta, Channel};
fn main() {
// Set cfg flags depending on release channel
let channel = match version_meta().unwrap().channel {
Channel::Stable => "CHANNEL_STABLE",
Channel::Beta => "CHANNEL_BETA",
Channel::Nightly => "CHANNEL_NIGHTLY",
Channel::Dev => "CHANNEL_DEV",
};
println!("cargo:rustc-cfg={}", channel)
}
#![cfg_attr(all(doc, CHANNEL_NIGHTLY), feature(doc_auto_cfg))] Then run nightly in your CI script, |
The way I have it set up:
CI (mimicking docs.rs settings), with the nightly toolchain:
@jmillikin, does that not solve your problem? |
See rust-lang/rust#43781. This enables infoboxes like "Available on crate feature XXX only." in the documentation generated using `cargo doc` on nightly, or by building on docs.rs. This can be tested with: ```shell RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --no-deps --all-features ```
See rust-lang/rust#43781. This enables infoboxes like "Available on crate feature XXX only." in the documentation generated using `cargo doc` on nightly, or by building on docs.rs. This can be tested with: ```shell RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --no-deps --all-features ```
This is a tracking issue for the
#[doc(cfg(…))]
attribute (feature:doc_cfg
) introduced in #43348 and#[doc(cfg_hide(…))]
(feature:doc_cfg_hide
) attribute introduced in #89596, along with thedoc_auto_cfg
feature introduced in #90502.Steps:
Fix syntax mismatches: Rustdoc and rustc accept different(fixed in Unify rustc and rustdoc parsing ofcfg
syntax #84437cfg()
#84442)(cc #1998)
The text was updated successfully, but these errors were encountered: