Skip to content

Conversation

GuillaumeGomez
Copy link
Member

@GuillaumeGomez GuillaumeGomez commented Mar 24, 2025

Implementation of rust-lang/rfcs#3631.

This implementation actually resulted in a lot of simplifications:

  • All cfg computation is now done in one place: propagate_doc_cfg.rs. Because (trait) impls 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.
  • Because there is cfg inheritance, we can keep track of them in one place (in propagate_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 only cfg 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 new CfgInfo type.
  • I also suspect that Cfg::simplify_with could either be removed or at least used directly into propagate_doc_cfg.rs when we compute cfgs. 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 in rustc (like stdarch) are using it, so we need to have a nightly released with this PR before I can switch to the new feature.

r? ghost

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Mar 24, 2025
@rust-log-analyzer

This comment has been minimized.

@petrochenkov
Copy link
Contributor

What remains to be done:

I'd also want to block the stabilization on landing #138844 to avoid a stable rustdoc feature relying on externally observable hacks in rustc.
The crater run in #138844 returned mostly clean, so I expect it to land soon.

@GuillaumeGomez
Copy link
Member Author

Noted! And that will be a nice improvement, thanks!

Just one thing left for the cfg expansion missing: #[cfg_attr(blabla, derive(Debug))]. In this case, the cfg is not kept in the generated derive items. It's been in my TODO list for a long time now. ^^'

@petrochenkov
Copy link
Contributor

Just one thing left for the cfg expansion missing: #[cfg_attr(blabla, derive(Debug))]

Do you mean like in #138515? :)

@GuillaumeGomez
Copy link
Member Author

You're my hero! Gonna need to handle this new attribute then. :)

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Mar 25, 2025

☔ The latest upstream changes (presumably #138923) made this pull request unmergeable. Please resolve the merge conflicts.

@GuillaumeGomez GuillaumeGomez force-pushed the rfc-3631 branch 2 times, most recently from d88598f to db25eea Compare March 27, 2025 10:18
@rustbot rustbot added the A-run-make Area: port run-make Makefiles to rmake.rs label Mar 27, 2025
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Mar 27, 2025

☔ The latest upstream changes (presumably #138927) made this pull request unmergeable. Please resolve the merge conflicts.

@GuillaumeGomez GuillaumeGomez force-pushed the rfc-3631 branch 2 times, most recently from b8cb424 to b581ce1 Compare March 28, 2025 23:54
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez GuillaumeGomez force-pushed the rfc-3631 branch 4 times, most recently from 71369a1 to fbee8a9 Compare April 1, 2025 15:52
@rust-log-analyzer

This comment has been minimized.

ogoffart added a commit to slint-ui/slint that referenced this pull request Oct 8, 2025
Rust nightly removed this:

```
error[E0557]: feature has been removed
 --> internal/interpreter/lib.rs:4:38
  |
4 | #![cfg_attr(docsrs, feature(doc_cfg, 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`

```
Jarema added a commit to nats-io/nats.rs that referenced this pull request Oct 8, 2025
reference: rust-lang/rust#138907

Signed-off-by: Tomasz Pietrek <[email protected]>
@Jarema Jarema mentioned this pull request Oct 8, 2025
Jarema added a commit to nats-io/nats.rs that referenced this pull request Oct 8, 2025
reference: rust-lang/rust#138907

Signed-off-by: Tomasz Pietrek <[email protected]>
lifegpc added a commit to lifegpc/msg-tool that referenced this pull request Oct 8, 2025
tomcur added a commit to endoli/fiksi that referenced this pull request Oct 8, 2025
dcoles added a commit to flipperzero-rs/flipperzero-rs that referenced this pull request Oct 9, 2025
`doc_auto_cfg` has been removed from the current Rust version,
which caused rustdoc breakages.

See rust-lang/rust#138907
novacrazy pushed a commit to fizyk20/generic-array that referenced this pull request Oct 9, 2025
doc_auto_cfg was merged into doc_cfg in rust-lang/rust#138907
rklaehn added a commit to n0-computer/iroh that referenced this pull request Oct 9, 2025
- fix some links
- replace doc_auto_cfg with doc_cfg as instructed by the failed docs.rs run

[INFO] [stderr] 253 | #![cfg_attr(iroh_docsrs, feature(doc_auto_cfg))]
[INFO] [stderr]     |                                  ^^^^^^^^^^^^ feature has been removed
[INFO] [stderr]     |
[INFO] [stderr]     = note: removed in CURRENT_RUSTC_VERSION; see <rust-lang/rust#138907> for more information
[INFO] [stderr]     = note: merged into `doc_cfg`
github-merge-queue bot pushed a commit to n0-computer/iroh that referenced this pull request Oct 9, 2025
## Description

Try to fix docs.rs docs generation

- fix some links
- replace doc_auto_cfg with doc_cfg as instructed by the failed docs.rs
run

[INFO] [stderr] 253 | #![cfg_attr(iroh_docsrs, feature(doc_auto_cfg))]
[INFO] [stderr] | ^^^^^^^^^^^^ feature has been removed
[INFO] [stderr]     |
[INFO] [stderr] = note: removed in CURRENT_RUSTC_VERSION; see
<rust-lang/rust#138907> for more information
[INFO] [stderr]     = note: merged into `doc_cfg`

## Breaking Changes

None

## Notes & open questions

Not sure how to test this.

## Change checklist
<!-- Remove any that are not relevant. -->
- [ ] Self-review.
- [ ] Documentation updates following the [style
guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text),
if relevant.
- [ ] Tests if relevant.
- [ ] All breaking changes documented.
- [ ] List all breaking changes in the above "Breaking Changes" section.
- [ ] Open an issue or PR on any number0 repos that are affected by this
breaking change. Give guidance on how the updates should be handled or
do the actual updates themselves. The major ones are:
    - [ ] [`quic-rpc`](https://github.com/n0-computer/quic-rpc)
    - [ ] [`iroh-gossip`](https://github.com/n0-computer/iroh-gossip)
    - [ ] [`iroh-blobs`](https://github.com/n0-computer/iroh-blobs)
    - [ ] [`dumbpipe`](https://github.com/n0-computer/dumbpipe)
    - [ ] [`sendme`](https://github.com/n0-computer/sendme)
github-merge-queue bot pushed a commit to n0-computer/iroh that referenced this pull request Oct 9, 2025
## Description

Try to fix docs.rs docs generation

- fix some links
- replace doc_auto_cfg with doc_cfg as instructed by the failed docs.rs
run

[INFO] [stderr] 253 | #![cfg_attr(iroh_docsrs, feature(doc_auto_cfg))]
[INFO] [stderr] | ^^^^^^^^^^^^ feature has been removed
[INFO] [stderr]     |
[INFO] [stderr] = note: removed in CURRENT_RUSTC_VERSION; see
<rust-lang/rust#138907> for more information
[INFO] [stderr]     = note: merged into `doc_cfg`

## Breaking Changes

None

## Notes & open questions

Not sure how to test this.

## Change checklist
<!-- Remove any that are not relevant. -->
- [ ] Self-review.
- [ ] Documentation updates following the [style
guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text),
if relevant.
- [ ] Tests if relevant.
- [ ] All breaking changes documented.
- [ ] List all breaking changes in the above "Breaking Changes" section.
- [ ] Open an issue or PR on any number0 repos that are affected by this
breaking change. Give guidance on how the updates should be handled or
do the actual updates themselves. The major ones are:
    - [ ] [`quic-rpc`](https://github.com/n0-computer/quic-rpc)
    - [ ] [`iroh-gossip`](https://github.com/n0-computer/iroh-gossip)
    - [ ] [`iroh-blobs`](https://github.com/n0-computer/iroh-blobs)
    - [ ] [`dumbpipe`](https://github.com/n0-computer/dumbpipe)
    - [ ] [`sendme`](https://github.com/n0-computer/sendme)
acul009 pushed a commit to acul009/iced that referenced this pull request Oct 9, 2025
chrjabs added a commit to chrjabs/rustsat that referenced this pull request Oct 12, 2025
Nightly feature `doc_auto_cfg` is merged into `doc_cfg` rust-lang/rust#138907
chrjabs added a commit to chrjabs/rustsat that referenced this pull request Oct 12, 2025
Nightly feature `doc_auto_cfg` is merged into `doc_cfg` rust-lang/rust#138907
BurntSushi added a commit to rust-lang/regex that referenced this pull request Oct 13, 2025
In rust-lang/rust#138907, the `doc_auto_cfg`
feature was subsumed by `doc_cfg`. This does overall look like we're on
a path toward stabilization, which is great.

One problem here though is that a bunch of crates use the `cfg` `docsrs`
to enable `doc_auto_cfg`. So if we enable it, then it causes those
crates to stop compiling. This is overall very annoying, and I don't
know how to unfuck things. So I changed the `cfg` knob to `docsrs_regex`
which, doesn't quite provide a guarantee, but gets us closer to being
masters of our own destiny.
BurntSushi added a commit to rust-lang/regex that referenced this pull request Oct 13, 2025
In rust-lang/rust#138907, the `doc_auto_cfg`
feature was subsumed by `doc_cfg`. This does overall look like we're on
a path toward stabilization, which is great.

One problem here though is that a bunch of crates use the `cfg` `docsrs`
to enable `doc_auto_cfg`. So if we enable it, then it causes those
crates to stop compiling. This is overall very annoying, and I don't
know how to unfuck things. So I changed the `cfg` knob to `docsrs_regex`
which, doesn't quite provide a guarantee, but gets us closer to being
masters of our own destiny.
BurntSushi added a commit to rust-lang/regex that referenced this pull request Oct 13, 2025
In rust-lang/rust#138907, the `doc_auto_cfg`
feature was subsumed by `doc_cfg`. This does overall look like we're on
a path toward stabilization, which is great.

One problem here though is that a bunch of crates use the `cfg` `docsrs`
to enable `doc_auto_cfg`. So if we enable it, then it causes those
crates to stop compiling. This is overall very annoying, and I don't
know how to unfuck things. So I changed the `cfg` knob to `docsrs_regex`
which, doesn't quite provide a guarantee, but gets us closer to being
masters of our own destiny.
BurntSushi added a commit to BurntSushi/jiff that referenced this pull request Oct 13, 2025
In rust-lang/rust#138907, the `doc_auto_cfg`
feature was subsumed by `doc_cfg`. This does overall looks like we're on
a path toward stabilization, which is great.

One problem here though is that a bunch of crates use the `cfg`
`docsrs` to enable `doc_auto_cfg`. So if we enable it, then it causes
those crates to emit hard errors. This is overall very annoying, and
I don't know how to unfuck things. So I changed the `cfg` knob to
`docsrs_jiff` which, doesn't quite provide a guarantee, but gets us
closer to being masters of our own destiny.

See also a similar change made to `regex`:
rust-lang/regex#1305
BurntSushi added a commit to BurntSushi/jiff that referenced this pull request Oct 13, 2025
In rust-lang/rust#138907, the `doc_auto_cfg`
feature was subsumed by `doc_cfg`. This does overall looks like we're on
a path toward stabilization, which is great.

One problem here though is that a bunch of crates use the `cfg`
`docsrs` to enable `doc_auto_cfg`. So if we enable it, then it causes
those crates to emit hard errors. This is overall very annoying, and
I don't know how to unfuck things. So I changed the `cfg` knob to
`docsrs_jiff` which, doesn't quite provide a guarantee, but gets us
closer to being masters of our own destiny.

See also a similar change made to `regex`:
rust-lang/regex#1305
emuell added a commit to emuell/phonic that referenced this pull request Oct 14, 2025
shepmaster added a commit to shepmaster/snafu that referenced this pull request Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-run-make Area: port run-make Makefiles to rmake.rs merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.