-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Implement RFC 3631: add rustdoc doc_cfg features #138907
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
Conversation
This comment has been minimized.
This comment has been minimized.
Noted! And that will be a nice improvement, thanks! Just one thing left for the cfg expansion missing: |
Do you mean like in #138515? :) |
You're my hero! Gonna need to handle this new attribute then. :) |
4a05a52
to
3d2eef1
Compare
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #138923) made this pull request unmergeable. Please resolve the merge conflicts. |
d88598f
to
db25eea
Compare
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #138927) made this pull request unmergeable. Please resolve the merge conflicts. |
b8cb424
to
b581ce1
Compare
This comment has been minimized.
This comment has been minimized.
b581ce1
to
1cb7fac
Compare
This comment has been minimized.
This comment has been minimized.
71369a1
to
fbee8a9
Compare
This comment has been minimized.
This comment has been minimized.
…mease Fix removed version numbers of `doc_auto_cfg` and `doc_cfg_hide` Tracking issue: rust-lang#43781 The `doc_auto_cfg` and `doc_cfg_hide` features were removed in a recent nightly (by rust-lang#138907). I believe that the rustc version numbers at which the features were declared to be removed were incorrect, however, and should both be "1.92" (±1). As evidence in favour of this, the error we get from using this was: ```text error[E0557]: feature has been removed --> src/lib.rs:22:29 | 22 | #![cfg_attr(docsrs, feature(doc_auto_cfg))] | ^^^^^^^^^^^^ feature has been removed | = note: removed in 1.58.0; see <rust-lang#138907> for more information = note: merged into `doc_cfg` ``` Note especially the "removed in 1.58" claim. Further evidence is found in the comment further up this file: https://github.com/rust-lang/rust/blob/4ffeda10e10d4fa0c8edbd0dd9642d8ae7d3e66e/compiler/rustc_feature/src/removed.rs#L49-L53 I've chosen 1.92 as that was the milestone which rust-lang#138907 was added to. cc `@GuillaumeGomez`
Rollup merge of #147123 - DJMcNab:doc_cfg_merge_version, r=fmease Fix removed version numbers of `doc_auto_cfg` and `doc_cfg_hide` Tracking issue: #43781 The `doc_auto_cfg` and `doc_cfg_hide` features were removed in a recent nightly (by #138907). I believe that the rustc version numbers at which the features were declared to be removed were incorrect, however, and should both be "1.92" (±1). As evidence in favour of this, the error we get from using this was: ```text error[E0557]: feature has been removed --> src/lib.rs:22:29 | 22 | #![cfg_attr(docsrs, feature(doc_auto_cfg))] | ^^^^^^^^^^^^ feature has been removed | = note: removed in 1.58.0; see <#138907> for more information = note: merged into `doc_cfg` ``` Note especially the "removed in 1.58" claim. Further evidence is found in the comment further up this file: https://github.com/rust-lang/rust/blob/4ffeda10e10d4fa0c8edbd0dd9642d8ae7d3e66e/compiler/rustc_feature/src/removed.rs#L49-L53 I've chosen 1.92 as that was the milestone which #138907 was added to. cc `@GuillaumeGomez`
…_from_attrs, r=lolbinarycat Remove one loop in `extract_cfg_from_attrs` Follow-up of rust-lang#138907. r? lolbinarycat
This broke CI; see rust-lang/rust#138907.
…_from_attrs, r=lolbinarycat Remove one loop in `extract_cfg_from_attrs` Follow-up of rust-lang#138907. r? lolbinarycat
/// Allows deriving traits as per `SmartPointer` specification | ||
(removed, derive_smart_pointer, "1.84.0", Some(123430), Some("replaced by `CoercePointee`"), 131284), | ||
/// Tells rustdoc to automatically generate `#[doc(cfg(...))]`. | ||
(removed, doc_auto_cfg, "1.58.0", Some(43781), Some("merged into `doc_cfg`"), 138907), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the correct version? It generates an error message like:
error[E0557]: feature has been removed
--> zeroize/src/lib.rs:2:29
|
2 | #![cfg_attr(docsrs, feature(doc_auto_cfg))]
| ^^^^^^^^^^^^ feature has been removed
|
= note: removed in 1.58.0; see <https://github.com/rust-lang/rust/pull/138907> for more information
= note: merged into `doc_cfg`
Seems like it was added in 1.58.0, not removed in 1.58.0...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already fixed by #147123 which is gonna be in the next nightly.
`doc_auto_cfg` was merged into `doc_cfg` in rust-lang/rust#138907
This renames the `doc_auto_cfg` feature, following rust-lang/rust#138907. We install the latest nightly build in CI for docs generation; developers will need to update to at least 2025-09-28.
…ore-stripping-items, r=lolbinarycat [rustdoc] Move doc cfg propagation pass before items stripping passes Follow-up of rust-lang#138907. r? lolbinarycat
``` error[E0557]: feature has been removed --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/socket2-0.6.0/src/lib.rs:57:29 | 57 | #![cfg_attr(docsrs, feature(doc_auto_cfg))] | ^^^^^^^^^^^^ feature has been removed | = note: removed in CURRENT_RUSTC_VERSION; see <rust-lang/rust#138907> for more information = note: merged into `doc_cfg` ```
``` error[E0557]: feature has been removed --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/socket2-0.6.0/src/lib.rs:57:29 | 57 | #![cfg_attr(docsrs, feature(doc_auto_cfg))] | ^^^^^^^^^^^^ feature has been removed | = note: removed in CURRENT_RUSTC_VERSION; see <rust-lang/rust#138907> for more information = note: merged into `doc_cfg` ```
Nightly fails due to a dependency: ``` error[E0557]: feature has been removed --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/socket2-0.6.0/src/lib.rs:57:29 | 57 | #![cfg_attr(docsrs, feature(doc_auto_cfg))] | ^^^^^^^^^^^^ feature has been removed | = note: removed in CURRENT_RUSTC_VERSION; see <rust-lang/rust#138907> for more information = note: merged into `doc_cfg` ```
`doc_auto_cfg` has been removed in the latest nightly, see rust-lang/rust#138907. This feature was merged into `doc_cfg`. This fixes the rustdoc build in the latest nightly toolchain with docsrs feature enabled.
Implementation of rust-lang/rfcs#3631.
This implementation actually resulted in a lot of simplifications:
cfg
computation is now done in one place:propagate_doc_cfg.rs
. Because (trait)impl
s are not retrieved at the same time as the other items, we cannot perform this computation in the clean process, it needs to be after.cfg
inheritance, we can keep track of them in one place (inpropagate_doc_cfg.rs
), meaning we don't need to copy an item's attributes to its children anymore. Only exception: impl items. For them we clone onlycfg
attributes.propagate_doc_cfg.rs
is also now much simpler, much less need to keep track of parents, since everything we need is handled by the newCfgInfo
type.Cfg::simplify_with
could either be removed or at least used directly intopropagate_doc_cfg.rs
when we computecfg
s. Considering how big the PR already is, I'll do it in a follow-up.I didn't remove the
doc_cfg*
features in this PR because some dependencies used inrustc
(likestdarch
) are using it, so we need to have a nightly released with this PR before I can switch to the new feature.r? ghost