Closed
Description
Simple example using rayon (playground):
use rayon::prelude::*;
fn main() {
let v: Vec<*const usize> = Vec::new();
v.par_iter();
(&v).into_par_iter();
<Vec<*const usize> as IntoParallelRefMutIterator>::par_iter(&v);
<&Vec<*const usize> as IntoParallelIterator>::into_par_iter(&v);
}
This code rightly doesn't compile because rayon
s IntoParallelIterator
has a Send
bound on its Item
type. However, none of the error messages for the methods called in the code above ever mention that bound or the associated type:
error[E0576]: cannot find method or associated constant `par_iter` in trait `IntoParallelRefMutIterator`
--> src/lib.rs:8:56
|
8 | <Vec<*const usize> as IntoParallelRefMutIterator>::par_iter(&v);
| ^^^^^^^^ not found in `IntoParallelRefMutIterator`
error[E0599]: no method named `par_iter` found for type `std::vec::Vec<*const usize>` in the current scope
--> src/lib.rs:6:7
|
6 | v.par_iter();
| ^^^^^^^^
|
= note: the method `par_iter` exists but the following trait bounds were not satisfied:
`[*const usize] : rayon::iter::IntoParallelRefIterator`
`std::vec::Vec<*const usize> : rayon::iter::IntoParallelRefIterator`
error[E0599]: no method named `into_par_iter` found for type `&std::vec::Vec<*const usize>` in the current scope
--> src/lib.rs:7:10
|
7 | (&v).into_par_iter();
| ^^^^^^^^^^^^^
|
= note: the method `into_par_iter` exists but the following trait bounds were not satisfied:
`&&std::vec::Vec<*const usize> : rayon::iter::IntoParallelIterator`
`&mut &std::vec::Vec<*const usize> : rayon::iter::IntoParallelIterator`
`[*const usize] : rayon::iter::IntoParallelIterator`
error[E0277]: the trait bound `&std::vec::Vec<*const usize>: rayon::iter::IntoParallelIterator` is not satisfied
--> src/lib.rs:9:5
|
9 | <&Vec<*const usize> as IntoParallelIterator>::into_par_iter(&v);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `rayon::iter::IntoParallelIterator` is not implemented for `&std::vec::Vec<*const usize>`
|
= help: the following implementations were found:
<&'data mut std::vec::Vec<T> as rayon::iter::IntoParallelIterator>
<&'data std::vec::Vec<T> as rayon::iter::IntoParallelIterator>
<std::vec::Vec<T> as rayon::iter::IntoParallelIterator>