]>
git.proxmox.com Git - rustc.git/blob - vendor/rustc-rayon/tests/run-pass/scope_join.rs
3 /// Test that one can emulate join with `scope`:
4 fn pseudo_join
<F
, G
>(f
: F
, g
: G
)
5 where F
: FnOnce() + Send
,
14 fn quick_sort
<T
:PartialOrd
+Send
>(v
: &mut [T
]) {
19 let mid
= partition(v
);
20 let (lo
, hi
) = v
.split_at_mut(mid
);
21 pseudo_join(|| quick_sort(lo
), || quick_sort(hi
));
24 fn partition
<T
:PartialOrd
+Send
>(v
: &mut [T
]) -> usize {
25 let pivot
= v
.len() - 1;
37 pub fn is_sorted
<T
: Send
+ Ord
>(v
: &[T
]) -> bool
{
38 (1..v
.len()).all(|i
| v
[i
-1] <= v
[i
])
42 let mut v
: Vec
<i32> = (0 .. 256).rev().collect();
44 assert
!(is_sorted(&v
));