rust-lang / rust-lang/rust-analyzer

When building a proc_macro, rust-analyzer recompiles every dependencies

Open
#17,269 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: v0.3.1958

rustc version: rustc 1.76.0 (07dca489a 2024-02-04)

editor or extension: v0.3.1958

Hello,

When I develop parts of my project that aren't a proc-macro, when the file is auto-saved, the checks that rust-analyzer do are very fast.

But when I am working on my proc macro, at every change of my file (auto-save enabled), I am seeing every dependencies getting recompiled which makes the editor slow at every change.

Is there a way for me to fix that? (Like changing some cargo check flags) Or is it the special nature of proc-macro that forces the recompilation of all of the dependencies at each save?

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

Reproduce the slow auto-save checks while editing a proc-macro using rust-analyzer v0.3.1958 and rustc 1.76.0, then compare them with checks for a non-proc-macro file. Start by determining whether Cargo or rust-analyzer is triggering dependency recompilation; done means identifying an actionable configuration or behavior change, or documenting that recompilation is expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.