Skip to content

Incorrect "expected 1 argument, found 2" using nalgebra's DVector::from_iterator #11715

Closed
@Omnikar

Description

@Omnikar

rust-analyzer version: rust-analyzer 5e8515870 2022-03-14 dev

rustc version: rustc 1.58.1 (db9d1b20b 2022-01-20)

I am using the the from_iterator method on the DVector type in the nalgebra crate, passing in two arguments: row count and the iterator itself. My code compiles and runs as expected, but rust-analyzer gives the error "expected 1 argument, found 2". I imagine this is related to the fact that there are multiple different signatures for the from_iterator method based on the subtype of Matrix that is being used.

Minimal reproducible example:

use nalgebra::DVector;

fn main() {
    let data = [1.0, 2.0, 3.0];
    let vector = DVector::<f64>::from_iterator(data.len(), data.into_iter());
    println!("{}", vector);
}

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