Skip to content

cargo update breaks due to newer rayon version #298

@riverfr0zen

Description

@riverfr0zen

After updating my project dependencies with cargo update, running my app results in an error compiling graph_builder.

It seems to be due to a newer version of rayon that is available. For now, my quick fix is to pin rayon to 1.10 in my Cargo.toml:

# Pinning rayon because upgrade causes errors
rayon = "=1.10"

Below are the errors I see without pinning rayon to 1.10:

   Compiling graph_builder v0.4.1
error[E0271]: type mismatch resolving `<IntoIter<(NI, NI, EV)> as ParallelIterator>::Item == &_`
   --> /home/irf/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/graph_builder-0.4.1/src/input/edgelist.rs:125:35
    |
125 |         self.list.into_par_iter().copied()
    |                                   ^^^^^^ expected `&_`, found `(NI, NI, EV)`
    |
    = note: expected reference `&_`
                   found tuple `(NI, NI, EV)`
note: the method call chain might not have had the expected associated types
   --> /home/irf/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/graph_builder-0.4.1/src/input/edgelist.rs:125:19
    |
125 |         self.list.into_par_iter().copied()
    |         --------- ^^^^^^^^^^^^^^^ `ParallelIterator::Item` is `(NI, NI, EV)` here
    |         |
    |         this expression has type `Box<[(NI, NI, EV)]>`
note: required by a bound in `rayon::iter::ParallelIterator::copied`
   --> /home/irf/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.11.0/src/iter/mod.rs:728:32
    |
725 |     fn copied<'a, T>(self) -> Copied<Self>
    |        ------ required by a bound in this associated function
...
728 |         Self: ParallelIterator<Item = &'a T>,
    |                                ^^^^^^^^^^^^ required by this bound in `ParallelIterator::copied`

error[E0308]: mismatched types
   --> /home/irf/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/graph_builder-0.4.1/src/input/edgelist.rs:125:9
    |
124 |     fn edges(&self) -> Self::EdgeIter<'_> {
    |                        ------------------ expected `rayon::iter::Copied<rayon::slice::Iter<'_, (NI, NI, EV)>>` because of return type
125 |         self.list.into_par_iter().copied()
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Copied<Iter<'_, (NI, NI, EV)>>`, found `Copied<IntoIter<(NI, NI, EV)>>`
    |
    = note: expected struct `rayon::iter::Copied<rayon::slice::Iter<'_, (NI, NI, EV)>>`
               found struct `rayon::iter::Copied<rayon::vec::IntoIter<(NI, NI, EV)>>`

Some errors have detailed explanations: E0271, E0308.
For more information about an error, try `rustc --explain E0271`.
error: could not compile `graph_builder` (lib) due to 2 previous errors

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