Merged
Conversation
This is only active when the `doc_cfg` feature is active. The implicit cfg can be overridden via #[doc(cfg(...))], so e.g. to hide a #[cfg] you can use something like: ```rust #[cfg(unix)] #[doc(cfg(all()))] pub struct Unix; ``` (since `all()` is always true, it is never shown in the docs)
By adding #![doc(cfg_hide(foobar))] to the crate attributes the cfg #[cfg(foobar)] (and _only_ that _exact_ cfg) will not be implicitly treated as a doc(cfg) to render a message in the documentation.
720f695 to
6a31840
Compare
This comment has been minimized.
This comment has been minimized.
6a31840 to
edebce9
Compare
This comment has been minimized.
This comment has been minimized.
* Remove "bool_to_options" feature * Update version for compiler feature * rustfmt
edebce9 to
779091e
Compare
This comment has been minimized.
This comment has been minimized.
… they are not useful
779091e to
09c7688
Compare
jyn514
suggested changes
Oct 6, 2021
| #[doc(cfg(), cfg(foo, bar))] | ||
| //~^ ERROR | ||
| //~^^ ERROR | ||
| #[doc(cfg(foo), cfg(bar))] // ok! |
Member
There was a problem hiding this comment.
This will be ignored, right, because you use single()? That doesn't seem right, either they should be ANDed or it should give a hard error.
Member
Author
There was a problem hiding this comment.
This is valid and is supposed to work. I added it to ensure that rustdoc was happy with it.
Member
Author
There was a problem hiding this comment.
Might be better to put it into a rustdoc test though. I'll do that.
Member
Author
There was a problem hiding this comment.
We actually already have a test for this: https://github.com/rust-lang/rust/blob/master/src/test/rustdoc/doc-cfg.rs#L100
6 tasks
Member
|
@bors r+ |
Collaborator
|
📌 Commit 09c7688 has been approved by |
Thomasdezeeuw
added a commit
to Thomasdezeeuw/heph
that referenced
this pull request
Oct 10, 2021
Following rust-lang/rust#89596 it now docs all `cfg` attributes.
eggyal
added a commit
to eggyal/rattish
that referenced
this pull request
Oct 14, 2021
These are superfluous now rust-lang/rust#89596 has landed.
eggyal
added a commit
to eggyal/rattish
that referenced
this pull request
Oct 14, 2021
These are superfluous now rust-lang/rust#89596 has landed.
eggyal
added a commit
to eggyal/rattish
that referenced
this pull request
Oct 14, 2021
These are superfluous now rust-lang/rust#89596 has landed.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Oct 14, 2021
…, r=notriddle Fix missing remaining compiler specific cfg information Follow-up of rust-lang#89596. We forgot a few of them:   r? `@notriddle`
arqunis
added a commit
to serenity-rs/serenity
that referenced
this pull request
Oct 16, 2021
This removes all uses of the `#[doc(cfg(...))]` attribute. The purpose of this attribute was to tell `rustdoc` to add an annotation, which would inform users what features an item (module, struct, trait, method, etc.) needed. However, in the latest Nightly, [this attribute is implicit when `#![feature(doc_cfg)]` is enabled][rust-pr]. Thus, our usage of this attribute is unnecessary and we can remove it. [rust-pr]: rust-lang/rust#89596
tyranron
added a commit
to cucumber-rs/cucumber
that referenced
this pull request
Oct 25, 2021
- bump up MSRV to 1.56.0 - remove explicit `#[doc(cfg(...))]` attribute usage where it's implied by `#[cfg(...)]` (rust-lang/rust#89596)
tyranron
added a commit
to cucumber-rs/cucumber
that referenced
this pull request
Oct 25, 2021
- bump up MSRV to 1.56.0 - remove explicit `#[doc(cfg(...))]` attribute usage where it's implied by `#[cfg(...)]` (rust-lang/rust#89596)
tyranron
added a commit
to cucumber-rs/cucumber
that referenced
this pull request
Oct 25, 2021
- bump up MSRV to 1.56.0 - remove explicit `#[doc(cfg(...))]` attribute usage where it's implied by `#[cfg(...)]` (rust-lang/rust#89596)
zecakeh
pushed a commit
to ruma/ruma-client
that referenced
this pull request
Mar 4, 2025
They are now implied: rust-lang/rust#89596
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a reopening of #79341, rebased and modified a bit (we made a lot of refactoring in rustdoc's types so they needed to be reflected in this PR as well):
hidden_cfgis now in theCacheinstead ofDocContextbecausecfginformation isn't stored anymore onclean::Attributestype but instead computed on-demand, so we need this information in later parts of rustdoc.bool_to_optionsfeature (which makes the code a bit simpler to read forSingleExttrait implementation.There is only one thing I couldn't figure out: this comment
How/why should they differ?
EDIT: this part has been solved, the current code was fine, just needed a little simplification.
cc @Nemo157
r? @jyn514
Original PR description:
This is only active when the
doc_cfgfeature is active.The implicit cfg can be overridden via
#[doc(cfg(...))], so e.g. to hide a#[cfg]you can use something like:By adding
#![doc(cfg_hide(foobar))]to the crate attributes the cfg#[cfg(foobar)](and only that exact cfg) will not be implicitly treated as adoc(cfg)to render a message in the documentation.