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
Add display of cfg in rustdoc #44165
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
I'm really skittish about just turning this on, because it could leave the impression that rustdoc can somehow handle conditional compilation, which it still totally does not. There's no way for rustdoc to show everything that's tagged with a feature, for the same reason it can't truly show everything that's tagged with a platform-specific cfg. (e.g. #43348 needed to specifically hand several modules to rustdoc via This may be helpful if people remember to turn on all their features when rendering docs, but this leaves out things like docs.rs and even that |
How will it looks like when applied to impl, functions, struct fields, enum variants, and fields inside enum variants? #[cfg(foo)]
impl Foo {
#[cfg(foo)]
pub fn new() {}
}
#[cfg(foo)]
pub struct Foo {
#[cfg(foo)]
pub x: u32,
}
#[cfg(foo)]
pub enum Foo2 {
#[cfg(foo)]
Bar {
#[cfg(foo)]
baz: u32,
}
} |
That's the whole point of this debate. I want to propose this add because otherwise I'll have to update how |
ping @rust-lang/doc, any thoughts on this PR? |
er, @rust-lang/docs |
I basically second @QuietMisdreavus ; I think this has the possibility of introducing more problems. |
I think it's way too early as well. I'll close it then and we'll discuss about it later in the future. |
Sounds like this should be closed, so I'm closing! |
It's been a question since a while now. Should we display
cfg
flags or not? An example of the output:If yes, should we display it like this or in another way?
cc @rust-lang/docs