about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-02-17 19:00:20 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-02-17 19:42:28 -0800
commit665ea963d3c29ef7670662707f2f2307f000efa3 (patch)
tree9281d6d03436f1c92585c191a7a130d38e1ff9f0 /src/test
parentba8ce4c2c27643cccfbbc481a19bcf4b7747cc89 (diff)
downloadrust-665ea963d3c29ef7670662707f2f2307f000efa3.tar.gz
rust-665ea963d3c29ef7670662707f2f2307f000efa3.zip
Test fixes and rebase conflicts
Diffstat (limited to 'src/test')
-rw-r--r--src/test/bench/shootout-binarytrees.rs6
-rw-r--r--src/test/bench/shootout-fannkuch-redux.rs4
-rw-r--r--src/test/bench/shootout-k-nucleotide.rs8
-rw-r--r--src/test/bench/shootout-mandelbrot.rs8
-rwxr-xr-xsrc/test/compile-fail/send-is-not-static-ensures-scoping.rs7
-rw-r--r--src/test/pretty/attr-fn-inner.rs2
-rw-r--r--src/test/run-make/static-unwinding/lib.rs2
-rw-r--r--src/test/run-make/static-unwinding/main.rs7
-rw-r--r--src/test/run-pass/drop-trait-enum.rs10
9 files changed, 28 insertions, 26 deletions
diff --git a/src/test/bench/shootout-binarytrees.rs b/src/test/bench/shootout-binarytrees.rs
index dc0a2a6459f..1e23da3020f 100644
--- a/src/test/bench/shootout-binarytrees.rs
+++ b/src/test/bench/shootout-binarytrees.rs
@@ -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: {}",
diff --git a/src/test/bench/shootout-fannkuch-redux.rs b/src/test/bench/shootout-fannkuch-redux.rs
index 8b840b16352..f7de935d08f 100644
--- a/src/test/bench/shootout-fannkuch-redux.rs
+++ b/src/test/bench/shootout-fannkuch-redux.rs
@@ -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);
     }
diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs
index e6beb952603..b5c460737b8 100644
--- a/src/test/bench/shootout-k-nucleotide.rs
+++ b/src/test/bench/shootout-k-nucleotide.rs
@@ -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);
     }
 }
diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs
index 8ab3b14a1f5..bddf6153228 100644
--- a/src/test/bench/shootout-mandelbrot.rs
+++ b/src/test/bench/shootout-mandelbrot.rs
@@ -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()
 }
diff --git a/src/test/compile-fail/send-is-not-static-ensures-scoping.rs b/src/test/compile-fail/send-is-not-static-ensures-scoping.rs
index 0b74892d66c..abbcd7e4590 100755
--- a/src/test/compile-fail/send-is-not-static-ensures-scoping.rs
+++ b/src/test/compile-fail/send-is-not-static-ensures-scoping.rs
@@ -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();
 }
diff --git a/src/test/pretty/attr-fn-inner.rs b/src/test/pretty/attr-fn-inner.rs
index 65dcf900567..79964d2a7ba 100644
--- a/src/test/pretty/attr-fn-inner.rs
+++ b/src/test/pretty/attr-fn-inner.rs
@@ -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]
diff --git a/src/test/run-make/static-unwinding/lib.rs b/src/test/run-make/static-unwinding/lib.rs
index c3fa1a68e16..12c72d54c09 100644
--- a/src/test/run-make/static-unwinding/lib.rs
+++ b/src/test/run-make/static-unwinding/lib.rs
@@ -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 {
diff --git a/src/test/run-make/static-unwinding/main.rs b/src/test/run-make/static-unwinding/main.rs
index 6d10a247143..d325f54d365 100644
--- a/src/test/run-make/static-unwinding/main.rs
+++ b/src/test/run-make/static-unwinding/main.rs
@@ -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 {
diff --git a/src/test/run-pass/drop-trait-enum.rs b/src/test/run-pass/drop-trait-enum.rs
index 2474bb8a4f3..d52c645730f 100644
--- a/src/test/run-pass/drop-trait-enum.rs
+++ b/src/test/run-pass/drop-trait-enum.rs
@@ -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());
 }