rust-lang / rust-lang/rust-analyzer

False positive unused_variables on never-type

Open
#22,975 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics 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 0.4.2991-standalone

rustc version: rustc 1.97.0-nightly (36ba2c771 2026-04-23)

editor or extension: Vim

code snippet to reproduce:

fn main() {
    let foo = loop {};
    _ = foo; // used
}

Cursor on foo (line 2)

Expect no this quickfix, but actual output Rename unused foo to _foo

After apply:

fn main() {
    let _foo = loop {};
    _ = foo; // used
}

Should either 'not applicable' or 'rename all usage'

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 reproducing the unused_variables quickfix with the minimal Rust snippet in the issue, using the reported rust-analyzer version and Vim setup. Trace the diagnostic and rename action for a variable initialized with never-type control flow, then verify that the quickfix is absent or renames every usage, including _ = foo.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.