-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Incorrect resolution of Nalgebra 0.26's fixed-size Vector/Matrix constructors #8654
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
Comments
We don't handle const params at all yet, cc #7434 |
I can confirm that downgrading to nalgebra 0.25.4 gets rid of the error. |
Is there a way to suppress this class of errors until a more final fix occurs? Presently my code is littered with erroneous red squiggles. |
Thanks for the link. To be clear for others: |
This might also be related to #5441. Same error, but that issue I encountered about a year before this one. It seems to be related to the wrong |
I don't know if this is helpful but I made a standalone repro before discovering this just wasn't a supported feature.
Also, as a workaround in my own code (since the bogus errors were making rust-analyzer unusable in my code), I just wrote wrappers for the problematic constructors and call those instead of the generic ones:
etc. Obviously not a long-term solution, but it worked well enough for me for now. |
is related to rust-lang/rust-analyzer#8654
r-a does not yet support const generics properly so it not showing the const argument is expected currently. |
I'm just thinking it would be pretty reasonable-- when/if rust-analyzer becomes first-party-- to block language features from entering stable rust until they're supported by rust-analyzer. This is the bar that well-supported languages set. Having things squiggle out (but compile just fine) is extremely, extremely confusing and discouraging for beginners. I'm not saying that the effort invested isn't appreciated and, yeah, I realize you probably have no control over this today. Just my two cents for when/if rust-analyzer becomes the first-party LS impl. |
See this issue rust-lang/rust-analyzer#8654 for more details
This works correctly for me now, though #5441 still doesn't. |
This works indeed, although the type hint is pretty ugly: Tested on Closing, please keep an eye on #5441 and/or file new issues if necessary. |
Nalgebra 0.26 introduced const generics into its types, and rust-analyzer seems to be having trouble resolving or otherwise figuring out its method signatures. To reproduce, create a new project with the following:
Cargo.toml:
main.rs:
cargo check
reports no problems, but rust-analyzer in VSCode puts an error on theVector2
constructor: "Expected 4 arguments, found 2".Vector2
is a type alias in Nalgebra (definition), and itsnew
constructor should have only 2 arguments, as defined here with theConst<2>, Const<1>
variant.Similar errors happen with other fixed-size
Matrix
type aliases in Nalgebra too. For example,Matrix4::new
, which should take 16 values, is reported by rust-analyzer as also requiring 4.rustc 1.52.0-beta.5
rust-analyzer version: 2021-04-12-92-g7570212a5
The text was updated successfully, but these errors were encountered: