-
Notifications
You must be signed in to change notification settings - Fork 0
rayon hangs #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Some sort of combinatorial blow up when we are trying to prove the WC on each impl are well-formed -- I think we might be trying prove things like |
this very much makes sense to me🤔 can chat about it tomorrow, I guess we may want to assume (for completeness, not soundness) that all self-types of edit: or well, unsure how this interacts with normalizing in an unnormalized env xx also, how to avoid this hang when first normalizing the env |
rayon has a blanket impl of pub trait IntoParallelIterator {
type Item;
}
trait ParallelIterator {}
impl<T: ParallelIterator> IntoParallelIterator for T {
type Item = T;
}
macro_rules! multizip_impls {
($(
$Tuple:ident {
$(($idx:tt) -> $T:ident)+
}
)+) => {
$(
impl<$( $T, )+> IntoParallelIterator for ($( $T, )+)
where
$(
$T: IntoParallelIterator,
$T::Item: ParallelIterator,
)+
{
type Item = ();
}
)*
}
}
multizip_impls! {
Tuple1 {
(0) -> A
}
Tuple2 {
(0) -> A
(1) -> B
}
Tuple3 {
(0) -> A
(1) -> B
(2) -> C
}
Tuple4 {
(0) -> A
(1) -> B
(2) -> C
(3) -> D
}
Tuple5 {
(0) -> A
(1) -> B
(2) -> C
(3) -> D
(4) -> E
}
Tuple6 {
(0) -> A
(1) -> B
(2) -> C
(3) -> D
(4) -> E
(5) -> F
}
Tuple7 {
(0) -> A
(1) -> B
(2) -> C
(3) -> D
(4) -> E
(5) -> F
(6) -> G
}
Tuple8 {
(0) -> A
(1) -> B
(2) -> C
(3) -> D
(4) -> E
(5) -> F
(6) -> G
(7) -> H
}
Tuple9 {
(0) -> A
(1) -> B
(2) -> C
(3) -> D
(4) -> E
(5) -> F
(6) -> G
(7) -> H
(8) -> I
}
Tuple10 {
(0) -> A
(1) -> B
(2) -> C
(3) -> D
(4) -> E
(5) -> F
(6) -> G
(7) -> H
(8) -> I
(9) -> J
}
Tuple11 {
(0) -> A
(1) -> B
(2) -> C
(3) -> D
(4) -> E
(5) -> F
(6) -> G
(7) -> H
(8) -> I
(9) -> J
(10) -> K
}
Tuple12 {
(0) -> A
(1) -> B
(2) -> C
(3) -> D
(4) -> E
(5) -> F
(6) -> G
(7) -> H
(8) -> I
(9) -> J
(10) -> K
(11) -> L
}
}
fn main() {} |
This minimization is still insufficient (now). With rust-lang/rust#124852 this test compiles but rayon hangs |
The hang occurs in trait ParallelIterator: Sized {
type Item;
}
trait IntoParallelIterator {
type Iter: ParallelIterator<Item = Self::Item>;
type Item;
}
impl<T: ParallelIterator> IntoParallelIterator for T {
type Iter = T;
type Item = T::Item;
}
macro_rules! multizip_impls {
($($T:ident),+) => {
fn foo<$( $T, )+>() where
$(
$T: IntoParallelIterator,
$T::Iter: ParallelIterator,
)+
($( $T, )+): IntoParallelIterator<Item = ($( $T::Item, )+)>,
{}
}
}
multizip_impls! { A, B, C, D, E, F, G, H, I, J, K, L } The added |
To fix this we can either strengthen rust-lang/rust#124852 which feels fairly hacky. I'd like to instead look into making |
Avoiding the blowup when dealing with multiple Improving
|
I've extended rust-lang/rust#124852 to only use where-bounds to extend the number of "nameable placeholders" if their projection term itself is nameable. This fixes rayon again |
Let's look at a minimized repro and its proof tree trait IsAssoc {}
trait ParamOrIndir {
type Assoc: ?Sized;
}
impl<T: IsAssoc + ?Sized> ParamOrIndir for T {
type Assoc = ();
}
fn foo<A, B>()
where
A: ParamOrIndir,
B: ParamOrIndir,
<A as ParamOrIndir>::Assoc: IsAssoc,
<B as ParamOrIndir>::Assoc: IsAssoc,
{}
One fix would be to only assemble candidates which matter! If we start by looking at trivial builtin and env candidates and only consider impl candidates if no preferred candidates exist, we'd avoid these hangs. This does not hang with rust-lang/rust@11e8a21. Another alternative would be to evaluate all goals, but when dropping candidates during winnowing, track in the search graph that cycles were not relevant for the final result. Footnotes |
The text was updated successfully, but these errors were encountered: