fix: Every workspace should have a proc-macro server - #23111
Merged
Veykril merged 1 commit intoAug 13, 2026
Conversation
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
force-pushed
the
fix-proc-macro-srv-discovered-workspaces
branch
from
August 10, 2026 17:07
7c5ebe5 to
8586c11
Compare
Veykril
approved these changes
Aug 13, 2026
This was referenced Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.