rust-lang / rust-lang/rust-analyzer

Counting is difficult: compiler errors are sometimes double-counted

Open
#11,344 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

While looking at compile errors reported by Rust Analyzer in VS Code in the file explorer, I've noticed that RA will often report double the numbers of compile errors compared to say, cargo check. I've just tried to reproduce this with a minimal project and I can't, so I'm guessing it might have something to do with compiling the library code for multiple Cargo targets or something.

This is from a work project, but I've also often noticed this while working on rustls (this is after renaming the Vec it is pushing to):

Screenshot 2022-01-26 at 09 52 07

The easy path to a minimal reproduction doesn't work:

Screenshot 2022-01-26 at 09 52 58

This is not a particularly recent regression, I think this has been happening for months for me (mostly noticed while working on rustls) -- but usually I want to drive the error count to zero anyway, so it's not a big issue. Still would be nice to report the number accurately!

rust-analyzer version: rust-analyzer version: 17afa2e77 2022-01-24 stable

rustc version:

djc-2021 proxy domains $ rustc -vV
rustc 1.58.0 (02072b482 2022-01-11)
binary: rustc
commit-hash: 02072b482a8b5357f7fb5e5637444ae30e423c40
commit-date: 2022-01-11
host: aarch64-apple-darwin
release: 1.58.0
LLVM version: 13.0.0

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 by investigating the Rust Analyzer error count shown in the VS Code file explorer and compare it with cargo check on a project that builds library code for multiple Cargo targets. The issue is done when a reproducible case is found and the displayed count matches the distinct compile errors; no source files or tests are identified in the report.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.