Skip to content

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
Copy link
Collaborator

rustbot commented Feb 11, 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

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?

}
}

/// The description of the query.
Copy link
Member

Choose a reason for hiding this comment

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

For these structs, I think it would be more helpful to leave the field comments on the QueryModifiers fields, and instead document the structs with something like:

/// Details of a parsed `desc` modifier.

That way the struct docs describe the struct itself, and express a clear connection to the corresponding modifier.

Copy link
Member

Choose a reason for hiding this comment

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

I would also suggest squashing the structs into the main commit.

(Or you could rearrange them into an earlier commit if you really want separate commits, but that's extra work.)

@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
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
REPOSITORY                                   TAG       IMAGE ID       CREATED       SIZE
ghcr.io/dependabot/dependabot-updater-core   latest    b72a662c47e3   11 days ago   790MB
=> Removing docker images...
Deleted Images:
untagged: ghcr.io/dependabot/dependabot-updater-core:latest
untagged: ghcr.io/dependabot/dependabot-updater-core@sha256:57ef9cc45f72cc4258ee1baa8243bc3cd55c0a0e570b6768c37346247be35f0d
deleted: sha256:b72a662c47e31df2e7bf59368b2b83be239f02a1baa721393717711a1a719df9
deleted: sha256:3e13ccd80f19769f39008cfc6549938e1ea4905f47b028c1df2dd6085191386c
deleted: sha256:842807995a512b2c5a9b241a3aecdbe79af6b0642d96fa5460cfcf0c9d8be295
deleted: sha256:0f9074b9f46f4570eb7cb4b65fcb3c3d909f9b1d14ca66b30508117b6deda303
deleted: sha256:2ca99cb9251d19157c56b5d91c8961bb4b35196a5ca9b4ffdccbf24abbfe2a5f
---
tests/ui/drop_non_drop.rs ... ok
tests/ui/drain_collect.fixed ... ok
tests/ui/duplicate_underscore_argument.rs ... ok
tests/ui/duplicated_attributes.rs ... ok
tests/ui/duration_suboptimal_units_days_weeks.rs ... ok
tests/ui/duration_suboptimal_units.rs ... ok
tests/ui/double_parens.fixed ... ok
tests/ui/duration_subsec.rs ... ok
tests/ui/duration_suboptimal_units_days_weeks.fixed ... ok
tests/ui/duration_suboptimal_units.fixed ... ok
tests/ui/duration_subsec.fixed ... ok
tests/ui/eager_transmute.rs ... ok
tests/ui/else_if_without_else.rs ... ok
tests/ui/empty_docs.rs ... ok
tests/ui/elidable_lifetime_names.rs ... ok
---
.............F............................         (142/142)

======== tests/rustdoc-gui/skip-navigation.goml ========

[ERROR] skip-navigation output:
Runtime.callFunctionOn timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.
stack: ProtocolError: Runtime.callFunctionOn timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.
    at <instance_members_initializer> (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:103:14)
    at new Callback (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:107:16)
    at CallbackRegistry.create (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:25:26)
    at Connection._rawSend (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Connection.js:108:26)
    at CdpCDPSession.send (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/CdpSession.js:74:33)
    at #evaluate (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:363:50)
    at ExecutionContext.evaluate (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:277:36)
    at IsolatedWorld.evaluate (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/IsolatedWorld.js:100:30)
    at CdpFrame.evaluate (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Frame.js:362:43)
    at CdpFrame.<anonymous> (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/util/decorators.js:109:27)



<= doc-ui tests done: 141 succeeded, 1 failed, 0 filtered out

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-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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants