Skip to content

break rustc_expand-rustc_middle dependency - #161263

Open
mejrs wants to merge 2 commits into
rust-lang:mainfrom
mejrs:expand
Open

break rustc_expand-rustc_middle dependency#161263
mejrs wants to merge 2 commits into
rust-lang:mainfrom
mejrs:expand

Conversation

@mejrs

@mejrs mejrs commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Back in #145354 (cc @Kobzol), support for caching derive macros was added. With this, rustc_expand was made to depend on rustc_middle.

This PR breaks that dependency so that rustc_expand and rustc_builtin_macros can compile in parallel with rustc_middle.

The timing graph goes from this:
image

to this:
image

Note that the interval where we're exclusively compiling rustc_middle has become much shorter.
Full graphs here:
cargo-timing-main.html
cargo-timing-expand2.html

It's somewhat hard to benchmark reliably but a full bootstrap is about 5-10 seconds faster overall, on a machine with an Amd Ryzen 5900x 12-core processor.

@rustbot

rustbot commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

Some changes occurred in src/tools/cargo

cc @weihanglo

@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 Aug 17, 2026
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 17, 2026
@rustbot

rustbot commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

r? @JonathanBrouwer

rustbot has assigned @JonathanBrouwer.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 75 candidates
  • Random selection from 15 candidates

@rustbot

This comment has been minimized.

@mejrs

mejrs commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Shouldn't show up in single job benchmarks, but still:

I'll also do another benchmark later where the derive expander is always called through the atomic ref (with enable called depending on whether derive macros are cached or not)

@bors try @rust-timer queue

@rust-timer

Copy link
Copy Markdown
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 17, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 17, 2026
break rustc_expand-rustc_middle dependency
@rust-bors

rust-bors Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: e3517d8 (e3517d88b373f392501ed15f89f9f57cd5370ddf)
Base parent: e702eca (e702ecae8a3e3756e8a499f8592be1e3efac0e8f)

@rust-timer

Copy link
Copy Markdown
Collaborator

Queued e3517d8 with parent e702eca, future comparison URL.
There is currently 1 preceding artifact in the queue.
It will probably take at least ~1.7 hours until the benchmark run finishes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-perf Status: Waiting on a perf run to be completed. 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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants