Skip to content

fix: Every workspace should have a proc-macro server - #23111

Merged
Veykril merged 1 commit into
rust-lang:masterfrom
Wilfred:fix-proc-macro-srv-discovered-workspaces
Aug 13, 2026
Merged

fix: Every workspace should have a proc-macro server#23111
Veykril merged 1 commit into
rust-lang:masterfrom
Wilfred:fix-proc-macro-srv-discovered-workspaces

Conversation

@Wilfred

@Wilfred Wilfred commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

fetch_proc_macros() zips proc_macro_clients with a per-workspace vec. We therefore require proc_macro_clients to have an item for every workspace, or we get "proc-macro-srv is not running" and no macro expansion for some workspaces.

This issue is more noticeable when using a discovery command, where it's common to have have several workspaces, but it can occur in plain cargo repositories too.

The logic was essentially if !same_workspaces, but this doesn't actually work. When a new workspace is added, switch_workspaces() updates self.workspaces, pushes to fetch_build_data_queue, and returns early.

When we actually check the proc macro clients, on the second invocation, we're seeing the new self.workspaces already and it looks like nothing has changed!

This was broken in #22766, and only partially fixed in #22865. Revert the code, and expand the doc comments.

A better solution would be to track proc macro initialisation state properly, but this fixes r-a on the >1 workspaces case today.

AI disclosure: Bisected with help by AI.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 10, 2026
fetch_proc_macros() zips proc_macro_clients with a per-workspace
vec. We therefore require proc_macro_clients to have an item for every
workspace, or we get "proc-macro-srv is not running" and no macro
expansion for some workspaces.

This issue is more noticeable when using a discovery command, where it's
common to have have several workspaces, but it can occur in plain
cargo repositories too.

The logic was essentially `if !same_workspaces`, but this doesn't
actually work. When a new workspace is added, switch_workspaces()
updates self.workspaces, pushes to fetch_build_data_queue, and returns
early.

When we actually check the proc macro clients, on the second
invocation, we're seeing the *new* self.workspaces already and it
looks like nothing has changed!

This was broken in rust-lang#22766, and only partially
fixed in rust-lang#22865. Revert the code, and expand
the doc comments.

A better solution would be to track proc macro initialisation state
properly, but this fixes r-a on the >1 workspaces case today.

AI disclosure: Bisected with help by AI.
@Wilfred
Wilfred force-pushed the fix-proc-macro-srv-discovered-workspaces branch from 7c5ebe5 to 8586c11 Compare August 10, 2026 17:07
@Veykril
Veykril added this pull request to the merge queue Aug 13, 2026
Merged via the queue into rust-lang:master with commit 07f4f09 Aug 13, 2026
18 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants