rust-lang / rust-lang/rust-analyzer

False positive E0107.

Open
#15,821 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

rust-analyzer version: 0.3.1713-standalone (f49320774 2023-10-28)

rustc version: doesn't work on both rustc 1.72.1 (d5c2e9c34 2023-09-13) and rustc 1.74.0-nightly (ca62d2c44 2023-09-30)

relevant settings: N/A

I have a generic struct CTOption with two types-aliases that represent its parametrizations: CTSome and CTNone.

For CTSome, there's an implementation of new that accepts one parameter. For CTNone, there's an implementation of new that accepts zero parameters.

When I try to use CTNone::<u32>::new(), I get "expected 1 argument, found 0 rust-analyzer (E0107)" error. Upon closer inspection, E0107 is "An incorrect number of generic arguments was provided.", which is straight up wrong.

Commit: https://github.com/JohnScience/ctoption/tree/24e3ba9c48afd5e7800c798bba40ed8ee4b344d4

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 report using the linked ctoption commit and its src/lib.rs definitions for CTOption, CTSome, and CTNone. Start with the CTNone::::new() example, then trace the rust-analyzer diagnostic that reports E0107. Done means the call no longer receives the incorrect argument-count diagnostic or label.

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
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.