Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kdheepak opened this issue Dec 5, 2021 · 1 comment
Closed

Comments

@kdheepak
Copy link

kdheepak commented Dec 5, 2021

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
@lnicola
Copy link
Member

lnicola commented Dec 5, 2021

Duplicate of #5441.

@lnicola lnicola closed this as completed Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants