rust-lang / rust-lang/rust-analyzer

rust-analyzer doesn't show some errors from cargo check

Open
#13,204 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

rust-analyzer version: 0.4.1196

rustc version: rustc 1.60.0 (7737e0b5c 2022-04-04)

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTUP_HOME or CARGO_HOME).

  • RUSTUP_HOME: /usr/local/rustup.
  • CARGO_HOME: /usr/local/cargo

Basically, my code has errors that rust-analyzer doesn't pick up. This doesn't happen for all errors. It all started one or two versions back.

  • Errors from rust check:
    image.
  • No error on my IDE on the same line:
image

Sadly, this is a private project so I can't really share the repo. I'm unsure how to proceed to get help. I tried to make a repro but it's hard because only some errors are not shown.
If that counts, I use cargo workspace, and from searching, seems rust-analyzer has trouble with that sometimes.

Again sorry that I can't provide a reproduction, but maybe off the bat there's something I can do?

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 rust-analyzer troubleshooting guide and compare cargo check diagnostics with the IDE output using a minimal Rust project. Investigate whether the behavior depends on the cargo workspace setup or the reported rust-analyzer and rustc versions. Done means the missing diagnostics are reproduced and rust-analyzer reports the same relevant errors, or the issue is narrowed to a documented limitation.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.