Skip to content

Conversation

@GuillaumeGomez
Copy link
Member

This enables the --generate-macro-expansion rustdoc flag, generating possibility to expand macros directly in source code pages (#137229).

Needed this new feature when I was working on #149919 and I thought "why not enable it by default?". So here we go.

Not too sure who to r? here so:

r? @Kobzol

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Dec 15, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 15, 2025

Failed to set assignee to here: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

@GuillaumeGomez
Copy link
Member Author

Huuuum. Interesting.

r? kobzol

@rustbot
Copy link
Collaborator

rustbot commented Dec 15, 2025

kobzol is not on the review rotation at the moment.
They may take a while to respond.

Copy link
Member

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, let's test it on rustc.

View changes since this review

@Kobzol
Copy link
Member

Kobzol commented Dec 15, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 15, 2025

📌 Commit 4cfe4fb has been approved by Kobzol

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 15, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Dec 16, 2025
…on, r=Kobzol

Generate macro expansion for rust compiler crates docs

This enables the `--generate-macro-expansion` rustdoc flag, generating possibility to expand macros directly in source code pages (rust-lang#137229).

Needed this new feature when I was working on rust-lang#149919 and I thought "why not enable it by default?". So here we go.

Not too sure who to r? here so:

r? `@kobzol`
bors added a commit that referenced this pull request Dec 16, 2025
Rollup of 14 pull requests

Successful merges:

 - #148756 (Warn on codegen attributes on required trait methods)
 - #148790 (Add new Tier-3 target: riscv64im-unknown-none-elf)
 - #149271 (feat: dlopen Enzyme)
 - #149459 (std: sys: fs: uefi: Implement set_times and set_perm)
 - #149771 (bootstrap readme: make easy to read when editor wrapping is not enabled)
 - #149856 (Provide an extended framework for type visit, for use in rust-analyzer)
 - #149950 (Simplify how inline asm handles `MaybeUninit`)
 - #150014 (Metadata loader cleanups)
 - #150021 (document that mpmc channels deliver an item to (at most) one receiver)
 - #150022 (Generate macro expansion for rust compiler crates docs)
 - #150029 (Update books)
 - #150031 (assert impossible branch is impossible)
 - #150034 (do not add `I-prioritize` when `F-*` labels are present)
 - #150036 (Use the embeddable filename for coverage artifacts)

r? `@ghost`
`@rustbot` modify labels: rollup
@Zalathar
Copy link
Member

Possibly failed in rollup? #150039 (comment)

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 16, 2025
@Zalathar
Copy link
Member

@bors try jobs=dist-x86_64-linux-alt

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Dec 16, 2025
Generate macro expansion for rust compiler crates docs

try-job: dist-x86_64-linux-alt
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Dec 16, 2025

💔 Test for 0ac0f58 failed: CI. Failed jobs:

@GuillaumeGomez
Copy link
Member Author

GuillaumeGomez commented Dec 16, 2025

Was able to write a minified code to reproduce the bug:

struct Bar {
    bla: bool,
}

macro_rules! f {
    () => {{ false }}
}

const X: Bar = Bar {
    bla: !f!(),
};

Just need to run it with --generate-macro-expansion. I suppose it's yet again a ! issue.

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Dec 17, 2025
…otamofek

[rustdoc] Fix invalid handling of field followed by negated macro call

This is the bug uncovered in rust-lang#150022. Once fixed Ill rebuild all compiler docs and see if we can enable the option for compiler docs. =D

It's a weird case where we extracted some tokens out of the iterator and then, when checking next items (from this iterator), it didn't find the `:` token, and therefore badly assumed the token kind.

The solution I came up with is to instead not extract tokens from the iterator and to count how many tokens are in the current path. So when iterate over the items, instead of having a mix of extracted tokens and tokens still inside the iterator, we now only iterate over the iterator.

The biggest change here is that `get_full_ident_path` will return an option instead of a `Vec`, and if it's contains `:` (one, not two), then it will return `None` and the `:` will be handled like any token and not like a path (which is more correct imo).

r? `@yotamofek`
rust-timer added a commit that referenced this pull request Dec 18, 2025
Rollup merge of #150099 - GuillaumeGomez:field-handling, r=yotamofek

[rustdoc] Fix invalid handling of field followed by negated macro call

This is the bug uncovered in #150022. Once fixed Ill rebuild all compiler docs and see if we can enable the option for compiler docs. =D

It's a weird case where we extracted some tokens out of the iterator and then, when checking next items (from this iterator), it didn't find the `:` token, and therefore badly assumed the token kind.

The solution I came up with is to instead not extract tokens from the iterator and to count how many tokens are in the current path. So when iterate over the items, instead of having a mix of extracted tokens and tokens still inside the iterator, we now only iterate over the iterator.

The biggest change here is that `get_full_ident_path` will return an option instead of a `Vec`, and if it's contains `:` (one, not two), then it will return `None` and the `:` will be handled like any token and not like a path (which is more correct imo).

r? `@yotamofek`
@rustbot
Copy link
Collaborator

rustbot commented Dec 18, 2025

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@GuillaumeGomez
Copy link
Member Author

@bors try jobs=dist-x86_64-linux-alt

rust-bors bot added a commit that referenced this pull request Dec 18, 2025
Generate macro expansion for rust compiler crates docs

try-job: dist-x86_64-linux-alt
@rust-bors

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Dec 18, 2025

💔 Test for 97dd392 failed: CI. Failed jobs:

@GuillaumeGomez
Copy link
Member Author

Flaky failure, let's retry...

@bors try jobs=dist-x86_64-linux-alt

rust-bors bot added a commit that referenced this pull request Dec 18, 2025
Generate macro expansion for rust compiler crates docs

try-job: dist-x86_64-linux-alt
@rust-bors

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

#1 [internal] booting buildkit
#1 pulling image ghcr.io/rust-lang/buildkit:buildx-stable-1
#1 pulling image ghcr.io/rust-lang/buildkit:buildx-stable-1 15.2s done
#1 ERROR: Error response from daemon: Head "https://ghcr.io/v2/rust-lang/buildkit/manifests/buildx-stable-1": Get "https://ghcr.io/token?account=rust-lang&scope=repository%3Arust-lang%2Fbuildkit%3Apull&service=ghcr.io": context deadline exceeded
------
 > [internal] booting buildkit:
------
ERROR: failed to build: Error response from daemon: Head "https://ghcr.io/v2/rust-lang/buildkit/manifests/buildx-stable-1": Get "https://ghcr.io/token?account=rust-lang&scope=repository%3Arust-lang%2Fbuildkit%3Apull&service=ghcr.io": context deadline exceeded
Command failed. Attempt 2/5:
#0 building with "magical_hugle" instance using docker-container driver

#1 [internal] booting buildkit
#1 pulling image ghcr.io/rust-lang/buildkit:buildx-stable-1
---
#4 [auth] rust-lang/centos:pull token for ghcr.io
#4 DONE 0.0s

#3 [internal] load metadata for ghcr.io/rust-lang/centos:7
#3 ERROR: failed to authorize: failed to fetch oauth token: Post "https://ghcr.io/token": dial tcp 140.82.116.33:443: i/o timeout
------
 > [internal] load metadata for ghcr.io/rust-lang/centos:7:
------
Dockerfile:5
--------------------
   3 |     # actually use newer APIs in rustc or std without a fallback. It's more
   4 |     # important that we match glibc for ELF symbol versioning.
   5 | >>> FROM ghcr.io/rust-lang/centos:7
   6 |     
   7 |     WORKDIR /build
--------------------
ERROR: failed to build: failed to solve: failed to fetch oauth token: Post "https://ghcr.io/token": dial tcp 140.82.116.33:443: i/o timeout
Command failed. Attempt 3/5:
#0 building with "magical_hugle" instance using docker-container driver

#1 [internal] load build definition from Dockerfile
#1 DONE 0.0s
---
#6 resolve ghcr.io/rust-lang/centos:7@sha256:be65f488b7764ad3638f236b7b515b3678369a5124c47b8d32916d6487418ea4 done
#6 DONE 0.0s

#7 importing cache manifest from ghcr.io/rust-lang/rust-ci-cache:5ecea30df98e67536ba4bd4d7f20f76c4163b56ad6d90a3ea6dd2dbf550a90942f048e808ef1ad94261c9f2d1478a417a807f760ffb58b62b07388b2315910d1
#7 ERROR: failed to configure registry cache importer: failed to do request: Head "https://ghcr.io/v2/rust-lang/rust-ci-cache/manifests/5ecea30df98e67536ba4bd4d7f20f76c4163b56ad6d90a3ea6dd2dbf550a90942f048e808ef1ad94261c9f2d1478a417a807f760ffb58b62b07388b2315910d1": dial tcp 140.82.116.33:443: i/o timeout

#5 [internal] load build context
#5 transferring context: 9.35kB done
#5 DONE 0.0s

@GuillaumeGomez
Copy link
Member Author

Try build is broken I guess... Anyway.

@bors r=kobzol

@bors
Copy link
Collaborator

bors commented Dec 18, 2025

📌 Commit c820f46 has been approved by kobzol

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Dec 18, 2025

🌲 The tree is currently closed for pull requests below priority 1000. This pull request will be tested once the tree is reopened.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 18, 2025
@rust-bors
Copy link

rust-bors bot commented Dec 18, 2025

☀️ Try build successful (CI)
Build commit: 13a117f (13a117fd197aca27738e45528a76fbfdd650d6dc, parent: ed0006a7ba2dc8fabab8ea94d6f843886311b3c7)

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Dec 18, 2025
…on, r=kobzol

Generate macro expansion for rust compiler crates docs

This enables the `--generate-macro-expansion` rustdoc flag, generating possibility to expand macros directly in source code pages (rust-lang#137229).

Needed this new feature when I was working on rust-lang#149919 and I thought "why not enable it by default?". So here we go.

Not too sure who to r? here so:

r? `@kobzol`
bors added a commit that referenced this pull request Dec 18, 2025
…uwer

Rollup of 11 pull requests

Successful merges:

 - #145933 (Expand `str_as_str` to more types)
 - #148849 (Set -Cpanic=abort in windows-msvc stack protector tests)
 - #149925 (`cfg_select!`: parse unused branches)
 - #150022 (Generate macro expansion for rust compiler crates docs)
 - #150024 (Support recursive delegation)
 - #150048 (std_detect: AArch64 Darwin: expose SME F16F16 and B16B16 features)
 - #150083 (tests/run-make-cargo/same-crate-name-and-macro-name: New regression test)
 - #150102 (Fixed ICE for EII with multiple defaults due to duplicate definition in nameres)
 - #150124 (unstable.rs: fix typos in comments (implementatble -> implementable))
 - #150125 (Port `#[rustc_lint_opt_deny_field_access]` to attribute parser)
 - #150126 (Subtree sync for rustc_codegen_cranelift)

Failed merges:

 - #150127 (Port `#[rustc_lint_untracked_query_information]` and `#[rustc_lint_diagnostics]` to using attribute parsers)

r? `@ghost`
`@rustbot` modify labels: rollup
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Dec 18, 2025
…on, r=kobzol

Generate macro expansion for rust compiler crates docs

This enables the `--generate-macro-expansion` rustdoc flag, generating possibility to expand macros directly in source code pages (rust-lang#137229).

Needed this new feature when I was working on rust-lang#149919 and I thought "why not enable it by default?". So here we go.

Not too sure who to r? here so:

r? ``@kobzol``
bors added a commit that referenced this pull request Dec 18, 2025
…uwer

Rollup of 12 pull requests

Successful merges:

 - #145933 (Expand `str_as_str` to more types)
 - #148849 (Set -Cpanic=abort in windows-msvc stack protector tests)
 - #149925 (`cfg_select!`: parse unused branches)
 - #149952 (Suggest struct pattern when destructuring Range with .. syntax)
 - #150022 (Generate macro expansion for rust compiler crates docs)
 - #150024 (Support recursive delegation)
 - #150048 (std_detect: AArch64 Darwin: expose SME F16F16 and B16B16 features)
 - #150083 (tests/run-make-cargo/same-crate-name-and-macro-name: New regression test)
 - #150102 (Fixed ICE for EII with multiple defaults due to duplicate definition in nameres)
 - #150124 (unstable.rs: fix typos in comments (implementatble -> implementable))
 - #150125 (Port `#[rustc_lint_opt_deny_field_access]` to attribute parser)
 - #150126 (Subtree sync for rustc_codegen_cranelift)

Failed merges:

 - #150127 (Port `#[rustc_lint_untracked_query_information]` and `#[rustc_lint_diagnostics]` to using attribute parsers)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants