Skip to content

Change in order of assert after write causes move error #4

@Kingdutch

Description

@Kingdutch

It appears that the change in 5aaf53f now produces the following build error


error[E0382]: borrow of moved value: `dataset`
  --> src/koans/02_cluster_generation/06_dataset.rs:96:17
   |
80 |         let dataset = generate_dataset(n, centroids.view(), &mut rng);
   |             ------- move occurs because `dataset` has type `ndarray::ArrayBase<ndarray::OwnedRepr<f64>, ndarray::dimension::dim::Dim<[usize; 2]>>`, which does not implement the `Copy` trait
...
90 |         write_npy("python/dataset.npy", dataset).expect("Failed to write array in npy format.");
   |                                         ------- value moved here
...
96 |         assert!(dataset.genrows().into_iter().all(|r| r != array![0., 0.]));
   |                 ^^^^^^^ value borrowed here after move

error: aborting due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions