rust-lang / rust-lang/rust-analyzer

Cached crate metadata falls out of sync

Open
#17,423 9 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: rust-analyzer version: 0.3.1995-standalone (c86d6230f 2024-06-10) [/Users/djc/.vscode/extensions/rust-lang.rust-analyzer-0.3.1995-darwin-arm64/server/rust-analyzer]

rustc version: 1.79.0 (129f3b996 2024-06-10)

editor or extension: VS Code v0.3.1995

relevant settings: nothing special

repository link (if public, optional): N/A

In the largish Cargo workspace (~30 crates) at work, I'm seeing behavior where doing something like a git pull and then triggering RA to reanalyze will often fail to refresh upstream crates within the workspace. We have a bunch of library small crates and then a few larger binary crates downstream of that, and if API changes happen to my utils crate (which my application crate depends on via a path = "../utils" dependency) -- like changing the number of function arguments or adding new fields to a type, RA will signal breakage in the downstream users until I explicitly trigger RA to refresh the upstream crate (generally by hitting Cmd + S to save the file).

I forget if RA ever got this right, but if it did it's been a long time since it has.

My expectation would be that, once a refresh is triggered, all files in the workspace could be checked (maybe filtering by mtime) such that the rebuild can happen for all crates that need it.

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 this in a roughly 30-crate Cargo workspace after a git pull, changing an upstream path dependency and triggering rust-analyzer reanalysis. Compare the downstream diagnostics before and after saving the upstream file with Cmd+S. Done means a refresh checks changed workspace crates and updates downstream errors without requiring an explicit save.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.