Fallout from stabilization

This commit is contained in:
Aaron Turon 2015-02-17 15:10:25 -08:00
parent d8f8f7a58c
commit d0de2b46e9
89 changed files with 578 additions and 558 deletions

View file

@ -8,12 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::thread::Thread;
use std::thread;
use std::sync::mpsc::{Receiver, channel};
pub fn foo<T:Send + Clone>(x: T) -> Receiver<T> {
let (tx, rx) = channel();
Thread::spawn(move|| {
thread::spawn(move|| {
tx.send(x.clone());
});
rx

View file

@ -21,7 +21,7 @@
use std::sync::mpsc::{channel, Sender, Receiver};
use std::os;
use std::env;
use std::thread::Thread;
use std::thread;
use std::time::Duration;
fn move_out<T>(_x: T) {}
@ -64,7 +64,7 @@ fn run(args: &[String]) {
let mut worker_results = Vec::new();
for _ in 0u..workers {
let to_child = to_child.clone();
worker_results.push(Thread::scoped(move|| {
worker_results.push(thread::spawn(move|| {
for _ in 0u..size / workers {
//println!("worker {}: sending {} bytes", i, num_bytes);
to_child.send(request::bytes(num_bytes)).unwrap();
@ -72,7 +72,7 @@ fn run(args: &[String]) {
//println!("worker {} exiting", i);
}));
}
Thread::spawn(move|| {
thread::spawn(move|| {
server(&from_parent, &to_parent);
});

View file

@ -17,7 +17,7 @@
use std::sync::mpsc::{channel, Sender, Receiver};
use std::os;
use std::env;
use std::thread::Thread;
use std::thread;
use std::time::Duration;
enum request {
@ -57,7 +57,7 @@ fn run(args: &[String]) {
let mut worker_results = Vec::new();
let from_parent = if workers == 1 {
let (to_child, from_parent) = channel();
worker_results.push(Thread::scoped(move|| {
worker_results.push(thread::spawn(move|| {
for _ in 0u..size / workers {
//println!("worker {}: sending {} bytes", i, num_bytes);
to_child.send(request::bytes(num_bytes));
@ -69,7 +69,7 @@ fn run(args: &[String]) {
let (to_child, from_parent) = channel();
for _ in 0u..workers {
let to_child = to_child.clone();
worker_results.push(Thread::scoped(move|| {
worker_results.push(thread::spawn(move|| {
for _ in 0u..size / workers {
//println!("worker {}: sending {} bytes", i, num_bytes);
to_child.send(request::bytes(num_bytes));
@ -79,7 +79,7 @@ fn run(args: &[String]) {
}
from_parent
};
Thread::spawn(move|| {
thread::spawn(move|| {
server(&from_parent, &to_parent);
});

View file

@ -19,7 +19,7 @@
use std::sync::mpsc::channel;
use std::os;
use std::thread::Thread;
use std::thread;
// This is a simple bench that creates M pairs of tasks. These
// tasks ping-pong back and forth over a pair of streams. This is a
@ -35,7 +35,7 @@ fn ping_pong_bench(n: uint, m: uint) {
// Create a channel: B->A
let (btx, brx) = channel();
let guard_a = Thread::scoped(move|| {
let guard_a = thread::spawn(move|| {
let (tx, rx) = (atx, brx);
for _ in 0..n {
tx.send(()).unwrap();
@ -43,7 +43,7 @@ fn ping_pong_bench(n: uint, m: uint) {
}
});
let guard_b = Thread::scoped(move|| {
let guard_b = thread::spawn(move|| {
let (tx, rx) = (btx, arx);
for _ in 0..n {
rx.recv().unwrap();

View file

@ -10,7 +10,7 @@
use std::sync::mpsc::channel;
use std::os;
use std::thread::Thread;
use std::thread;
// A simple implementation of parfib. One subtree is found in a new
// task and communicated over a oneshot pipe, the other is found
@ -22,7 +22,7 @@ fn parfib(n: uint) -> uint {
}
let (tx, rx) = channel();
Thread::spawn(move|| {
thread::spawn(move|| {
tx.send(parfib(n-1)).unwrap();
});
let m2 = parfib(n-2);

View file

@ -111,7 +111,7 @@ 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::scoped(move || inner(depth, iterations))
thread::spawn(move || inner(depth, iterations))
}).collect::<Vec<_>>();
for message in messages {

View file

@ -43,7 +43,7 @@
use self::Color::{Red, Yellow, Blue};
use std::sync::mpsc::{channel, Sender, Receiver};
use std::fmt;
use std::thread::Thread;
use std::thread;
fn print_complements() {
let all = [Blue, Red, Yellow];
@ -187,7 +187,7 @@ fn rendezvous(nn: uint, set: Vec<Color>) {
let to_rendezvous = to_rendezvous.clone();
let to_rendezvous_log = to_rendezvous_log.clone();
let (to_creature, from_rendezvous) = channel();
Thread::spawn(move|| {
thread::spawn(move|| {
creature(ii,
col,
from_rendezvous,

View file

@ -39,7 +39,7 @@
// OF THE POSSIBILITY OF SUCH DAMAGE.
use std::{cmp, iter, mem};
use std::thread::Thread;
use std::thread;
fn rotate(x: &mut [i32]) {
let mut prev = x[0];
@ -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::scoped(move|| {
futures.push(thread::spawn(move|| {
work(perm, j as uint, max as uint)
}))
}

View file

@ -24,7 +24,7 @@ use std::option;
use std::os;
use std::env;
use std::sync::mpsc::{channel, Sender, Receiver};
use std::thread::Thread;
use std::thread;
fn f64_cmp(x: f64, y: f64) -> Ordering {
// arbitrarily decide that NaNs are larger than everything.
@ -172,7 +172,7 @@ fn main() {
let (to_child, from_parent) = channel();
Thread::spawn(move|| {
thread::spawn(move|| {
make_sequence_processor(sz, &from_parent, &to_parent_);
});

View file

@ -45,7 +45,7 @@
use std::ascii::OwnedAsciiExt;
use std::slice;
use std::sync::Arc;
use std::thread::Thread;
use std::thread;
static TABLE: [u8;4] = [ 'A' as u8, 'C' as u8, 'G' as u8, 'T' as u8 ];
static TABLE_SIZE: uint = 2 << 16;
@ -303,11 +303,11 @@ fn main() {
let nb_freqs: Vec<_> = (1u..3).map(|i| {
let input = input.clone();
(i, Thread::scoped(move|| generate_frequencies(&input, i)))
(i, thread::spawn(move|| generate_frequencies(&input, i)))
}).collect();
let occ_freqs: Vec<_> = OCCURRENCES.iter().map(|&occ| {
let input = input.clone();
Thread::scoped(move|| generate_frequencies(&input, occ.len()))
thread::spawn(move|| generate_frequencies(&input, occ.len()))
}).collect();
for (i, freq) in nb_freqs {

View file

@ -46,7 +46,7 @@ use std::old_io;
use std::os;
use std::simd::f64x2;
use std::sync::Arc;
use std::thread::Thread;
use std::thread;
const ITER: usize = 50;
const LIMIT: f64 = 2.0;
@ -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::scoped(move|| {
thread::spawn(move|| {
let mut rs = Vec::with_capacity(w / WORKERS);
let mut is = Vec::with_capacity(w / WORKERS);
@ -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::scoped(move|| {
thread::spawn(move|| {
let mut res: Vec<u8> = Vec::with_capacity((chunk_size * w) / 8);
let init_r_slice = vec_init_r;

View file

@ -43,7 +43,7 @@
use std::iter::repeat;
use std::sync::Arc;
use std::sync::mpsc::channel;
use std::thread::Thread;
use std::thread;
//
// Utilities.
@ -317,7 +317,7 @@ fn par_search(masks: Vec<Vec<Vec<u64>>>) -> Data {
let masks = masks.clone();
let tx = tx.clone();
let m = *m;
Thread::spawn(move|| {
thread::spawn(move|| {
let mut data = Data::new();
search(&*masks, m, 1, List::Cons(m, &List::Nil), &mut data);
tx.send(data).unwrap();

View file

@ -24,7 +24,7 @@ use std::sync::mpsc::{channel, Sender};
use std::os;
use std::env;
use std::result::Result::{Ok, Err};
use std::thread::Thread;
use std::thread;
use std::time::Duration;
fn fib(n: int) -> int {
@ -36,15 +36,15 @@ fn fib(n: int) -> int {
} else {
let (tx1, rx) = channel();
let tx2 = tx1.clone();
Thread::spawn(move|| pfib(&tx2, n - 1));
thread::spawn(move|| pfib(&tx2, n - 1));
let tx2 = tx1.clone();
Thread::spawn(move|| pfib(&tx2, n - 2));
thread::spawn(move|| pfib(&tx2, n - 2));
tx.send(rx.recv().unwrap() + rx.recv().unwrap());
}
}
let (tx, rx) = channel();
Thread::spawn(move|| pfib(&tx, n) );
thread::spawn(move|| pfib(&tx, n) );
rx.recv().unwrap()
}
@ -79,7 +79,7 @@ fn stress_task(id: int) {
fn stress(num_tasks: int) {
let mut results = Vec::new();
for i in 0..num_tasks {
results.push(Thread::scoped(move|| {
results.push(thread::spawn(move|| {
stress_task(i);
}));
}

View file

@ -47,7 +47,7 @@ extern crate libc;
use std::old_io::stdio::{stdin_raw, stdout_raw};
use std::old_io::{IoResult, EndOfFile};
use std::ptr::{copy_memory, Unique};
use std::thread::Thread;
use std::thread;
struct Tables {
table8: [u8;1 << 8],
@ -241,7 +241,7 @@ fn parallel<'a, I, T, F>(iter: I, f: F)
// boundary.
let f = Racy(&f as *const F as *const uint);
let raw = Racy(chunk.repr());
Thread::scoped(move|| {
thread::spawn(move|| {
let f = f.0 as *const F;
unsafe { (*f)(mem::transmute(raw.0)) }
})

View file

@ -44,7 +44,7 @@
#![feature(unboxed_closures)]
use std::iter::{repeat, AdditiveIterator};
use std::thread::Thread;
use std::thread;
use std::mem;
use std::num::Float;
use std::os;
@ -129,7 +129,7 @@ fn parallel<T, F>(v: &mut [T], f: F)
// boundary.
let f = Racy(&f as *const _ as *const uint);
let raw = Racy(chunk.repr());
Thread::scoped(move|| {
thread::spawn(move|| {
let f = f.0 as *const F;
unsafe { (*f)(i * size, mem::transmute(raw.0)) }
})

View file

@ -39,7 +39,7 @@
// OF THE POSSIBILITY OF SUCH DAMAGE.
use std::sync::mpsc::{channel, Sender, Receiver};
use std::thread::Thread;
use std::thread;
fn start(n_tasks: i32, token: i32) {
let (tx, mut rx) = channel();
@ -48,9 +48,9 @@ fn start(n_tasks: i32, token: i32) {
for i in 2 .. n_tasks + 1 {
let (tx, next_rx) = channel();
let cur_rx = std::mem::replace(&mut rx, next_rx);
guards.push(Thread::scoped(move|| roundtrip(i, tx, cur_rx)));
guards.push(thread::spawn(move|| roundtrip(i, tx, cur_rx)));
}
let guard = Thread::scoped(move|| roundtrip(1, tx, rx));
let guard = thread::spawn(move|| roundtrip(1, tx, rx));
}
fn roundtrip(id: i32, tx: Sender<i32>, rx: Receiver<i32>) {

View file

@ -11,7 +11,7 @@
#![feature(unsafe_destructor, box_syntax)]
use std::env;
use std::thread::Thread;
use std::thread;
use std::time::Duration;
#[derive(Clone)]
@ -32,7 +32,7 @@ fn main() {
fn run(repeat: int, depth: int) {
for _ in 0..repeat {
let dur = Duration::span(|| {
let _ = Thread::scoped(move|| {
let _ = thread::spawn(move|| {
recurse_or_panic(depth, None)
}).join();
});

View file

@ -20,15 +20,15 @@
use std::sync::mpsc::{channel, Sender};
use std::os;
use std::env;
use std::thread::Thread;
use std::thread;
fn child_generation(gens_left: uint, tx: Sender<()>) {
// This used to be O(n^2) in the number of generations that ever existed.
// With this code, only as many generations are alive at a time as tasks
// alive at a time,
Thread::spawn(move|| {
thread::spawn(move|| {
if gens_left & 1 == 1 {
Thread::yield_now(); // shake things up a bit
thread::yield_now(); // shake things up a bit
}
if gens_left > 0 {
child_generation(gens_left - 1, tx); // recurse

View file

@ -10,12 +10,12 @@
use std::os;
use std::env;
use std::thread::Thread;
use std::thread;
fn f(n: uint) {
let mut i = 0u;
while i < n {
let _ = Thread::scoped(move|| g()).join();
let _ = thread::spawn(move|| g()).join();
i += 1u;
}
}
@ -33,5 +33,5 @@ fn main() {
};
let n = args[1].parse().unwrap();
let mut i = 0u;
while i < n { Thread::spawn(move|| f(n) ); i += 1u; }
while i < n { thread::spawn(move|| f(n) ); i += 1u; }
}

View file

@ -10,7 +10,7 @@
#![feature(box_syntax)]
use std::thread::Thread;
use std::thread;
fn borrow<F>(v: &isize, f: F) where F: FnOnce(&isize) {
f(v);
@ -19,7 +19,7 @@ fn borrow<F>(v: &isize, f: F) where F: FnOnce(&isize) {
fn box_imm() {
let v = box 3;
let _w = &v;
Thread::spawn(move|| {
thread::spawn(move|| {
println!("v={}", *v);
//~^ ERROR cannot move `v` into closure
});
@ -28,7 +28,7 @@ fn box_imm() {
fn box_imm_explicit() {
let v = box 3;
let _w = &v;
Thread::spawn(move|| {
thread::spawn(move|| {
println!("v={}", *v);
//~^ ERROR cannot move
});

View file

@ -10,7 +10,7 @@
#![feature(box_syntax)]
use std::thread::Thread;
use std::thread;
fn borrow<T>(_: &T) { }
@ -19,7 +19,7 @@ fn different_vars_after_borrows() {
let p1 = &x1;
let x2 = box 2;
let p2 = &x2;
Thread::spawn(move|| {
thread::spawn(move|| {
drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed
drop(x2); //~ ERROR cannot move `x2` into closure because it is borrowed
});
@ -32,7 +32,7 @@ fn different_vars_after_moves() {
drop(x1);
let x2 = box 2;
drop(x2);
Thread::spawn(move|| {
thread::spawn(move|| {
drop(x1); //~ ERROR capture of moved value: `x1`
drop(x2); //~ ERROR capture of moved value: `x2`
});
@ -41,7 +41,7 @@ fn different_vars_after_moves() {
fn same_var_after_borrow() {
let x = box 1;
let p = &x;
Thread::spawn(move|| {
thread::spawn(move|| {
drop(x); //~ ERROR cannot move `x` into closure because it is borrowed
drop(x); //~ ERROR use of moved value: `x`
});
@ -51,7 +51,7 @@ fn same_var_after_borrow() {
fn same_var_after_move() {
let x = box 1;
drop(x);
Thread::spawn(move|| {
thread::spawn(move|| {
drop(x); //~ ERROR capture of moved value: `x`
drop(x); //~ ERROR use of moved value: `x`
});

View file

@ -9,11 +9,11 @@
// except according to those terms.
use std::sync::mpsc::channel;
use std::thread::Thread;
use std::thread;
fn main() {
let (tx, rx) = channel();
let _t = Thread::spawn(move|| -> () {
let _t = thread::spawn(move|| -> () {
loop {
let tx = tx;
//~^ ERROR: use of moved value: `tx`

View file

@ -9,47 +9,47 @@
// except according to those terms.
use std::{int, i8, i16, i32, i64};
use std::thread::Thread;
use std::thread;
fn main() {
assert!(Thread::scoped(move|| int::MIN / -1).join().is_err());
assert!(thread::spawn(move|| int::MIN / -1).join().is_err());
//~^ ERROR attempted to divide with overflow in a constant expression
assert!(Thread::scoped(move|| i8::MIN / -1).join().is_err());
assert!(thread::spawn(move|| i8::MIN / -1).join().is_err());
//~^ ERROR attempted to divide with overflow in a constant expression
assert!(Thread::scoped(move|| i16::MIN / -1).join().is_err());
assert!(thread::spawn(move|| i16::MIN / -1).join().is_err());
//~^ ERROR attempted to divide with overflow in a constant expression
assert!(Thread::scoped(move|| i32::MIN / -1).join().is_err());
assert!(thread::spawn(move|| i32::MIN / -1).join().is_err());
//~^ ERROR attempted to divide with overflow in a constant expression
assert!(Thread::scoped(move|| i64::MIN / -1).join().is_err());
assert!(thread::spawn(move|| i64::MIN / -1).join().is_err());
//~^ ERROR attempted to divide with overflow in a constant expression
assert!(Thread::scoped(move|| 1is / 0).join().is_err());
assert!(thread::spawn(move|| 1is / 0).join().is_err());
//~^ ERROR attempted to divide by zero in a constant expression
assert!(Thread::scoped(move|| 1i8 / 0).join().is_err());
assert!(thread::spawn(move|| 1i8 / 0).join().is_err());
//~^ ERROR attempted to divide by zero in a constant expression
assert!(Thread::scoped(move|| 1i16 / 0).join().is_err());
assert!(thread::spawn(move|| 1i16 / 0).join().is_err());
//~^ ERROR attempted to divide by zero in a constant expression
assert!(Thread::scoped(move|| 1i32 / 0).join().is_err());
assert!(thread::spawn(move|| 1i32 / 0).join().is_err());
//~^ ERROR attempted to divide by zero in a constant expression
assert!(Thread::scoped(move|| 1i64 / 0).join().is_err());
assert!(thread::spawn(move|| 1i64 / 0).join().is_err());
//~^ ERROR attempted to divide by zero in a constant expression
assert!(Thread::scoped(move|| int::MIN % -1).join().is_err());
assert!(thread::spawn(move|| int::MIN % -1).join().is_err());
//~^ ERROR attempted remainder with overflow in a constant expression
assert!(Thread::scoped(move|| i8::MIN % -1).join().is_err());
assert!(thread::spawn(move|| i8::MIN % -1).join().is_err());
//~^ ERROR attempted remainder with overflow in a constant expression
assert!(Thread::scoped(move|| i16::MIN % -1).join().is_err());
assert!(thread::spawn(move|| i16::MIN % -1).join().is_err());
//~^ ERROR attempted remainder with overflow in a constant expression
assert!(Thread::scoped(move|| i32::MIN % -1).join().is_err());
assert!(thread::spawn(move|| i32::MIN % -1).join().is_err());
//~^ ERROR attempted remainder with overflow in a constant expression
assert!(Thread::scoped(move|| i64::MIN % -1).join().is_err());
assert!(thread::spawn(move|| i64::MIN % -1).join().is_err());
//~^ ERROR attempted remainder with overflow in a constant expression
assert!(Thread::scoped(move|| 1is % 0).join().is_err());
assert!(thread::spawn(move|| 1is % 0).join().is_err());
//~^ ERROR attempted remainder with a divisor of zero in a constant expression
assert!(Thread::scoped(move|| 1i8 % 0).join().is_err());
assert!(thread::spawn(move|| 1i8 % 0).join().is_err());
//~^ ERROR attempted remainder with a divisor of zero in a constant expression
assert!(Thread::scoped(move|| 1i16 % 0).join().is_err());
assert!(thread::spawn(move|| 1i16 % 0).join().is_err());
//~^ ERROR attempted remainder with a divisor of zero in a constant expression
assert!(Thread::scoped(move|| 1i32 % 0).join().is_err());
assert!(thread::spawn(move|| 1i32 % 0).join().is_err());
//~^ ERROR attempted remainder with a divisor of zero in a constant expression
assert!(Thread::scoped(move|| 1i64 % 0).join().is_err());
assert!(thread::spawn(move|| 1i64 % 0).join().is_err());
//~^ ERROR attempted remainder with a divisor of zero in a constant expression
}

View file

@ -30,4 +30,4 @@ pub mod bar {
// #[stable] is not inherited
pub fn unmarked() {}
//~^ ERROR This node does not have a stability attribute
}
}

View file

@ -8,11 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::thread::Thread;
use std::thread;
fn main() {
let x = "Hello world!".to_string();
Thread::spawn(move|| {
thread::spawn(move|| {
println!("{}", x);
});
println!("{}", x); //~ ERROR use of moved value

View file

@ -11,13 +11,13 @@
// error-pattern: use of moved value
use std::sync::Arc;
use std::thread::Thread;
use std::thread;
fn main() {
let v = vec!(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
let arc_v = Arc::new(v);
Thread::spawn(move|| {
thread::spawn(move|| {
assert_eq!((*arc_v)[3], 4);
});

View file

@ -9,13 +9,13 @@
// except according to those terms.
use std::sync::Arc;
use std::thread::Thread;
use std::thread;
fn main() {
let v = vec!(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
let arc_v = Arc::new(v);
Thread::spawn(move|| {
thread::spawn(move|| {
assert_eq!((*arc_v)[3], 4);
});

View file

@ -10,7 +10,7 @@
#![feature(unsafe_destructor)]
use std::thread::Thread;
use std::thread;
use std::rc::Rc;
#[derive(Debug)]
@ -35,7 +35,7 @@ fn main() {
let x = foo(Port(Rc::new(())));
Thread::spawn(move|| {
thread::spawn(move|| {
//~^ ERROR `core::marker::Send` is not implemented
let y = x;
println!("{:?}", y);

View file

@ -10,10 +10,10 @@
// error-pattern:thread '<unnamed>' panicked at 'test'
use std::thread::Thread;
use std::thread;
fn main() {
let r: Result<int,_> = Thread::scoped(move|| {
let r: Result<int,_> = thread::spawn(move|| {
panic!("test");
1
}).join();

View file

@ -12,7 +12,7 @@
#[macro_use] extern crate log;
use std::os;
use std::thread::Thread;
use std::thread;
struct r {
x:int,
@ -35,7 +35,7 @@ fn r(x:int) -> r {
fn main() {
error!("whatever");
let _t = Thread::spawn(move|| {
let _t = thread::spawn(move|| {
let _i = r(5);
});
panic!();

View file

@ -10,12 +10,12 @@
// error-pattern:Ensure that the child task runs by panicking
use std::thread::Thread;
use std::thread;
fn main() {
// the purpose of this test is to make sure that task::spawn()
// works when provided with a bare function:
let r = Thread::scoped(startfn).join();
let r = thread::spawn(startfn).join();
if r.is_err() {
panic!()
}

View file

@ -12,7 +12,7 @@
#![feature(box_syntax)]
use std::sync::mpsc::{channel, Sender};
use std::thread::Thread;
use std::thread;
fn child(tx: &Sender<Box<uint>>, i: uint) {
tx.send(box i).unwrap();
@ -25,7 +25,7 @@ pub fn main() {
let _t = (0u..n).map(|i| {
expected += i;
let tx = tx.clone();
Thread::scoped(move|| {
thread::spawn(move|| {
child(&tx, i)
})
}).collect::<Vec<_>>();

View file

@ -11,7 +11,7 @@
// Make sure the destructor is run for unit-like structs.
use std::boxed::BoxAny;
use std::thread::Thread;
use std::thread;
struct Foo;
@ -22,7 +22,7 @@ impl Drop for Foo {
}
pub fn main() {
let x = Thread::scoped(move|| {
let x = thread::spawn(move|| {
let _b = Foo;
}).join();

View file

@ -9,7 +9,7 @@
// except according to those terms.
use std::sync::mpsc::{channel, Sender};
use std::thread::Thread;
use std::thread;
struct complainer {
tx: Sender<bool>,
@ -37,7 +37,7 @@ fn f(tx: Sender<bool>) {
pub fn main() {
let (tx, rx) = channel();
let _t = Thread::scoped(move|| f(tx.clone()));
let _t = thread::spawn(move|| f(tx.clone()));
println!("hiiiiiiiii");
assert!(rx.recv().unwrap());
}

View file

@ -11,7 +11,7 @@
#![allow(unknown_features)]
#![feature(box_syntax)]
use std::thread::Thread;
use std::thread;
fn f() {
let _a = box 0;
@ -19,5 +19,5 @@ fn f() {
}
pub fn main() {
let _t = Thread::scoped(f);
let _t = thread::spawn(f);
}

View file

@ -10,7 +10,7 @@
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
use std::rand::{thread_rng, Rng, Rand};
use std::thread::Thread;
use std::thread;
const REPEATS: usize = 5;
const MAX_LEN: usize = 32;
@ -79,7 +79,7 @@ pub fn main() {
let v = main.clone();
let _ = Thread::scoped(move|| {
let _ = thread::spawn(move|| {
let mut v = v;
let mut panic_countdown = panic_countdown;
v.sort_by(|a, b| {

View file

@ -12,10 +12,10 @@
extern crate "weak-lang-items" as other;
use std::thread::Thread;
use std::thread;
fn main() {
let _ = Thread::scoped(move|| {
let _ = thread::spawn(move|| {
other::foo()
});
}

View file

@ -8,18 +8,18 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::thread::Thread;
use std::thread;
pub fn main() {
let mut result = Thread::scoped(child);
let mut result = thread::spawn(child);
println!("1");
Thread::yield_now();
thread::yield_now();
println!("2");
Thread::yield_now();
thread::yield_now();
println!("3");
result.join();
}
fn child() {
println!("4"); Thread::yield_now(); println!("5"); Thread::yield_now(); println!("6");
println!("4"); thread::yield_now(); println!("5"); thread::yield_now(); println!("6");
}

View file

@ -8,12 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::thread::Thread;
use std::thread;
pub fn main() {
let mut result = Thread::scoped(child);
let mut result = thread::spawn(child);
println!("1");
Thread::yield_now();
thread::yield_now();
result.join();
}

View file

@ -8,9 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::thread::Thread;
use std::thread;
pub fn main() {
let mut i: int = 0;
while i < 100 { i = i + 1; println!("{}", i); Thread::yield_now(); }
while i < 100 { i = i + 1; println!("{}", i); thread::yield_now(); }
}