Skip to content

ndarray >=0.15.2 compilation issue #1051

Closed
@nbigaouette

Description

@nbigaouette

I use ndarray in a project of mine that I unfortunately don't have much time to keep up to date.

I've revisited it today and my CI builds now fail.

After investigation it seems that the issue is caused by an update to ndarray 0.15.2 (0.15.1 worked fine).

See for example the latest CI failure here: https://github.com/nbigaouette/onnxruntime-rs/pull/90/checks?check_run_id=3216000008

In this commit I force ndarray's max version to 0.15.1 and the build succeeds.

So it seems there was a breaking change in ndarray 0.15.2 :(

I'm not sure that was expected? And not sure what exactly the issue is since it's a project I rarely touch...

Edit: The compilation error is as follow:

error[E0271]: type mismatch resolving `<ndarray::iterators::into_iter::IntoIter<f32, Dim<IxDynImpl>> as Iterator>::Item == &_`
   --> onnxruntime/tests/integration_tests.rs:107:14
    |
107 |             .copied()
    |              ^^^^^^ expected `f32`, found reference
    |
    = note:   expected type `f32`
            found reference `&_`

error[E0599]: the method `enumerate` exists for struct `Copied<ndarray::iterators::into_iter::IntoIter<f32, Dim<IxDynImpl>>>`, but its trait bounds were not satisfied
   --> onnxruntime/tests/integration_tests.rs:108:14
    |
108 |               .enumerate()
    |                ^^^^^^^^^ method cannot be called on `Copied<ndarray::iterators::into_iter::IntoIter<f32, Dim<IxDynImpl>>>` due to unsatisfied trait bounds
    | 
   ::: /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/ndarray-0.15.3/src/iterators/into_iter.rs:20:1
    |
20  | / pub struct IntoIter<A, D>
21  | | where
22  | |     D: Dimension,
23  | | {
...   |
31  | |     has_unreachable_elements: bool,
32  | | }
    | |_- doesn't satisfy `<_ as Iterator>::Item = &_`
    |
    = note: the following trait bounds were not satisfied:
            `<ndarray::iterators::into_iter::IntoIter<f32, Dim<IxDynImpl>> as Iterator>::Item = &_`
            which is required by `Copied<ndarray::iterators::into_iter::IntoIter<f32, Dim<IxDynImpl>>>: Iterator`
            `Copied<ndarray::iterators::into_iter::IntoIter<f32, Dim<IxDynImpl>>>: Iterator`
            which is required by `&mut Copied<ndarray::iterators::into_iter::IntoIter<f32, Dim<IxDynImpl>>>: Iterator`

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