Description
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:
[dependencies]
nalgebra = "0.26"
main.rs:
use nalgebra::Vector2;
fn main() {
let _foo = Vector2::new(1.0, 1.0);
}
cargo check
reports no problems, but rust-analyzer in VSCode puts an error on the Vector2
constructor: "Expected 4 arguments, found 2". Vector2
is a type alias in Nalgebra (definition), and its new
constructor should have only 2 arguments, as defined here with the Const<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