Test fixes and rebase conflicts
This commit is contained in:
parent
ba8ce4c2c2
commit
665ea963d3
18 changed files with 65 additions and 64 deletions
|
|
@ -41,7 +41,7 @@
|
|||
extern crate arena;
|
||||
|
||||
use std::iter::range_step;
|
||||
use std::thread::{Thread, JoinGuard};
|
||||
use std::thread;
|
||||
use arena::TypedArena;
|
||||
|
||||
struct Tree<'a> {
|
||||
|
|
@ -110,11 +110,11 @@ fn main() {
|
|||
let messages = range_step(min_depth, max_depth + 1, 2).map(|depth| {
|
||||
use std::num::Int;
|
||||
let iterations = 2.pow((max_depth - depth + min_depth) as usize);
|
||||
thread::spawn(move || inner(depth, iterations))
|
||||
thread::scoped(move || inner(depth, iterations))
|
||||
}).collect::<Vec<_>>();
|
||||
|
||||
for message in messages {
|
||||
println!("{}", message.join().ok().unwrap());
|
||||
println!("{}", message.join());
|
||||
}
|
||||
|
||||
println!("long lived tree of depth {}\t check: {}",
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ fn fannkuch(n: i32) -> (i32, i32) {
|
|||
for (_, j) in (0..N).zip(iter::count(0, k)) {
|
||||
let max = cmp::min(j+k, perm.max());
|
||||
|
||||
futures.push(thread::spawn(move|| {
|
||||
futures.push(thread::scoped(move|| {
|
||||
work(perm, j as uint, max as uint)
|
||||
}))
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@ fn fannkuch(n: i32) -> (i32, i32) {
|
|||
let mut checksum = 0;
|
||||
let mut maxflips = 0;
|
||||
for fut in futures {
|
||||
let (cs, mf) = fut.join().ok().unwrap();
|
||||
let (cs, mf) = fut.join();
|
||||
checksum += cs;
|
||||
maxflips = cmp::max(maxflips, mf);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -303,17 +303,17 @@ fn main() {
|
|||
|
||||
let nb_freqs: Vec<_> = (1u..3).map(|i| {
|
||||
let input = input.clone();
|
||||
(i, thread::spawn(move|| generate_frequencies(&input, i)))
|
||||
(i, thread::scoped(move|| generate_frequencies(&input, i)))
|
||||
}).collect();
|
||||
let occ_freqs: Vec<_> = OCCURRENCES.iter().map(|&occ| {
|
||||
let input = input.clone();
|
||||
thread::spawn(move|| generate_frequencies(&input, occ.len()))
|
||||
thread::scoped(move|| generate_frequencies(&input, occ.len()))
|
||||
}).collect();
|
||||
|
||||
for (i, freq) in nb_freqs {
|
||||
print_frequencies(&freq.join().ok().unwrap(), i);
|
||||
print_frequencies(&freq.join(), i);
|
||||
}
|
||||
for (&occ, freq) in OCCURRENCES.iter().zip(occ_freqs.into_iter()) {
|
||||
print_occurrences(&mut freq.join().ok().unwrap(), occ);
|
||||
print_occurrences(&mut freq.join(), occ);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ fn mandelbrot<W: old_io::Writer>(w: usize, mut out: W) -> old_io::IoResult<()> {
|
|||
let mut precalc_i = Vec::with_capacity(h);
|
||||
|
||||
let precalc_futures = (0..WORKERS).map(|i| {
|
||||
thread::spawn(move|| {
|
||||
thread::scoped(move|| {
|
||||
let mut rs = Vec::with_capacity(w / WORKERS);
|
||||
let mut is = Vec::with_capacity(w / WORKERS);
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ fn mandelbrot<W: old_io::Writer>(w: usize, mut out: W) -> old_io::IoResult<()> {
|
|||
}).collect::<Vec<_>>();
|
||||
|
||||
for res in precalc_futures {
|
||||
let (rs, is) = res.join().ok().unwrap();
|
||||
let (rs, is) = res.join();
|
||||
precalc_r.extend(rs.into_iter());
|
||||
precalc_i.extend(is.into_iter());
|
||||
}
|
||||
|
|
@ -122,7 +122,7 @@ fn mandelbrot<W: old_io::Writer>(w: usize, mut out: W) -> old_io::IoResult<()> {
|
|||
let vec_init_r = arc_init_r.clone();
|
||||
let vec_init_i = arc_init_i.clone();
|
||||
|
||||
thread::spawn(move|| {
|
||||
thread::scoped(move|| {
|
||||
let mut res: Vec<u8> = Vec::with_capacity((chunk_size * w) / 8);
|
||||
let init_r_slice = vec_init_r;
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ fn mandelbrot<W: old_io::Writer>(w: usize, mut out: W) -> old_io::IoResult<()> {
|
|||
|
||||
try!(writeln!(&mut out as &mut Writer, "P4\n{} {}", w, h));
|
||||
for res in data {
|
||||
try!(out.write(&res.join().ok().unwrap()));
|
||||
try!(out.write(&res.join()));
|
||||
}
|
||||
out.flush()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,18 +8,17 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(core, std_misc)]
|
||||
use std::thread::Thread;
|
||||
use std::thread;
|
||||
|
||||
fn main() {
|
||||
let bad = {
|
||||
let x = 1;
|
||||
let y = &x;
|
||||
|
||||
Thread::scoped(|| { //~ ERROR cannot infer an appropriate lifetime
|
||||
thread::scoped(|| { //~ ERROR cannot infer an appropriate lifetime
|
||||
let _z = y;
|
||||
})
|
||||
};
|
||||
|
||||
bad.join().ok().unwrap();
|
||||
bad.join();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
// preserved, and that the first outer item parsed in main is not
|
||||
// accidentally carried over to each inner function
|
||||
|
||||
#![feature(custom_attribute)]
|
||||
|
||||
fn main() {
|
||||
#![inner_attr]
|
||||
#[outer_attr]
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
pub static mut statik: int = 0;
|
||||
pub static mut statik: isize = 0;
|
||||
|
||||
struct A;
|
||||
impl Drop for A {
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
extern crate lib;
|
||||
|
||||
use std::thread::Thread;
|
||||
use std::thread;
|
||||
|
||||
static mut statik: int = 0;
|
||||
static mut statik: isize = 0;
|
||||
|
||||
struct A;
|
||||
impl Drop for A {
|
||||
|
|
@ -22,10 +22,9 @@ impl Drop for A {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
Thread::scoped(move|| {
|
||||
thread::spawn(move|| {
|
||||
let _a = A;
|
||||
lib::callback(|| panic!());
|
||||
1
|
||||
}).join().err().unwrap();
|
||||
|
||||
unsafe {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#![allow(unknown_features)]
|
||||
#![feature(box_syntax)]
|
||||
|
||||
use std::thread::Thread;
|
||||
use std::thread;
|
||||
use std::sync::mpsc::{channel, Sender};
|
||||
|
||||
#[derive(PartialEq, Debug)]
|
||||
|
|
@ -69,15 +69,16 @@ pub fn main() {
|
|||
assert_eq!(receiver.recv().ok(), None);
|
||||
|
||||
let (sender, receiver) = channel();
|
||||
let _t = Thread::scoped(move|| {
|
||||
let t = thread::spawn(move|| {
|
||||
let v = Foo::FailingVariant { on_drop: SendOnDrop { sender: sender } };
|
||||
});
|
||||
assert_eq!(receiver.recv().unwrap(), Message::Dropped);
|
||||
assert_eq!(receiver.recv().ok(), None);
|
||||
drop(t.join());
|
||||
|
||||
let (sender, receiver) = channel();
|
||||
let _t = {
|
||||
Thread::scoped(move|| {
|
||||
let t = {
|
||||
thread::spawn(move|| {
|
||||
let mut v = Foo::NestedVariant(box 42u, SendOnDrop {
|
||||
sender: sender.clone()
|
||||
}, sender.clone());
|
||||
|
|
@ -93,4 +94,5 @@ pub fn main() {
|
|||
assert_eq!(receiver.recv().unwrap(), Message::DestructorRan);
|
||||
assert_eq!(receiver.recv().unwrap(), Message::Dropped);
|
||||
assert_eq!(receiver.recv().ok(), None);
|
||||
drop(t.join());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue