rust-lang / rust-lang/rust-analyzer

`proc_macro::quote` cannot be made useful for rust-analyzer

Open
#16,464 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-proc-macro C-Architecture C-tracking-issue S-unactionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Macro in question: https://doc.rust-lang.org/proc_macro/macro.quote.html

What do I mean with this? Basically rust-analyzer cannot make use of the spans the macro generated, as these spans are generated and stored (via save_span) at compilation time of the macro, then loaded (via load_span) by the proc macro server when executed. rust-analyzer is not the tool that compiles the proc-macros though, so we are not the one saving any spans and as such we also can't really load them (even if we go through the artifacts produced, their representation differs from our spans). So for r-a to be able to make use of this feature (should it ever get stabilized), the implementation details would need to change in some way and/or r-a needs to be the one compiling the proc-macros somehow.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked proc_macro::quote documentation and trace how save_span and load_span are used by the proc macro server. Compare the compiler-produced span artifacts with rust-analyzer's span representation, then define a viable ownership or interchange design that lets rust-analyzer use generated spans.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.