Skip to content

Commit a78f92b

Browse files
committed
add tests
1 parent 26c03e2 commit a78f92b

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//@ compile-flags: -Znext-solver
2+
//@ check-pass
3+
4+
// A regression test for trait-system-refactor-initiative#109.
5+
6+
trait ParallelIterator: Sized {
7+
type Item;
8+
}
9+
trait IntoParallelIterator {
10+
type Iter: ParallelIterator<Item = Self::Item>;
11+
type Item;
12+
}
13+
impl<T: ParallelIterator> IntoParallelIterator for T {
14+
type Iter = T;
15+
type Item = T::Item;
16+
}
17+
18+
macro_rules! multizip_impls {
19+
($($T:ident),+) => {
20+
fn foo<$( $T, )+>() where
21+
$(
22+
$T: IntoParallelIterator,
23+
$T::Iter: ParallelIterator,
24+
)+
25+
($( $T, )+): IntoParallelIterator<Item = ($( $T::Item, )+)>,
26+
{}
27+
}
28+
}
29+
30+
multizip_impls! { A, B, C, D, E, F, G, H, I, J, K, L }
31+
32+
fn main() {}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//@ compile-flags: -Znext-solver
2+
//@ check-pass
3+
4+
// A regression test for trait-system-refactor-initiative#109.
5+
// Unlike `rayon-hang-1.rs` the cycles in this test are not
6+
// unproductive, which causes the `AliasRelate` goal when trying
7+
// to apply where-clauses to only error in the second iteration.
8+
//
9+
// This makes the exponential blowup to be significantly harder
10+
// to avoid.
11+
12+
trait ParallelIterator: Sized {
13+
type Item;
14+
}
15+
16+
trait IntoParallelIteratorIndir {
17+
type Iter: ParallelIterator<Item = Self::Item>;
18+
type Item;
19+
}
20+
impl<I> IntoParallelIteratorIndir for I
21+
where
22+
Box<I>: IntoParallelIterator,
23+
{
24+
type Iter = <Box<I> as IntoParallelIterator>::Iter;
25+
type Item = <Box<I> as IntoParallelIterator>::Item;
26+
}
27+
trait IntoParallelIterator {
28+
type Iter: ParallelIterator<Item = Self::Item>;
29+
type Item;
30+
}
31+
impl<T: ParallelIterator> IntoParallelIterator for T {
32+
type Iter = T;
33+
type Item = T::Item;
34+
}
35+
36+
macro_rules! multizip_impls {
37+
($($T:ident),+) => {
38+
fn foo<'a, $( $T, )+>() where
39+
$(
40+
$T: IntoParallelIteratorIndir,
41+
$T::Iter: ParallelIterator,
42+
)+
43+
{}
44+
}
45+
}
46+
47+
multizip_impls! { A, B, C, D, E, F, G, H, I, J, K, L }
48+
49+
fn main() {}

0 commit comments

Comments
 (0)