-   Notifications  You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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 rayons 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> Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.