Skip to content

Change query proc macro to be more rust-analyzer friendly#152422

Open
Zoxc wants to merge 1 commit intorust-lang:mainfrom
Zoxc:query-macro-tweaks
Open

Change query proc macro to be more rust-analyzer friendly#152422
Zoxc wants to merge 1 commit intorust-lang:mainfrom
Zoxc:query-macro-tweaks

Conversation

@Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Feb 10, 2026

This changes the query proc macro to be more rust-analyzer friendly.

  • Types in the macro now have a proper span
  • Some functions have their span hidden so they don't show up when hovering over the query name
  • Added a hint on the provider field on how to find providers. That is shown when hovering over the query name
  • Linked query name to the provider field on all queries, not just ones with caching
  • Added tooltip for the query modifiers by linking to the new types in rustc_middle:::query::modifiers

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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. labels Feb 10, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 10, 2026

r? @fmease

rustbot has assigned @fmease.
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 21 candidates
  • Random selection from 13 candidates

@fmease
Copy link
Member

fmease commented Feb 10, 2026

I might take a look at this PR but I'm not sure if I'm the right person since I've disabled proc-macro expansion for r-l/r checkouts to avoid rust analyzer frying my machine, so I can't really experiment with this patch locally.

@rust-bors

This comment has been minimized.

@Zoxc
Copy link
Contributor Author

Zoxc commented Feb 11, 2026

r? @Zalathar

@rustbot rustbot assigned Zalathar and unassigned fmease Feb 11, 2026
@Zoxc Zoxc force-pushed the query-macro-tweaks branch from cc3d630 to 1aaa7b0 Compare February 11, 2026 04:56
@rustbot

This comment has been minimized.

@Zalathar
Copy link
Member

I was initially worried about this breaking hover-docs and find-all-references (for the query method) from queries.rs, but it turns out that those already don't work. 😅

(They do appear to still work for calls to the query method.)

@Zalathar
Copy link
Member

I'm not seeing any tooltips for the query modifiers on my machine; hovering over the modifier name in the query body doesn't show anything for me.

Is it working for you?

@Zoxc Zoxc force-pushed the query-macro-tweaks branch from 1aaa7b0 to 47b4e02 Compare February 11, 2026 13:15
@Zoxc
Copy link
Contributor Author

Zoxc commented Feb 11, 2026

Is it working for you?

Yeah, on rust-analyzer 0.3.2786-standalone (c75729db68 2026-02-09). Do you see any other changes? It takes a while to compile the proc macros with rust-analyzer, so make sure its idle.

@rust-log-analyzer

This comment has been minimized.

@Zalathar
Copy link
Member

Yeah, on rust-analyzer 0.3.2786-standalone (c75729db68 2026-02-09). Do you see any other changes? It takes a while to compile the proc macros with rust-analyzer, so make sure its idle.

I updated r-a and hovering on modifiers works for me now, so it must have been sensitive to a recent change. 👍

@Zalathar
Copy link
Member

Looks good, thanks.

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 12, 2026

📌 Commit 47b4e02 has been approved by Zalathar

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 Feb 12, 2026
Zalathar added a commit to Zalathar/rust that referenced this pull request Feb 12, 2026
Change query proc macro to be more rust-analyzer friendly

This changes the query proc macro to be more rust-analyzer friendly.

- Types in the macro now have a proper span
- Some functions have their span hidden so they don't show up when hovering over the query name
- Added a hint on the provider field on how to find providers. That is shown when hovering over the query name
- Linked query name to the provider field on all queries, not just ones with caching
- Added tooltip for the query modifiers by linking to the new types in `rustc_middle:::query::modifiers`
@rust-bors rust-bors bot 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 Feb 12, 2026
@rust-bors

This comment has been minimized.

@Zoxc Zoxc force-pushed the query-macro-tweaks branch from 47b4e02 to 8cc4b93 Compare February 12, 2026 11:40
@rustbot
Copy link
Collaborator

rustbot commented Feb 12, 2026

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.

@Zalathar
Copy link
Member

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 12, 2026

📌 Commit 8cc4b93 has been approved by Zalathar

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 Feb 12, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 12, 2026
Change query proc macro to be more rust-analyzer friendly

This changes the query proc macro to be more rust-analyzer friendly.

- Types in the macro now have a proper span
- Some functions have their span hidden so they don't show up when hovering over the query name
- Added a hint on the provider field on how to find providers. That is shown when hovering over the query name
- Linked query name to the provider field on all queries, not just ones with caching
- Added tooltip for the query modifiers by linking to the new types in `rustc_middle:::query::modifiers`
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 12, 2026
Change query proc macro to be more rust-analyzer friendly

This changes the query proc macro to be more rust-analyzer friendly.

- Types in the macro now have a proper span
- Some functions have their span hidden so they don't show up when hovering over the query name
- Added a hint on the provider field on how to find providers. That is shown when hovering over the query name
- Linked query name to the provider field on all queries, not just ones with caching
- Added tooltip for the query modifiers by linking to the new types in `rustc_middle:::query::modifiers`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants