mod.rs |
|
163 |
quicksort_race1.rs |
! ```compile_fail,E0524
fn quick_sort<T:PartialOrd+Send>(v: &mut [T]) {
if v.len() <= 1 {
return;
}
let mid = partition(v);
let (lo, _hi) = v.split_at_mut(mid);
rayon_core::join(|| quick_sort(lo), || quick_sort(lo)); //~ ERROR
}
fn partition<T:PartialOrd+Send>(v: &mut [T]) -> usize {
let pivot = v.len() - 1;
let mut i = 0;
for j in 0..pivot {
if v[j] <= v[pivot] {
v.swap(i, j);
i += 1;
}
}
v.swap(i, pivot);
i
}
fn main() { }
``` |
535 |
quicksort_race2.rs |
! ```compile_fail,E0500
fn quick_sort<T:PartialOrd+Send>(v: &mut [T]) {
if v.len() <= 1 {
return;
}
let mid = partition(v);
let (lo, _hi) = v.split_at_mut(mid);
rayon_core::join(|| quick_sort(lo), || quick_sort(v)); //~ ERROR
}
fn partition<T:PartialOrd+Send>(v: &mut [T]) -> usize {
let pivot = v.len() - 1;
let mut i = 0;
for j in 0..pivot {
if v[j] <= v[pivot] {
v.swap(i, j);
i += 1;
}
}
v.swap(i, pivot);
i
}
fn main() { }
``` |
534 |
quicksort_race3.rs |
! ```compile_fail,E0524
fn quick_sort<T:PartialOrd+Send>(v: &mut [T]) {
if v.len() <= 1 {
return;
}
let mid = partition(v);
let (_lo, hi) = v.split_at_mut(mid);
rayon_core::join(|| quick_sort(hi), || quick_sort(hi)); //~ ERROR
}
fn partition<T:PartialOrd+Send>(v: &mut [T]) -> usize {
let pivot = v.len() - 1;
let mut i = 0;
for j in 0..pivot {
if v[j] <= v[pivot] {
v.swap(i, j);
i += 1;
}
}
v.swap(i, pivot);
i
}
fn main() { }
``` |
535 |
rc_return.rs |
```compile_fail,E0277
use std::rc::Rc;
rayon_core::join(|| Rc::new(22), || ()); //~ ERROR
``` |
234 |
rc_upvar.rs |
! ```compile_fail,E0277
use std::rc::Rc;
let r = Rc::new(22);
rayon_core::join(|| r.clone(), || r.clone());
//~^ ERROR
``` |
131 |
scope_join_bad.rs |
! ```compile_fail,E0373
fn bad_scope<F>(f: F)
where F: FnOnce(&i32) + Send,
{
rayon_core::scope(|s| {
let x = 22;
s.spawn(|_| f(&x)); //~ ERROR `x` does not live long enough
});
}
fn good_scope<F>(f: F)
where F: FnOnce(&i32) + Send,
{
let x = 22;
rayon_core::scope(|s| {
s.spawn(|_| f(&x));
});
}
fn main() {
}
``` |
376 |