rust-lang / rust-lang/rust-analyzer

Switching Branches causes Rust Analyzer to throw a bunch of false positive errors.

Open
#16,897 6 comments 1 reaction 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.4.1887-standalone (b91697de8 2024-03-19)

Experienced on

OpenSuse Tumbleweed(Linux 6.7.9-1-default)
Windows 11
with VS Code 1.87.2

rustc version: (eg. output of rustc -V)
rustc 1.78.0-beta.1 (efd9d2df1 2024-03-18)
Also tested on rustc 1.76

repository link: https://github.com/wyatt-herkamp/rust-analyzer

code snippet to reproduce:

So I noticed when I swap from branch use_one_tt_for_a_derive to branch to-from-cfg_attr-assist this has happened with other branches. But this is my most recent example

That Rust analyzer will start saying a bunch of functions have incorrect parameters and incorrect fields In the file crates/hir-expand/src/db.rs.

image

Even after restarting the server this continues to happen. It seems I have to completely restart VS Code. So it might be a bug related to VS Code.

I assume this issue with not be able to be fixed. However, I wanted to bring attention to the issue.

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 issue by switching between use_one_tt_for_a_derive and to-from-cfg_attr-assist in the linked repository, then inspect the false positives reported in crates/hir-expand/src/db.rs. Compare restarting the language server with restarting VS Code; done means branch changes no longer leave incorrect parameter and field diagnostics.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.