Skip to content

rust analyzer gives incorrect error diagnostic even when code compiles #10946

Closed
@kdheepak

Description

@kdheepak

Hi, I'm using rust for advent of code this year, and having rust analyzer has been amazing! Thank you so much for all your hard work on this.

This is the diagnostic I'm getting from LSP:

Screen Shot 2021-12-05 at 10 40 02 AM

The error message I get is expected 0 arguments, found 2. I'm not exactly sure how this zeros function is even implemented, rust doesn't support "method overloading", right? I think it has to do something with the various types involved here but I'm rather new to rust so I don't follow what might be going on here. This is the link to the documentation:

https://docs.rs/nalgebra/latest/nalgebra/base/struct.Matrix.html#method.zeros

You can see that when LSP is asking for completion items, it returns zeros(usize, usize) as one of the results, among other zeros functions.

Screen Shot 2021-12-05 at 10 40 36 AM

This file is a minimal working example:

https://github.com/kdheepak/adventofcode/blob/c21d8d20e43dde45ae28318ef1cf45c543154516/2021/src/day05.rs#L30

rust-analyzer version: (eg. output of "Rust Analyzer: Show RA Version" command)

$ rust-analyzer --version                                  
rust-analyzer 73668334f 2021-11-15 stable

rustc version: (eg. output of rustc -V)

$ rustc --version
rustc 1.56.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions