diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-12-22 09:04:23 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-02 08:54:06 -0800 |
| commit | 56290a004493a5d2e211f056601533253497df60 (patch) | |
| tree | ab0e7c227f9ba155ea5bfd0390cada43062924c1 /src/test | |
| parent | 71b46b18a274edc7f7fb60b490e5ebbb9c911462 (diff) | |
| download | rust-56290a004493a5d2e211f056601533253497df60.tar.gz rust-56290a004493a5d2e211f056601533253497df60.zip | |
std: Stabilize the prelude module
This commit is an implementation of [RFC 503][rfc] which is a stabilization story for the prelude. Most of the RFC was directly applied, removing reexports. Some reexports are kept around, however: * `range` remains until range syntax has landed to reduce churn. * `Path` and `GenericPath` remain until path reform lands. This is done to prevent many imports of `GenericPath` which will soon be removed. * All `io` traits remain until I/O reform lands so imports can be rewritten all at once to `std::io::prelude::*`. This is a breaking change because many prelude reexports have been removed, and the RFC can be consulted for the exact list of removed reexports, as well as to find the locations of where to import them. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0503-prelude-stabilization.md [breaking-change] Closes #20068
Diffstat (limited to 'src/test')
140 files changed, 295 insertions, 131 deletions
diff --git a/src/test/auxiliary/cci_capture_clause.rs b/src/test/auxiliary/cci_capture_clause.rs index 1cccb0f7ccb..e3dbe3c7e22 100644 --- a/src/test/auxiliary/cci_capture_clause.rs +++ b/src/test/auxiliary/cci_capture_clause.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::task; +use std::comm::{Receiver, channel}; pub fn foo<T:Send + Clone>(x: T) -> Receiver<T> { let (tx, rx) = channel(); diff --git a/src/test/auxiliary/static-methods-crate.rs b/src/test/auxiliary/static-methods-crate.rs index 811d8f11692..ea4751bf4ed 100644 --- a/src/test/auxiliary/static-methods-crate.rs +++ b/src/test/auxiliary/static-methods-crate.rs @@ -12,6 +12,7 @@ #![crate_type = "lib"] use std::int; +use std::str::from_str; pub trait read { fn readMaybe(s: String) -> Option<Self>; diff --git a/src/test/auxiliary/trait_inheritance_overloading_xc.rs b/src/test/auxiliary/trait_inheritance_overloading_xc.rs index 61854aba279..7de34d52f51 100644 --- a/src/test/auxiliary/trait_inheritance_overloading_xc.rs +++ b/src/test/auxiliary/trait_inheritance_overloading_xc.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::cmp::PartialEq; +use std::ops::{Add, Sub, Mul}; pub trait MyNum : Add<Self,Self> + Sub<Self,Self> + Mul<Self,Self> + PartialEq + Clone { } diff --git a/src/test/auxiliary/unboxed-closures-cross-crate.rs b/src/test/auxiliary/unboxed-closures-cross-crate.rs index 9a6a2c7495b..0b65fa913cb 100644 --- a/src/test/auxiliary/unboxed-closures-cross-crate.rs +++ b/src/test/auxiliary/unboxed-closures-cross-crate.rs @@ -10,6 +10,8 @@ #![feature(unboxed_closures)] +use std::ops::Add; + #[inline] pub fn has_closures() -> uint { let x = 1u; diff --git a/src/test/bench/core-map.rs b/src/test/bench/core-map.rs index 60331dfb550..0ada1cb991c 100644 --- a/src/test/bench/core-map.rs +++ b/src/test/bench/core-map.rs @@ -13,6 +13,7 @@ use std::collections::{BTreeMap, HashMap, HashSet}; use std::os; use std::rand::{Rng, IsaacRng, SeedableRng}; +use std::str::from_str; use std::time::Duration; use std::uint; diff --git a/src/test/bench/core-set.rs b/src/test/bench/core-set.rs index 49f5c7751d9..52380001c6c 100644 --- a/src/test/bench/core-set.rs +++ b/src/test/bench/core-set.rs @@ -15,11 +15,12 @@ extern crate collections; extern crate rand; +use std::collections::BTreeSet; use std::collections::BitvSet; use std::collections::HashSet; -use std::collections::BTreeSet; use std::hash::Hash; use std::os; +use std::str::from_str; use std::time::Duration; use std::uint; diff --git a/src/test/bench/core-uint-to-str.rs b/src/test/bench/core-uint-to-str.rs index 98113cb8347..08637b4bf1c 100644 --- a/src/test/bench/core-uint-to-str.rs +++ b/src/test/bench/core-uint-to-str.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::os; +use std::str::from_str; use std::uint; fn main() { diff --git a/src/test/bench/msgsend-pipes-shared.rs b/src/test/bench/msgsend-pipes-shared.rs index 645c029f935..94b7e58a54c 100644 --- a/src/test/bench/msgsend-pipes-shared.rs +++ b/src/test/bench/msgsend-pipes-shared.rs @@ -18,8 +18,10 @@ // different scalability characteristics compared to the select // version. +use std::comm::{channel, Sender, Receiver}; use std::comm; use std::os; +use std::str::from_str; use std::thread::Thread; use std::time::Duration; use std::uint; diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs index ed96c6406d8..4fb84c86106 100644 --- a/src/test/bench/msgsend-pipes.rs +++ b/src/test/bench/msgsend-pipes.rs @@ -14,7 +14,9 @@ // // I *think* it's the same, more or less. +use std::comm::{channel, Sender, Receiver}; use std::os; +use std::str::from_str; use std::thread::Thread; use std::time::Duration; use std::uint; diff --git a/src/test/bench/msgsend-ring-mutex-arcs.rs b/src/test/bench/msgsend-ring-mutex-arcs.rs index 8ec44b2dd3c..3ead5ef64fd 100644 --- a/src/test/bench/msgsend-ring-mutex-arcs.rs +++ b/src/test/bench/msgsend-ring-mutex-arcs.rs @@ -19,6 +19,7 @@ // ignore-lexer-test FIXME #15679 use std::os; +use std::str::from_str; use std::sync::{Arc, Future, Mutex, Condvar}; use std::time::Duration; use std::uint; diff --git a/src/test/bench/rt-messaging-ping-pong.rs b/src/test/bench/rt-messaging-ping-pong.rs index 73d54372b27..d3a340d488b 100644 --- a/src/test/bench/rt-messaging-ping-pong.rs +++ b/src/test/bench/rt-messaging-ping-pong.rs @@ -17,7 +17,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::comm::channel; use std::os; +use std::str::from_str; +use std::thread::Thread; use std::uint; // This is a simple bench that creates M pairs of tasks. These @@ -34,21 +37,21 @@ fn ping_pong_bench(n: uint, m: uint) { // Create a stream B->A let (btx, brx) = channel::<()>(); - spawn(move|| { + Thread::spawn(move|| { let (tx, rx) = (atx, brx); for _ in range(0, n) { tx.send(()); rx.recv(); } - }); + }).detach(); - spawn(move|| { + Thread::spawn(move|| { let (tx, rx) = (btx, arx); for _ in range(0, n) { rx.recv(); tx.send(()); } - }); + }).detach(); } for _ in range(0, m) { diff --git a/src/test/bench/rt-parfib.rs b/src/test/bench/rt-parfib.rs index bdf22cd7395..0a513c32aaf 100644 --- a/src/test/bench/rt-parfib.rs +++ b/src/test/bench/rt-parfib.rs @@ -8,7 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::comm::channel; use std::os; +use std::str::from_str; +use std::thread::Thread; use std::uint; // A simple implementation of parfib. One subtree is found in a new @@ -21,9 +24,9 @@ fn parfib(n: uint) -> uint { } let (tx, rx) = channel(); - spawn(move|| { + Thread::spawn(move|| { tx.send(parfib(n-1)); - }); + }).detach(); let m2 = parfib(n-2); return (rx.recv() + m2); } diff --git a/src/test/bench/shootout-ackermann.rs b/src/test/bench/shootout-ackermann.rs index e7a50382c94..f7810d5d740 100644 --- a/src/test/bench/shootout-ackermann.rs +++ b/src/test/bench/shootout-ackermann.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::os; +use std::str::from_str; fn ack(m: int, n: int) -> int { if m == 0 { diff --git a/src/test/bench/shootout-binarytrees.rs b/src/test/bench/shootout-binarytrees.rs index 0b16e8011e8..2f25c37a911 100644 --- a/src/test/bench/shootout-binarytrees.rs +++ b/src/test/bench/shootout-binarytrees.rs @@ -41,7 +41,9 @@ extern crate arena; use std::iter::range_step; +use std::str::from_str; use std::sync::Future; + use arena::TypedArena; enum Tree<'a> { diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs index dcdb90a11c8..6bbf6cde4ea 100644 --- a/src/test/bench/shootout-chameneos-redux.rs +++ b/src/test/bench/shootout-chameneos-redux.rs @@ -41,8 +41,10 @@ // no-pretty-expanded use self::Color::{Red, Yellow, Blue}; -use std::string::String; +use std::comm::{channel, Sender, Receiver}; use std::fmt; +use std::str::from_str; +use std::thread::Thread; fn print_complements() { let all = [Blue, Red, Yellow]; @@ -188,13 +190,13 @@ 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(); - spawn(move|| { + Thread::spawn(move|| { creature(ii, col, from_rendezvous, to_rendezvous, to_rendezvous_log); - }); + }).detach(); to_creature }).collect(); diff --git a/src/test/bench/shootout-fannkuch-redux.rs b/src/test/bench/shootout-fannkuch-redux.rs index ef38f5ef743..ec1268c9080 100644 --- a/src/test/bench/shootout-fannkuch-redux.rs +++ b/src/test/bench/shootout-fannkuch-redux.rs @@ -40,8 +40,9 @@ #![feature(slicing_syntax)] -use std::{cmp, iter, mem}; +use std::str::from_str; use std::sync::Future; +use std::{cmp, iter, mem}; fn rotate(x: &mut [i32]) { let mut prev = x[0]; diff --git a/src/test/bench/shootout-fasta-redux.rs b/src/test/bench/shootout-fasta-redux.rs index 178d6777939..09f7f236f19 100644 --- a/src/test/bench/shootout-fasta-redux.rs +++ b/src/test/bench/shootout-fasta-redux.rs @@ -44,6 +44,7 @@ use std::cmp::min; use std::io::{stdout, IoResult}; use std::os; use std::slice::bytes::copy_memory; +use std::str::from_str; const LINE_LEN: uint = 60; const LOOKUP_SIZE: uint = 4 * 1024; diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs index 2de61cf3572..7009dd4c1a7 100644 --- a/src/test/bench/shootout-fasta.rs +++ b/src/test/bench/shootout-fasta.rs @@ -40,11 +40,12 @@ #![feature(slicing_syntax)] -use std::io; -use std::io::{BufferedWriter, File}; use std::cmp::min; +use std::io::{BufferedWriter, File}; +use std::io; use std::num::Float; use std::os; +use std::str::from_str; const LINE_LENGTH: uint = 60; const IM: u32 = 139968; diff --git a/src/test/bench/shootout-fibo.rs b/src/test/bench/shootout-fibo.rs index 10c0d0a8044..cbacf415f6f 100644 --- a/src/test/bench/shootout-fibo.rs +++ b/src/test/bench/shootout-fibo.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::os; +use std::str::from_str; fn fib(n: int) -> int { if n < 2 { diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index f49b648e215..b59eef916dc 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -18,12 +18,15 @@ extern crate collections; use std::ascii::{AsciiExt, OwnedAsciiExt}; +use std::cmp::Ordering::{mod, Less, Greater, Equal}; use std::collections::HashMap; +use std::comm::{channel, Sender, Receiver}; use std::mem::replace; use std::num::Float; use std::option; use std::os; -use std::string::String; +use std::string::IntoString; +use std::thread::Thread; fn f64_cmp(x: f64, y: f64) -> Ordering { // arbitrarily decide that NaNs are larger than everything. @@ -167,9 +170,9 @@ fn main() { let (to_child, from_parent) = channel(); - spawn(move|| { + Thread::spawn(move|| { make_sequence_processor(sz, &from_parent, &to_parent_); - }); + }).detach(); to_child }).collect::<Vec<Sender<Vec<u8> >> >(); diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index a0ef392ed3a..3dc51805917 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -43,7 +43,6 @@ #![feature(slicing_syntax)] use std::ascii::OwnedAsciiExt; -use std::string::String; use std::slice; use std::sync::{Arc, Future}; diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs index bb0e09370d8..51ce4cbaa84 100644 --- a/src/test/bench/shootout-mandelbrot.rs +++ b/src/test/bench/shootout-mandelbrot.rs @@ -47,6 +47,7 @@ use std::io; use std::os; use std::simd::f64x2; +use std::str::from_str; use std::sync::{Arc, Future}; const ITER: int = 50; diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs index 9a3b6953062..2e229a50d16 100644 --- a/src/test/bench/shootout-meteor.rs +++ b/src/test/bench/shootout-meteor.rs @@ -40,7 +40,9 @@ // no-pretty-expanded FIXME #15189 +use std::comm::channel; use std::sync::Arc; +use std::thread::Thread; // // Utilities. @@ -310,11 +312,11 @@ fn par_search(masks: Vec<Vec<Vec<u64>>>) -> Data { let masks = masks.clone(); let tx = tx.clone(); let m = *m; - spawn(move|| { + Thread::spawn(move|| { let mut data = Data::new(); search(&*masks, m, 1, List::Cons(m, &List::Nil), &mut data); tx.send(data); - }); + }).detach(); } // collecting the results diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs index dab67331120..6a325798f58 100644 --- a/src/test/bench/shootout-nbody.rs +++ b/src/test/bench/shootout-nbody.rs @@ -39,6 +39,7 @@ // OF THE POSSIBILITY OF SUCH DAMAGE. use std::num::Float; +use std::str::from_str; const PI: f64 = 3.141592653589793; const SOLAR_MASS: f64 = 4.0 * PI * PI; diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index f7e8fc8fe1b..e58303a724a 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -20,8 +20,10 @@ extern crate getopts; +use std::comm::{channel, Sender}; use std::os; use std::result::Result::{Ok, Err}; +use std::str::from_str; use std::thread::Thread; use std::time::Duration; diff --git a/src/test/bench/shootout-reverse-complement.rs b/src/test/bench/shootout-reverse-complement.rs index 909f8afc34a..d9dfd65d5b3 100644 --- a/src/test/bench/shootout-reverse-complement.rs +++ b/src/test/bench/shootout-reverse-complement.rs @@ -45,9 +45,10 @@ extern crate libc; use std::io::stdio::{stdin_raw, stdout_raw}; +use std::io::{IoResult, EndOfFile}; use std::num::{div_rem}; use std::ptr::{copy_memory, Unique}; -use std::io::{IoResult, EndOfFile}; +use std::thread::Thread; struct Tables { table8: [u8;1 << 8], @@ -229,26 +230,20 @@ unsafe impl<T: 'static> Send for Racy<T> {} fn parallel<'a, I, T, F>(mut iter: I, f: F) where T: 'a+Send + Sync, I: Iterator<&'a mut [T]>, - F: Fn(&'a mut [T]) + Sync { + F: Fn(&mut [T]) + Sync { use std::mem; use std::raw::Repr; - let (tx, rx) = channel(); - for chunk in iter { - let tx = tx.clone(); - + iter.map(|chunk| { // Need to convert `f` and `chunk` to something that can cross the task // boundary. let f = Racy(&f as *const F as *const uint); let raw = Racy(chunk.repr()); - spawn(move|| { + Thread::spawn(move|| { let f = f.0 as *const F; unsafe { (*f)(mem::transmute(raw.0)) } - drop(tx) - }); - } - drop(tx); - for () in rx.iter() {} + }) + }).collect::<Vec<_>>(); } fn main() { diff --git a/src/test/bench/shootout-spectralnorm.rs b/src/test/bench/shootout-spectralnorm.rs index df388fbdde5..a5af1227a16 100644 --- a/src/test/bench/shootout-spectralnorm.rs +++ b/src/test/bench/shootout-spectralnorm.rs @@ -44,11 +44,13 @@ #![feature(unboxed_closures)] use std::iter::AdditiveIterator; +use std::thread::Thread; use std::mem; use std::num::Float; use std::os; use std::raw::Repr; use std::simd::f64x2; +use std::str::from_str; fn main() { let args = os::args(); @@ -80,14 +82,15 @@ fn mult_AtAv(v: &[f64], out: &mut [f64], tmp: &mut [f64]) { } fn mult_Av(v: &[f64], out: &mut [f64]) { - parallel(out, |&: start, out| mult(v, out, start, |i, j| A(i, j))); + parallel(out, |start, out| mult(v, out, start, |i, j| A(i, j))); } fn mult_Atv(v: &[f64], out: &mut [f64]) { - parallel(out, |&: start, out| mult(v, out, start, |i, j| A(j, i))); + parallel(out, |start, out| mult(v, out, start, |i, j| A(j, i))); } -fn mult(v: &[f64], out: &mut [f64], start: uint, a: |uint, uint| -> f64) { +fn mult<F>(v: &[f64], out: &mut [f64], start: uint, a: F) + where F: Fn(uint, uint) -> f64 { for (i, slot) in out.iter_mut().enumerate().map(|(i, s)| (i + start, s)) { let mut sum = f64x2(0.0, 0.0); for (j, chunk) in v.chunks(2).enumerate().map(|(j, s)| (2 * j, s)) { @@ -116,25 +119,19 @@ unsafe impl<T: 'static> Send for Racy<T> {} // Executes a closure in parallel over the given mutable slice. The closure `f` // is run in parallel and yielded the starting index within `v` as well as a // sub-slice of `v`. -fn parallel<'a, T, F>(v: &'a mut [T], f: F) - where T: Send + Sync, - F: Fn(uint, &'a mut [T]) + Sync { - let (tx, rx) = channel(); +fn parallel<T, F>(v: &mut [T], f: F) + where T: Send + Sync, + F: Fn(uint, &mut [T]) + Sync { let size = v.len() / os::num_cpus() + 1; - for (i, chunk) in v.chunks_mut(size).enumerate() { - let tx = tx.clone(); - + v.chunks_mut(size).enumerate().map(|(i, chunk)| { // Need to convert `f` and `chunk` to something that can cross the task // boundary. let f = Racy(&f as *const _ as *const uint); let raw = Racy(chunk.repr()); - spawn(move|| { + Thread::spawn(move|| { let f = f.0 as *const F; unsafe { (*f)(i * size, mem::transmute(raw.0)) } - drop(tx) - }); - } - drop(tx); - for () in rx.iter() {} + }) + }).collect::<Vec<_>>(); } diff --git a/src/test/bench/shootout-threadring.rs b/src/test/bench/shootout-threadring.rs index 111a92b083a..94d958ea8d5 100644 --- a/src/test/bench/shootout-threadring.rs +++ b/src/test/bench/shootout-threadring.rs @@ -38,15 +38,19 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED // OF THE POSSIBILITY OF SUCH DAMAGE. +use std::comm::{channel, Sender, Receiver}; +use std::str::from_str; +use std::thread::Thread; + fn start(n_tasks: int, token: int) { let (tx, mut rx) = channel(); tx.send(token); for i in range(2, n_tasks + 1) { let (tx, next_rx) = channel(); - spawn(move|| roundtrip(i, tx, rx)); + Thread::spawn(move|| roundtrip(i, tx, rx)).detach(); rx = next_rx; } - spawn(move|| roundtrip(1, tx, rx)); + Thread::spawn(move|| roundtrip(1, tx, rx)).detach(); } fn roundtrip(id: int, tx: Sender<int>, rx: Receiver<int>) { diff --git a/src/test/bench/spawnone.rs b/src/test/bench/spawnone.rs deleted file mode 100644 index ca36d99014c..00000000000 --- a/src/test/bench/spawnone.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Useful for checking syscall usage of baseline scheduler usage -fn main() { - spawn(move|| {}); -} diff --git a/src/test/bench/std-smallintmap.rs b/src/test/bench/std-smallintmap.rs index 576d96ba2a3..035b222e6ce 100644 --- a/src/test/bench/std-smallintmap.rs +++ b/src/test/bench/std-smallintmap.rs @@ -12,6 +12,7 @@ use std::collections::VecMap; use std::os; +use std::str::from_str; use std::time::Duration; use std::uint; diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs index 5fb7e2c3a84..cccc9362a72 100644 --- a/src/test/bench/sudoku.rs +++ b/src/test/bench/sudoku.rs @@ -12,11 +12,12 @@ #![allow(non_snake_case)] -use std::io; -use std::io::stdio::StdReader; use std::io::BufferedReader; +use std::io::stdio::StdReader; +use std::io; use std::num::Int; use std::os; +use std::str::from_str; // Computes a single solution to a given 9x9 sudoku // diff --git a/src/test/bench/task-perf-jargon-metal-smoke.rs b/src/test/bench/task-perf-jargon-metal-smoke.rs index 789ccb6142a..287b3fc6c46 100644 --- a/src/test/bench/task-perf-jargon-metal-smoke.rs +++ b/src/test/bench/task-perf-jargon-metal-smoke.rs @@ -17,16 +17,18 @@ // ignore-pretty very bad with line comments -use std::comm; +use std::comm::{mod, channel}; use std::os; +use std::str::from_str; use std::task; +use std::thread::Thread; use std::uint; fn child_generation(gens_left: uint, tx: comm::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, - spawn(move|| { + Thread::spawn(move|| { if gens_left & 1 == 1 { task::deschedule(); // shake things up a bit } @@ -35,7 +37,7 @@ fn child_generation(gens_left: uint, tx: comm::Sender<()>) { } else { tx.send(()) } - }); + }).detach(); } fn main() { diff --git a/src/test/bench/task-perf-spawnalot.rs b/src/test/bench/task-perf-spawnalot.rs index a6852d396d9..7e2c6fcf0ec 100644 --- a/src/test/bench/task-perf-spawnalot.rs +++ b/src/test/bench/task-perf-spawnalot.rs @@ -11,6 +11,7 @@ use std::os; use std::task; use std::uint; +use std::str::from_str; fn f(n: uint) { let mut i = 0u; diff --git a/src/test/compile-fail/bind-by-move-no-guards.rs b/src/test/compile-fail/bind-by-move-no-guards.rs index 18534db0dd5..90d5072f412 100644 --- a/src/test/compile-fail/bind-by-move-no-guards.rs +++ b/src/test/compile-fail/bind-by-move-no-guards.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::comm::channel; + fn main() { let (tx, rx) = channel(); let x = Some(rx); diff --git a/src/test/compile-fail/binop-consume-args.rs b/src/test/compile-fail/binop-consume-args.rs index 2bdd148b99b..afa255be699 100644 --- a/src/test/compile-fail/binop-consume-args.rs +++ b/src/test/compile-fail/binop-consume-args.rs @@ -10,6 +10,8 @@ // Test that binary operators consume their arguments +use std::ops::{Add, Sub, Mul, Div, Rem, BitAnd, BitXor, BitOr, Shl, Shr}; + fn add<A: Add<B, ()>, B>(lhs: A, rhs: B) { lhs + rhs; drop(lhs); //~ ERROR use of moved value: `lhs` diff --git a/src/test/compile-fail/binop-move-semantics.rs b/src/test/compile-fail/binop-move-semantics.rs index d9440e18375..e48c88a49f0 100644 --- a/src/test/compile-fail/binop-move-semantics.rs +++ b/src/test/compile-fail/binop-move-semantics.rs @@ -10,6 +10,8 @@ // Test that move restrictions are enforced on overloaded binary operations +use std::ops::Add; + fn double_move<T: Add<T, ()>>(x: T) { x + diff --git a/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs b/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs index 692303fc1e4..af9a18acbf2 100644 --- a/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs +++ b/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::ops::Add; #[deriving(Clone)] struct foo(Box<uint>); diff --git a/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs b/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs index b83e1544c96..b571af2425a 100644 --- a/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs +++ b/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::ops::Add; + #[deriving(Copy)] struct Point { x: int, diff --git a/src/test/compile-fail/borrowck-overloaded-index-2.rs b/src/test/compile-fail/borrowck-overloaded-index-2.rs index d9d7a43d46c..01afe405d5e 100644 --- a/src/test/compile-fail/borrowck-overloaded-index-2.rs +++ b/src/test/compile-fail/borrowck-overloaded-index-2.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::ops::Index; + struct MyVec<T> { data: Vec<T>, } diff --git a/src/test/compile-fail/borrowck-overloaded-index-autoderef.rs b/src/test/compile-fail/borrowck-overloaded-index-autoderef.rs index 2253d7512c0..e8949d4b30b 100644 --- a/src/test/compile-fail/borrowck-overloaded-index-autoderef.rs +++ b/src/test/compile-fail/borrowck-overloaded-index-autoderef.rs @@ -11,6 +11,8 @@ // Test that we still see borrowck errors of various kinds when using // indexing and autoderef in combination. +use std::ops::{Index, IndexMut}; + struct Foo { x: int, y: int, diff --git a/src/test/compile-fail/borrowck-overloaded-index.rs b/src/test/compile-fail/borrowck-overloaded-index.rs index 0422f6381dc..933d0f15e4e 100644 --- a/src/test/compile-fail/borrowck-overloaded-index.rs +++ b/src/test/compile-fail/borrowck-overloaded-index.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::ops::{Index, IndexMut}; + struct Foo { x: int, y: int, diff --git a/src/test/compile-fail/builtin-superkinds-self-type.rs b/src/test/compile-fail/builtin-superkinds-self-type.rs index 4c7ff60fbdd..6228b924729 100644 --- a/src/test/compile-fail/builtin-superkinds-self-type.rs +++ b/src/test/compile-fail/builtin-superkinds-self-type.rs @@ -11,6 +11,8 @@ // Tests (negatively) the ability for the Self type in default methods // to use capabilities granted by builtin kinds as supertraits. +use std::comm::{channel, Sender}; + trait Foo : Sync+'static { fn foo(self, mut chan: Sender<Self>) { } } diff --git a/src/test/compile-fail/comm-not-freeze-receiver.rs b/src/test/compile-fail/comm-not-freeze-receiver.rs index 8cb4b6328c4..83e329db0da 100644 --- a/src/test/compile-fail/comm-not-freeze-receiver.rs +++ b/src/test/compile-fail/comm-not-freeze-receiver.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::comm::Receiver; + fn test<T: Sync>() {} fn main() { diff --git a/src/test/compile-fail/comm-not-freeze.rs b/src/test/compile-fail/comm-not-freeze.rs index 8c17895eb8a..296b4187a1f 100644 --- a/src/test/compile-fail/comm-not-freeze.rs +++ b/src/test/compile-fail/comm-not-freeze.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::comm::Sender; + fn test<T: Sync>() {} fn main() { diff --git a/src/test/compile-fail/issue-12041.rs b/src/test/compile-fail/issue-12041.rs index 1878b5f5dea..f42e1a1bc15 100644 --- a/src/test/compile-fail/issue-12041.rs +++ b/src/test/compile-fail/issue-12041.rs @@ -8,9 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::comm::channel; +use std::thread::Thread; + fn main() { let (tx, rx) = channel(); - spawn(move|| { + let _t = Thread::spawn(move|| -> () { loop { let tx = tx; //~^ ERROR: use of moved value: `tx` diff --git a/src/test/compile-fail/issue-16709.rs b/src/test/compile-fail/issue-16709.rs index fc15801eb75..327f50ee059 100644 --- a/src/test/compile-fail/issue-16709.rs +++ b/src/test/compile-fail/issue-16709.rs @@ -11,6 +11,8 @@ use std::ptr; use std::raw; +trait Slice {} + fn main() { unsafe { let nil: *const u8 = ptr::null(); diff --git a/src/test/compile-fail/issue-18566.rs b/src/test/compile-fail/issue-18566.rs index f64d8fee2d8..c2e4629e14d 100644 --- a/src/test/compile-fail/issue-18566.rs +++ b/src/test/compile-fail/issue-18566.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::ops::Deref; + struct MyPtr<'a>(&'a mut uint); impl<'a> Deref<uint> for MyPtr<'a> { fn deref<'b>(&'b self) -> &'b uint { self.0 } diff --git a/src/test/compile-fail/issue-3702-2.rs b/src/test/compile-fail/issue-3702-2.rs index 54100d543dd..1e80fd7a7e9 100644 --- a/src/test/compile-fail/issue-3702-2.rs +++ b/src/test/compile-fail/issue-3702-2.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::num::ToPrimitive; + trait Add { fn to_int(&self) -> int; fn add_dynamic(&self, other: &Add) -> int; diff --git a/src/test/compile-fail/unop-move-semantics.rs b/src/test/compile-fail/unop-move-semantics.rs index ccdc7b833e7..c458c539c07 100644 --- a/src/test/compile-fail/unop-move-semantics.rs +++ b/src/test/compile-fail/unop-move-semantics.rs @@ -10,6 +10,8 @@ // Test that move restrictions are enforced on overloaded unary operations +use std::ops::Not; + fn move_then_borrow<T: Not<T> + Clone>(x: T) { !x; diff --git a/src/test/compile-fail/unsendable-class.rs b/src/test/compile-fail/unsendable-class.rs index cd5918e2f47..312f26394b2 100644 --- a/src/test/compile-fail/unsendable-class.rs +++ b/src/test/compile-fail/unsendable-class.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::comm::channel; // Test that a class with an unsendable field can't be // sent diff --git a/src/test/compile-fail/wrong-mul-method-signature.rs b/src/test/compile-fail/wrong-mul-method-signature.rs index b5e4cac7555..bde5b853078 100644 --- a/src/test/compile-fail/wrong-mul-method-signature.rs +++ b/src/test/compile-fail/wrong-mul-method-signature.rs @@ -13,6 +13,8 @@ // (In this case the mul method should take &f64 and not f64) // See: #11450 +use std::ops::Mul; + struct Vec1 { x: f64 } diff --git a/src/test/pretty/issue-4264.pp b/src/test/pretty/issue-4264.pp index c2ebd764ad6..35bd22880ce 100644 --- a/src/test/pretty/issue-4264.pp +++ b/src/test/pretty/issue-4264.pp @@ -4,7 +4,7 @@ #[phase(plugin, link)] extern crate "std" as std; #[prelude_import] -use std::prelude::*; +use std::prelude::v1::*; // Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/bool.rs b/src/test/run-pass/bool.rs index 238d0ecdca7..45710408172 100644 --- a/src/test/run-pass/bool.rs +++ b/src/test/run-pass/bool.rs @@ -10,6 +10,9 @@ // Basic boolean tests +use std::cmp::{Equal, Greater, Less}; +use std::ops::{BitAnd, BitOr, BitXor}; + fn main() { assert_eq!(false.eq(&true), false); assert_eq!(false == false, true); diff --git a/src/test/run-pass/builtin-superkinds-capabilities-transitive.rs b/src/test/run-pass/builtin-superkinds-capabilities-transitive.rs index 2abc58d8a49..83c1696f7b2 100644 --- a/src/test/run-pass/builtin-superkinds-capabilities-transitive.rs +++ b/src/test/run-pass/builtin-superkinds-capabilities-transitive.rs @@ -14,6 +14,8 @@ // a Send. Basically this just makes sure rustc is using // each_bound_trait_and_supertraits in type_contents correctly. +use std::comm::{channel, Sender}; + trait Bar : Send { } trait Foo : Bar { } diff --git a/src/test/run-pass/builtin-superkinds-capabilities-xc.rs b/src/test/run-pass/builtin-superkinds-capabilities-xc.rs index c2b874c61a7..1f002ec79c6 100644 --- a/src/test/run-pass/builtin-superkinds-capabilities-xc.rs +++ b/src/test/run-pass/builtin-superkinds-capabilities-xc.rs @@ -15,6 +15,8 @@ // even when using them cross-crate. extern crate trait_superkinds_in_metadata; + +use std::comm::{channel, Sender, Receiver}; use trait_superkinds_in_metadata::{RequiresRequiresShareAndSend, RequiresShare}; #[deriving(PartialEq)] diff --git a/src/test/run-pass/builtin-superkinds-capabilities.rs b/src/test/run-pass/builtin-superkinds-capabilities.rs index fb3e1b02728..46ad3f93b0b 100644 --- a/src/test/run-pass/builtin-superkinds-capabilities.rs +++ b/src/test/run-pass/builtin-superkinds-capabilities.rs @@ -12,6 +12,8 @@ // builtin-kinds, e.g., if a trait requires Send to implement, then // at usage site of that trait, we know we have the Send capability. +use std::comm::{channel, Sender, Receiver}; + trait Foo : Send { } impl <T: Send> Foo for T { } diff --git a/src/test/run-pass/builtin-superkinds-self-type.rs b/src/test/run-pass/builtin-superkinds-self-type.rs index 1c156f6551c..27a7cd909fe 100644 --- a/src/test/run-pass/builtin-superkinds-self-type.rs +++ b/src/test/run-pass/builtin-superkinds-self-type.rs @@ -11,6 +11,8 @@ // Tests the ability for the Self type in default methods to use // capabilities granted by builtin kinds as supertraits. +use std::comm::{Sender, channel}; + trait Foo : Send { fn foo(self, tx: Sender<Self>) { tx.send(self); diff --git a/src/test/run-pass/c-stack-returning-int64.rs b/src/test/run-pass/c-stack-returning-int64.rs index 597e067b8b6..c95cf0bfdee 100644 --- a/src/test/run-pass/c-stack-returning-int64.rs +++ b/src/test/run-pass/c-stack-returning-int64.rs @@ -12,6 +12,8 @@ extern crate libc; +use std::c_str::ToCStr; + mod mlibc { use libc::{c_char, c_long, c_longlong}; diff --git a/src/test/run-pass/capturing-logging.rs b/src/test/run-pass/capturing-logging.rs index f2df5ef38c3..4ed444f92ac 100644 --- a/src/test/run-pass/capturing-logging.rs +++ b/src/test/run-pass/capturing-logging.rs @@ -17,8 +17,10 @@ extern crate log; use log::{set_logger, Logger, LogRecord}; +use std::comm::channel; use std::fmt; use std::io::{ChanReader, ChanWriter}; +use std::thread::Thread; struct MyWriter(ChanWriter); @@ -32,7 +34,7 @@ impl Logger for MyWriter { fn main() { let (tx, rx) = channel(); let (mut r, w) = (ChanReader::new(rx), ChanWriter::new(tx)); - spawn(move|| { + let _t = Thread::spawn(move|| { set_logger(box MyWriter(w) as Box<Logger+Send>); debug!("debug"); info!("info"); diff --git a/src/test/run-pass/closure-bounds-can-capture-chan.rs b/src/test/run-pass/closure-bounds-can-capture-chan.rs index cdcdad47ea4..e1dc5802162 100644 --- a/src/test/run-pass/closure-bounds-can-capture-chan.rs +++ b/src/test/run-pass/closure-bounds-can-capture-chan.rs @@ -10,7 +10,7 @@ #![feature(unboxed_closures)] -use std::comm; +use std::comm::channel; fn foo<F:FnOnce()+Send>(blk: F) { blk(); diff --git a/src/test/run-pass/cmp-default.rs b/src/test/run-pass/cmp-default.rs index cfba87c3f69..fd040d10910 100644 --- a/src/test/run-pass/cmp-default.rs +++ b/src/test/run-pass/cmp-default.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::cmp::Ordering; + // Test default methods in PartialOrd and PartialEq // struct Fool(bool); diff --git a/src/test/run-pass/comm.rs b/src/test/run-pass/comm.rs index edd4d5642b5..119bdaff98e 100644 --- a/src/test/run-pass/comm.rs +++ b/src/test/run-pass/comm.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::task; +use std::comm::{channel, Sender}; pub fn main() { let (tx, rx) = channel(); diff --git a/src/test/run-pass/const-str-ptr.rs b/src/test/run-pass/const-str-ptr.rs index d6f0296619a..e0e8ca5618e 100644 --- a/src/test/run-pass/const-str-ptr.rs +++ b/src/test/run-pass/const-str-ptr.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::{str, string}; +use std::c_str::ToCStr; const A: [u8; 2] = ['h' as u8, 'i' as u8]; const B: &'static [u8; 2] = &A; diff --git a/src/test/run-pass/core-run-destroy.rs b/src/test/run-pass/core-run-destroy.rs index a0fa2d178b9..198915fe02e 100644 --- a/src/test/run-pass/core-run-destroy.rs +++ b/src/test/run-pass/core-run-destroy.rs @@ -23,6 +23,8 @@ extern crate libc; use std::io::{Process, Command, timer}; use std::time::Duration; use std::str; +use std::comm::channel; +use std::thread::Thread; macro_rules! succeed( ($e:expr) => ( match $e { Ok(..) => {}, Err(e) => panic!("panic: {}", e) } @@ -84,12 +86,12 @@ pub fn test_destroy_actually_kills(force: bool) { let (tx, rx1) = channel(); let mut t = timer::Timer::new().unwrap(); let rx2 = t.oneshot(Duration::milliseconds(1000)); - spawn(move|| { + Thread::spawn(move|| { select! { () = rx2.recv() => unsafe { libc::exit(1) }, () = rx1.recv() => {} } - }); + }).detach(); match p.wait().unwrap() { ExitStatus(..) => panic!("expected a signal"), ExitSignal(..) => tx.send(()), diff --git a/src/test/run-pass/deref-mut-on-ref.rs b/src/test/run-pass/deref-mut-on-ref.rs index dcf7c483b2c..5a98952c127 100644 --- a/src/test/run-pass/deref-mut-on-ref.rs +++ b/src/test/run-pass/deref-mut-on-ref.rs @@ -10,6 +10,8 @@ // Test that `&mut T` implements `DerefMut<T>` +use std::ops::DerefMut; + fn inc<T:DerefMut<int>>(mut t: T) { *t += 1; } diff --git a/src/test/run-pass/deref-on-ref.rs b/src/test/run-pass/deref-on-ref.rs index 27e7d8f3ba2..f245c11f090 100644 --- a/src/test/run-pass/deref-on-ref.rs +++ b/src/test/run-pass/deref-on-ref.rs @@ -10,6 +10,8 @@ // Test that `&T` and `&mut T` implement `Deref<T>` +use std::ops::Deref; + fn deref<U:Copy,T:Deref<U>>(t: T) -> U { *t } diff --git a/src/test/run-pass/deriving-cmp-shortcircuit.rs b/src/test/run-pass/deriving-cmp-shortcircuit.rs index b68d8058381..fb81dd558d2 100644 --- a/src/test/run-pass/deriving-cmp-shortcircuit.rs +++ b/src/test/run-pass/deriving-cmp-shortcircuit.rs @@ -12,6 +12,8 @@ // where possible, by having a type that panics when compared as the // second element, so this passes iff the instances shortcircuit. +use std::cmp::Ordering; + pub struct FailCmp; impl PartialEq for FailCmp { fn eq(&self, _: &FailCmp) -> bool { panic!("eq") } diff --git a/src/test/run-pass/deriving-zero.rs b/src/test/run-pass/deriving-zero.rs index 88f3e5775b7..b8903d05cd8 100644 --- a/src/test/run-pass/deriving-zero.rs +++ b/src/test/run-pass/deriving-zero.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - +use std::ops::Add; use std::num::Zero; #[deriving(Zero)] diff --git a/src/test/run-pass/drop-trait-enum.rs b/src/test/run-pass/drop-trait-enum.rs index 24915d84e7e..bca61ab1bd3 100644 --- a/src/test/run-pass/drop-trait-enum.rs +++ b/src/test/run-pass/drop-trait-enum.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::task; +use std::comm::{channel, Sender}; #[deriving(PartialEq, Show)] enum Message { diff --git a/src/test/run-pass/dst-deref-mut.rs b/src/test/run-pass/dst-deref-mut.rs index c2707a1ae6e..0cbcee3e253 100644 --- a/src/test/run-pass/dst-deref-mut.rs +++ b/src/test/run-pass/dst-deref-mut.rs @@ -10,6 +10,8 @@ // Test that a custom deref with a fat pointer return type does not ICE +use std::ops::{Deref, DerefMut}; + pub struct Arr { ptr: Box<[uint]> } diff --git a/src/test/run-pass/dst-deref.rs b/src/test/run-pass/dst-deref.rs index 43b7d116d30..96a9c117dea 100644 --- a/src/test/run-pass/dst-deref.rs +++ b/src/test/run-pass/dst-deref.rs @@ -10,6 +10,8 @@ // Test that a custom deref with a fat pointer return type does not ICE +use std::ops::Deref; + pub struct Arr { ptr: Box<[uint]> } diff --git a/src/test/run-pass/fixup-deref-mut.rs b/src/test/run-pass/fixup-deref-mut.rs index d2812ce1d2c..70d14ba3623 100644 --- a/src/test/run-pass/fixup-deref-mut.rs +++ b/src/test/run-pass/fixup-deref-mut.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::ops::{Deref, DerefMut}; + // Generic unique/owned smaht pointer. struct Own<T> { value: *mut T diff --git a/src/test/run-pass/foreign-fn-linkname.rs b/src/test/run-pass/foreign-fn-linkname.rs index 750c0c8ed68..8a75fdd685d 100644 --- a/src/test/run-pass/foreign-fn-linkname.rs +++ b/src/test/run-pass/foreign-fn-linkname.rs @@ -11,10 +11,10 @@ // ignore-fast doesn't like extern crate extern crate libc; +use std::c_str::ToCStr; mod mlibc { - extern crate libc; - use self::libc::{c_char, size_t}; + use libc::{c_char, size_t}; extern { #[link_name = "strlen"] diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index a92b361dd33..6155ca63572 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -9,9 +9,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -extern crate collections; - /** A somewhat reduced test case to expose some Valgrind issues. @@ -24,6 +21,7 @@ pub fn map(filename: String, emit: map_reduce::putter) { mod map_reduce { use std::collections::HashMap; + use std::comm::{channel, Sender}; use std::str; use std::task; diff --git a/src/test/run-pass/issue-13264.rs b/src/test/run-pass/issue-13264.rs index 06ab67f2f3e..33377d1f217 100644 --- a/src/test/run-pass/issue-13264.rs +++ b/src/test/run-pass/issue-13264.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::ops::Deref; + struct Root { jsref: JSRef } diff --git a/src/test/run-pass/issue-13494.rs b/src/test/run-pass/issue-13494.rs index be851ddefc6..e6da859c110 100644 --- a/src/test/run-pass/issue-13494.rs +++ b/src/test/run-pass/issue-13494.rs @@ -11,6 +11,9 @@ // This test may not always fail, but it can be flaky if the race it used to // expose is still present. +use std::comm::{channel, Sender, Receiver}; +use std::thread::Thread; + fn helper(rx: Receiver<Sender<()>>) { for tx in rx.iter() { let _ = tx.send_opt(()); @@ -19,7 +22,7 @@ fn helper(rx: Receiver<Sender<()>>) { fn main() { let (tx, rx) = channel(); - spawn(move|| { helper(rx) }); + let _t = Thread::spawn(move|| { helper(rx) }).detach(); let (snd, rcv) = channel::<int>(); for _ in range(1i, 100000i) { snd.send(1i); diff --git a/src/test/run-pass/issue-15734.rs b/src/test/run-pass/issue-15734.rs index ea5bd550d53..8aa7447ccd2 100644 --- a/src/test/run-pass/issue-15734.rs +++ b/src/test/run-pass/issue-15734.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::ops::Index; + struct Mat<T> { data: Vec<T>, cols: uint, } impl<T> Mat<T> { diff --git a/src/test/run-pass/issue-16560.rs b/src/test/run-pass/issue-16560.rs index f329e7eed0d..b2b819a1103 100644 --- a/src/test/run-pass/issue-16560.rs +++ b/src/test/run-pass/issue-16560.rs @@ -10,6 +10,7 @@ #![feature(unboxed_closures)] +use std::thread::Thread; use std::mem; fn main() { @@ -19,7 +20,7 @@ fn main() { // Check that both closures are capturing by value assert_eq!(1, mem::size_of_val(&closure)); - spawn(move|| { + Thread::spawn(move|| { let ok = closure; - }) + }).join().ok().unwrap(); } diff --git a/src/test/run-pass/issue-16774.rs b/src/test/run-pass/issue-16774.rs index ebc879d82fb..0b9a85851c5 100644 --- a/src/test/run-pass/issue-16774.rs +++ b/src/test/run-pass/issue-16774.rs @@ -10,6 +10,8 @@ #![feature(unboxed_closures)] +use std::ops::{Deref, DerefMut}; + struct X(Box<int>); static mut DESTRUCTOR_RAN: bool = false; diff --git a/src/test/run-pass/issue-3609.rs b/src/test/run-pass/issue-3609.rs index f17f9411d15..df2a9e6bfa9 100644 --- a/src/test/run-pass/issue-3609.rs +++ b/src/test/run-pass/issue-3609.rs @@ -11,6 +11,7 @@ #![feature(default_type_params)] use std::task; +use std::comm::Sender; use std::thunk::Invoke; type RingBuffer = Vec<f64> ; diff --git a/src/test/run-pass/issue-3743.rs b/src/test/run-pass/issue-3743.rs index 80d3d29bc00..c88022f3eb7 100644 --- a/src/test/run-pass/issue-3743.rs +++ b/src/test/run-pass/issue-3743.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::ops::Mul; + struct Vec2 { x: f64, y: f64 diff --git a/src/test/run-pass/issue-3979-generics.rs b/src/test/run-pass/issue-3979-generics.rs index 86cdd6135ec..93c72e2e350 100644 --- a/src/test/run-pass/issue-3979-generics.rs +++ b/src/test/run-pass/issue-3979-generics.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::ops::Add; + trait Positioned<S> { fn SetX(&mut self, S); fn X(&self) -> S; diff --git a/src/test/run-pass/issue-4446.rs b/src/test/run-pass/issue-4446.rs index daa80aec28c..871e52e3639 100644 --- a/src/test/run-pass/issue-4446.rs +++ b/src/test/run-pass/issue-4446.rs @@ -9,13 +9,15 @@ // except according to those terms. use std::io::println; +use std::comm::channel; +use std::thread::Thread; pub fn main() { let (tx, rx) = channel(); tx.send("hello, world"); - spawn(move|| { + Thread::spawn(move|| { println(rx.recv()); - }); + }).join().ok().unwrap(); } diff --git a/src/test/run-pass/issue-4448.rs b/src/test/run-pass/issue-4448.rs index 3ea968c416f..6692988f6da 100644 --- a/src/test/run-pass/issue-4448.rs +++ b/src/test/run-pass/issue-4448.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::task; +use std::comm::channel; pub fn main() { let (tx, rx) = channel::<&'static str>(); diff --git a/src/test/run-pass/issue-7784.rs b/src/test/run-pass/issue-7784.rs index b936eb322fc..43785edc2eb 100644 --- a/src/test/run-pass/issue-7784.rs +++ b/src/test/run-pass/issue-7784.rs @@ -10,6 +10,8 @@ #![feature(advanced_slice_patterns)] +use std::ops::Add; + fn foo<T: Add<T, T> + Clone>([x, y, z]: [T; 3]) -> (T, T, T) { (x.clone(), x.clone() + y.clone(), x + y + z) } diff --git a/src/test/run-pass/issue-8827.rs b/src/test/run-pass/issue-8827.rs index 7397ad74495..4163ebf4573 100644 --- a/src/test/run-pass/issue-8827.rs +++ b/src/test/run-pass/issue-8827.rs @@ -8,9 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::thread::Thread; +use std::comm::{channel, Receiver}; + fn periodical(n: int) -> Receiver<bool> { let (chan, port) = channel(); - spawn(move|| { + Thread::spawn(move|| { loop { for _ in range(1, n) { match chan.send_opt(false) { @@ -23,13 +26,13 @@ fn periodical(n: int) -> Receiver<bool> { Err(..) => break } } - }); + }).detach(); return port; } fn integers() -> Receiver<int> { let (chan, port) = channel(); - spawn(move|| { + Thread::spawn(move|| { let mut i = 1; loop { match chan.send_opt(i) { @@ -38,7 +41,7 @@ fn integers() -> Receiver<int> { } i = i + 1; } - }); + }).detach(); return port; } diff --git a/src/test/run-pass/issue-9396.rs b/src/test/run-pass/issue-9396.rs index 588e0c1cf16..d3cbd556776 100644 --- a/src/test/run-pass/issue-9396.rs +++ b/src/test/run-pass/issue-9396.rs @@ -8,13 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::comm; +use std::comm::{mod, channel}; use std::io::timer::Timer; +use std::thread::Thread; use std::time::Duration; pub fn main() { let (tx, rx) = channel(); - spawn(move||{ + let _t = Thread::spawn(move||{ let mut timer = Timer::new().unwrap(); timer.sleep(Duration::milliseconds(10)); tx.send(()); diff --git a/src/test/run-pass/ivec-tag.rs b/src/test/run-pass/ivec-tag.rs index 1f7edcf43b8..2e6127541a1 100644 --- a/src/test/run-pass/ivec-tag.rs +++ b/src/test/run-pass/ivec-tag.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::task; +use std::comm::{channel, Sender}; fn producer(tx: &Sender<Vec<u8>>) { tx.send( diff --git a/src/test/run-pass/logging-only-prints-once.rs b/src/test/run-pass/logging-only-prints-once.rs index 1e05c05cc0d..509afff3d13 100644 --- a/src/test/run-pass/logging-only-prints-once.rs +++ b/src/test/run-pass/logging-only-prints-once.rs @@ -13,6 +13,7 @@ use std::cell::Cell; use std::fmt; +use std::thread::Thread; struct Foo(Cell<int>); @@ -26,13 +27,10 @@ impl fmt::Show for Foo { } pub fn main() { - let (tx, rx) = channel(); - spawn(move|| { + Thread::spawn(move|| { let mut f = Foo(Cell::new(0)); println!("{}", f); let Foo(ref mut f) = f; assert!(f.get() == 1); - tx.send(()); - }); - rx.recv(); + }).join().ok().unwrap(); } diff --git a/src/test/run-pass/macro-with-braces-in-expr-position.rs b/src/test/run-pass/macro-with-braces-in-expr-position.rs index 024dc4c03e1..a6e579ddff3 100644 --- a/src/test/run-pass/macro-with-braces-in-expr-position.rs +++ b/src/test/run-pass/macro-with-braces-in-expr-position.rs @@ -10,11 +10,13 @@ #![feature(macro_rules)] +use std::thread::Thread; + macro_rules! expr (($e: expr) => { $e }); macro_rules! spawn { ($($code: tt)*) => { - expr!(spawn(move|| {$($code)*})) + expr!(Thread::spawn(move|| {$($code)*}).detach()) } } diff --git a/src/test/run-pass/match-with-ret-arm.rs b/src/test/run-pass/match-with-ret-arm.rs index 2109f7ef1ea..2cba1dec2dc 100644 --- a/src/test/run-pass/match-with-ret-arm.rs +++ b/src/test/run-pass/match-with-ret-arm.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::uint; +use std::str::from_str; pub fn main() { // sometimes we have had trouble finding diff --git a/src/test/run-pass/numeric-method-autoexport.rs b/src/test/run-pass/numeric-method-autoexport.rs index f8184d248ff..b4d079d79d6 100644 --- a/src/test/run-pass/numeric-method-autoexport.rs +++ b/src/test/run-pass/numeric-method-autoexport.rs @@ -15,6 +15,9 @@ // necessary. Testing the methods of the impls is done within the source // file for each numeric type. +use std::ops::Add; +use std::num::ToPrimitive; + pub fn main() { // ints // num diff --git a/src/test/run-pass/out-of-stack-new-thread-no-split.rs b/src/test/run-pass/out-of-stack-new-thread-no-split.rs index 674d0dc86da..7aac2d705a8 100644 --- a/src/test/run-pass/out-of-stack-new-thread-no-split.rs +++ b/src/test/run-pass/out-of-stack-new-thread-no-split.rs @@ -17,6 +17,7 @@ use std::io::process::Command; use std::os; +use std::thread::Thread; // lifted from the test module // Inlining to avoid llvm turning the recursive functions into tail calls, @@ -36,12 +37,7 @@ fn main() { let args = os::args(); let args = args.as_slice(); if args.len() > 1 && args[1].as_slice() == "recurse" { - let (tx, rx) = channel(); - spawn(move|| { - recurse(); - tx.send(()); - }); - rx.recv(); + let _t = Thread::spawn(recurse); } else { let recurse = Command::new(args[0].as_slice()).arg("recurse").output().unwrap(); assert!(!recurse.status.success()); diff --git a/src/test/run-pass/overloaded-autoderef-indexing.rs b/src/test/run-pass/overloaded-autoderef-indexing.rs index 5c4befcd0c8..d1fb69b87a3 100644 --- a/src/test/run-pass/overloaded-autoderef-indexing.rs +++ b/src/test/run-pass/overloaded-autoderef-indexing.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::ops::Deref; + struct DerefArray<'a, T:'a> { inner: &'a [T] } diff --git a/src/test/run-pass/overloaded-autoderef-order.rs b/src/test/run-pass/overloaded-autoderef-order.rs index f0daf371ca7..23a8285063f 100644 --- a/src/test/run-pass/overloaded-autoderef-order.rs +++ b/src/test/run-pass/overloaded-autoderef-order.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::rc::Rc; +use std::ops::Deref; struct DerefWrapper<X, Y> { x: X, @@ -30,6 +31,8 @@ impl<X, Y> Deref<Y> for DerefWrapper<X, Y> { } mod priv_test { + use std::ops::Deref; + pub struct DerefWrapperHideX<X, Y> { x: X, pub y: Y diff --git a/src/test/run-pass/overloaded-autoderef.rs b/src/test/run-pass/overloaded-autoderef.rs index 2975b209d06..222e2825c04 100644 --- a/src/test/run-pass/overloaded-autoderef.rs +++ b/src/test/run-pass/overloaded-autoderef.rs @@ -10,7 +10,7 @@ use std::cell::RefCell; use std::rc::Rc; -use std::string::String; +use std::num::ToPrimitive; #[deriving(PartialEq, Show)] struct Point { @@ -31,7 +31,6 @@ pub fn main() { assert_eq!((i_value, *i.borrow()), (2, 5)); let s = Rc::new("foo".to_string()); - assert!(s.equiv(&("foo"))); assert_eq!(s.as_slice(), "foo"); let mut_s = Rc::new(RefCell::new(String::from_str("foo"))); diff --git a/src/test/run-pass/overloaded-calls-param-vtables.rs b/src/test/run-pass/overloaded-calls-param-vtables.rs index 2e8ec3916bd..95df1ed0d83 100644 --- a/src/test/run-pass/overloaded-calls-param-vtables.rs +++ b/src/test/run-pass/overloaded-calls-param-vtables.rs @@ -13,6 +13,7 @@ #![feature(unboxed_closures)] use std::ops::Fn; +use std::ops::Add; struct G; diff --git a/src/test/run-pass/overloaded-index-autoderef.rs b/src/test/run-pass/overloaded-index-autoderef.rs index d51956da894..dcb0c40c608 100644 --- a/src/test/run-pass/overloaded-index-autoderef.rs +++ b/src/test/run-pass/overloaded-index-autoderef.rs @@ -10,6 +10,8 @@ // Test overloaded indexing combined with autoderef. +use std::ops::{Index, IndexMut}; + struct Foo { x: int, y: int, diff --git a/src/test/run-pass/overloaded-index-in-field.rs b/src/test/run-pass/overloaded-index-in-field.rs index e8b0408ca0d..1c06ed64fc7 100644 --- a/src/test/run-pass/overloaded-index-in-field.rs +++ b/src/test/run-pass/overloaded-index-in-field.rs @@ -11,6 +11,8 @@ // Test using overloaded indexing when the "map" is stored in a // field. This caused problems at some point. +use std::ops::Index; + struct Foo { x: int, y: int, diff --git a/src/test/run-pass/overloaded-index.rs b/src/test/run-pass/overloaded-index.rs index 23bebfa35d7..fdf7e7e2cbb 100644 --- a/src/test/run-pass/overloaded-index.rs +++ b/src/test/run-pass/overloaded-index.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::ops::{Index, IndexMut}; + struct Foo { x: int, y: int, diff --git a/src/test/run-pass/rename-directory.rs b/src/test/run-pass/rename-directory.rs index b5cee20232b..c7aa405b513 100644 --- a/src/test/run-pass/rename-directory.rs +++ b/src/test/run-pass/rename-directory.rs @@ -14,6 +14,7 @@ extern crate libc; use std::io::TempDir; +use std::c_str::ToCStr; use std::io::fs::PathExtensions; use std::io::fs; use std::io; diff --git a/src/test/run-pass/running-with-no-runtime.rs b/src/test/run-pass/running-with-no-runtime.rs index 4cf8c52f2bb..0aeade935da 100644 --- a/src/test/run-pass/running-with-no-runtime.rs +++ b/src/test/run-pass/running-with-no-runtime.rs @@ -10,12 +10,12 @@ use std::io::process::{Command, ProcessOutput}; use std::os; -use std::str; +use std::rt::unwind::try; use std::rt; +use std::str; +use std::thread::Thread; use std::thunk::Thunk; -use std::rt::unwind::try; - #[start] fn start(argc: int, argv: *const *const u8) -> int { if argc > 1 { @@ -25,8 +25,7 @@ fn start(argc: int, argv: *const *const u8) -> int { 2 => println!("foo"), 3 => assert!(try(|| {}).is_ok()), 4 => assert!(try(|| panic!()).is_err()), - 5 => assert!(try(|| spawn(move|| {})).is_err()), - 6 => assert!(Command::new("test").spawn().is_err()), + 5 => assert!(Command::new("test").spawn().is_err()), _ => panic!() } } @@ -50,8 +49,6 @@ fn start(argc: int, argv: *const *const u8) -> int { pass(Command::new(me).arg(x).output().unwrap()); let x: &[u8] = &[5u8]; pass(Command::new(me).arg(x).output().unwrap()); - let x: &[u8] = &[6u8]; - pass(Command::new(me).arg(x).output().unwrap()); 0 } diff --git a/src/test/run-pass/rust-log-filter.rs b/src/test/run-pass/rust-log-filter.rs index 88d30318f2a..8e547527f72 100644 --- a/src/test/run-pass/rust-log-filter.rs +++ b/src/test/run-pass/rust-log-filter.rs @@ -14,6 +14,9 @@ #[phase(plugin,link)] extern crate log; +use std::comm::{channel, Sender, Receiver}; +use std::thread::Thread; + pub struct ChannelLogger { tx: Sender<String> } @@ -34,7 +37,7 @@ impl log::Logger for ChannelLogger { pub fn main() { let (logger, rx) = ChannelLogger::new(); - spawn(move|| { + let _t = Thread::spawn(move|| { log::set_logger(logger); // our regex is "f.o" diff --git a/src/test/run-pass/send-resource.rs b/src/test/run-pass/send-resource.rs index 6001c360ab9..71620d05e01 100644 --- a/src/test/run-pass/send-resource.rs +++ b/src/test/run-pass/send-resource.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::task; +use std::comm::channel; struct test { f: int, diff --git a/src/test/run-pass/send-type-inference.rs b/src/test/run-pass/send-type-inference.rs index 508bd99d77d..181874705da 100644 --- a/src/test/run-pass/send-type-inference.rs +++ b/src/test/run-pass/send-type-inference.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::comm::{channel, Sender}; + // tests that ctrl's type gets inferred properly struct Command<K, V> { key: K, diff --git a/src/test/run-pass/send_str_hashmap.rs b/src/test/run-pass/send_str_hashmap.rs index 1b0f2ec0a32..bfeff58b802 100644 --- a/src/test/run-pass/send_str_hashmap.rs +++ b/src/test/run-pass/send_str_hashmap.rs @@ -11,8 +11,8 @@ extern crate collections; use std::collections::HashMap; -use std::option::Option::Some; use std::str::SendStr; +use std::borrow::IntoCow; pub fn main() { let mut map: HashMap<SendStr, uint> = HashMap::new(); diff --git a/src/test/run-pass/send_str_treemap.rs b/src/test/run-pass/send_str_treemap.rs index 24480d85272..8c70738de48 100644 --- a/src/test/run-pass/send_str_treemap.rs +++ b/src/test/run-pass/send_str_treemap.rs @@ -11,9 +11,8 @@ extern crate collections; use self::collections::BTreeMap; -use std::option::Option::Some; use std::str::SendStr; -use std::string::ToString; +use std::borrow::IntoCow; pub fn main() { let mut map: BTreeMap<SendStr, uint> = BTreeMap::new(); diff --git a/src/test/run-pass/sendable-class.rs b/src/test/run-pass/sendable-class.rs index 007a83d2c88..3d5f0af0e3f 100644 --- a/src/test/run-pass/sendable-class.rs +++ b/src/test/run-pass/sendable-class.rs @@ -10,6 +10,8 @@ // Test that a class with only sendable fields can be sent +use std::comm::channel; + struct foo { i: int, j: char, diff --git a/src/test/run-pass/spawn-types.rs b/src/test/run-pass/spawn-types.rs index 9b533c69f32..e3b2a2903bc 100644 --- a/src/test/run-pass/spawn-types.rs +++ b/src/test/run-pass/spawn-types.rs @@ -15,6 +15,7 @@ */ use std::task; +use std::comm::{channel, Sender}; type ctx = Sender<int>; diff --git a/src/test/run-pass/supertrait-default-generics.rs b/src/test/run-pass/supertrait-default-generics.rs index 873941395fe..4465561f874 100644 --- a/src/test/run-pass/supertrait-default-generics.rs +++ b/src/test/run-pass/supertrait-default-generics.rs @@ -10,6 +10,8 @@ // There is some other borrowck bug, so we make the stuff not mut. +use std::ops::Add; + trait Positioned<S> { fn SetX(&mut self, S); fn X(&self) -> S; diff --git a/src/test/run-pass/task-comm-0.rs b/src/test/run-pass/task-comm-0.rs index 9e3511ba603..7c664b21fad 100644 --- a/src/test/run-pass/task-comm-0.rs +++ b/src/test/run-pass/task-comm-0.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - use std::task; +use std::comm::{channel, Sender}; pub fn main() { test05(); } diff --git a/src/test/run-pass/task-comm-10.rs b/src/test/run-pass/task-comm-10.rs index dd3c90991f6..c35e2f2f37a 100644 --- a/src/test/run-pass/task-comm-10.rs +++ b/src/test/run-pass/task-comm-10.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - use std::task; +use std::comm::{channel, Sender}; fn start(tx: &Sender<Sender<String>>) { let (tx2, rx) = channel(); diff --git a/src/test/run-pass/task-comm-11.rs b/src/test/run-pass/task-comm-11.rs index aefc91df4e7..10b4e516311 100644 --- a/src/test/run-pass/task-comm-11.rs +++ b/src/test/run-pass/task-comm-11.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - +use std::comm::{channel, Sender}; use std::task; fn start(tx: &Sender<Sender<int>>) { diff --git a/src/test/run-pass/task-comm-13.rs b/src/test/run-pass/task-comm-13.rs index c6c0691b749..31da1168bf7 100644 --- a/src/test/run-pass/task-comm-13.rs +++ b/src/test/run-pass/task-comm-13.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - +use std::comm::{channel, Sender}; use std::task; fn start(tx: &Sender<int>, start: int, number_of_messages: int) { diff --git a/src/test/run-pass/task-comm-14.rs b/src/test/run-pass/task-comm-14.rs index 0e483813665..8ec589d5db5 100644 --- a/src/test/run-pass/task-comm-14.rs +++ b/src/test/run-pass/task-comm-14.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - +use std::comm::{channel, Sender}; use std::task; pub fn main() { diff --git a/src/test/run-pass/task-comm-15.rs b/src/test/run-pass/task-comm-15.rs index 3095c2098ff..b69644244ab 100644 --- a/src/test/run-pass/task-comm-15.rs +++ b/src/test/run-pass/task-comm-15.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - +use std::comm::{channel, Sender}; use std::task; fn start(tx: &Sender<int>, i0: int) { diff --git a/src/test/run-pass/task-comm-16.rs b/src/test/run-pass/task-comm-16.rs index 91433852540..5e71ed3ba06 100644 --- a/src/test/run-pass/task-comm-16.rs +++ b/src/test/run-pass/task-comm-16.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::comm::channel; use std::cmp; // Tests of ports and channels on various types diff --git a/src/test/run-pass/task-comm-3.rs b/src/test/run-pass/task-comm-3.rs index 73f6eb563c1..c7a6da6a794 100644 --- a/src/test/run-pass/task-comm-3.rs +++ b/src/test/run-pass/task-comm-3.rs @@ -11,6 +11,7 @@ // no-pretty-expanded FIXME #15189 use std::thread::Thread; +use std::comm::{channel, Sender}; pub fn main() { println!("===== WITHOUT THREADS ====="); test00(); } diff --git a/src/test/run-pass/task-comm-4.rs b/src/test/run-pass/task-comm-4.rs index 2e2b1fbff0f..0e75479046b 100644 --- a/src/test/run-pass/task-comm-4.rs +++ b/src/test/run-pass/task-comm-4.rs @@ -10,6 +10,8 @@ #![allow(dead_assignment)] +use std::comm::channel; + pub fn main() { test00(); } fn test00() { diff --git a/src/test/run-pass/task-comm-5.rs b/src/test/run-pass/task-comm-5.rs index e51e14f7fbe..d4edbf85cd8 100644 --- a/src/test/run-pass/task-comm-5.rs +++ b/src/test/run-pass/task-comm-5.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::comm::channel; + pub fn main() { test00(); } fn test00() { diff --git a/src/test/run-pass/task-comm-6.rs b/src/test/run-pass/task-comm-6.rs index e783cd9b6be..4c18e5dc313 100644 --- a/src/test/run-pass/task-comm-6.rs +++ b/src/test/run-pass/task-comm-6.rs @@ -10,6 +10,8 @@ #![allow(dead_assignment)] +use std::comm::channel; + pub fn main() { test00(); } fn test00() { diff --git a/src/test/run-pass/task-comm-7.rs b/src/test/run-pass/task-comm-7.rs index 9d8caa42626..e7e5c04e195 100644 --- a/src/test/run-pass/task-comm-7.rs +++ b/src/test/run-pass/task-comm-7.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - #![allow(dead_assignment)] +use std::comm::{channel, Sender}; use std::task; pub fn main() { test00(); } diff --git a/src/test/run-pass/task-comm-9.rs b/src/test/run-pass/task-comm-9.rs index 69d70050437..5a271f9dc05 100644 --- a/src/test/run-pass/task-comm-9.rs +++ b/src/test/run-pass/task-comm-9.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::thread::Thread; +use std::comm::{channel, Sender}; pub fn main() { test00(); } diff --git a/src/test/run-pass/task-comm-chan-nil.rs b/src/test/run-pass/task-comm-chan-nil.rs index 3ea17898ead..368cac1d27d 100644 --- a/src/test/run-pass/task-comm-chan-nil.rs +++ b/src/test/run-pass/task-comm-chan-nil.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::comm::channel; + // rustboot can't transmit nils across channels because they don't have // any size, but rustc currently can because they do have size. Whether // or not this is desirable I don't know, but here's a regression test. diff --git a/src/test/run-pass/task-spawn-move-and-copy.rs b/src/test/run-pass/task-spawn-move-and-copy.rs index 8d6b6005a63..1e10a4186fb 100644 --- a/src/test/run-pass/task-spawn-move-and-copy.rs +++ b/src/test/run-pass/task-spawn-move-and-copy.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::task; +use std::comm::channel; pub fn main() { let (tx, rx) = channel::<uint>(); diff --git a/src/test/run-pass/task-stderr.rs b/src/test/run-pass/task-stderr.rs index ddeffcdf722..048d7b2be72 100644 --- a/src/test/run-pass/task-stderr.rs +++ b/src/test/run-pass/task-stderr.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::comm::channel; use std::io::{ChanReader, ChanWriter}; use std::thread; diff --git a/src/test/run-pass/tcp-accept-stress.rs b/src/test/run-pass/tcp-accept-stress.rs index 780cf234466..8f5a45cd1dd 100644 --- a/src/test/run-pass/tcp-accept-stress.rs +++ b/src/test/run-pass/tcp-accept-stress.rs @@ -13,8 +13,10 @@ // quite quickly and it takes a few seconds for the sockets to get // recycled. +use std::comm::channel; use std::io::{TcpListener, Listener, Acceptor, EndOfFile, TcpStream}; use std::sync::{atomic, Arc}; +use std::thread::Thread; static N: uint = 8; static M: uint = 20; @@ -35,7 +37,7 @@ fn test() { let a = a.clone(); let cnt = cnt.clone(); let srv_tx = srv_tx.clone(); - spawn(move|| { + Thread::spawn(move|| { let mut a = a; loop { match a.accept() { @@ -49,17 +51,17 @@ fn test() { } } srv_tx.send(()); - }); + }).detach(); } for _ in range(0, N) { let cli_tx = cli_tx.clone(); - spawn(move|| { + Thread::spawn(move|| { for _ in range(0, M) { let _s = TcpStream::connect(addr).unwrap(); } cli_tx.send(()); - }); + }).detach(); } drop((cli_tx, srv_tx)); diff --git a/src/test/run-pass/tcp-connect-timeouts.rs b/src/test/run-pass/tcp-connect-timeouts.rs index 2d087406fd6..ea0141a0496 100644 --- a/src/test/run-pass/tcp-connect-timeouts.rs +++ b/src/test/run-pass/tcp-connect-timeouts.rs @@ -26,6 +26,7 @@ use std::io::*; use std::io::test::*; use std::io; use std::time::Duration; +use std::comm::channel; #[cfg_attr(target_os = "freebsd", ignore)] fn eventual_timeout() { diff --git a/src/test/run-pass/tempfile.rs b/src/test/run-pass/tempfile.rs index a866f497b86..4fcdf49d971 100644 --- a/src/test/run-pass/tempfile.rs +++ b/src/test/run-pass/tempfile.rs @@ -23,6 +23,7 @@ use std::io::{fs, TempDir}; use std::io; use std::os; use std::task; +use std::comm::channel; fn test_tempdir() { let path = { diff --git a/src/test/run-pass/trait-bounds-in-arc.rs b/src/test/run-pass/trait-bounds-in-arc.rs index d2c1461d65d..dd16514d83a 100644 --- a/src/test/run-pass/trait-bounds-in-arc.rs +++ b/src/test/run-pass/trait-bounds-in-arc.rs @@ -11,8 +11,8 @@ // Tests that a heterogeneous list of existential types can be put inside an Arc // and shared between tasks as long as all types fulfill Send. - use std::sync::Arc; +use std::comm::channel; use std::task; trait Pet { diff --git a/src/test/run-pass/trait-inheritance-overloading.rs b/src/test/run-pass/trait-inheritance-overloading.rs index 5f8e945cce8..1cd6e3ecebe 100644 --- a/src/test/run-pass/trait-inheritance-overloading.rs +++ b/src/test/run-pass/trait-inheritance-overloading.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::cmp::PartialEq; +use std::ops::{Add, Sub, Mul}; trait MyNum : Add<Self,Self> + Sub<Self,Self> + Mul<Self,Self> + PartialEq + Clone { } diff --git a/src/test/run-pass/trivial-message.rs b/src/test/run-pass/trivial-message.rs index 464ab135228..1ff3ba3106b 100644 --- a/src/test/run-pass/trivial-message.rs +++ b/src/test/run-pass/trivial-message.rs @@ -13,6 +13,8 @@ message. */ +use std::comm::channel; + pub fn main() { let (tx, rx) = channel(); tx.send(42i); diff --git a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs b/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs index 465c324122a..fdd85b71cd2 100644 --- a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs +++ b/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs @@ -13,6 +13,8 @@ #![feature(unboxed_closures)] +use std::num::ToPrimitive; + fn doit<T,F>(val: T, f: &F) where F : Fn(T) { diff --git a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs b/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs index 440292d202e..cce8cd64a14 100644 --- a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs +++ b/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs @@ -13,6 +13,8 @@ #![feature(unboxed_closures)] +use std::num::ToPrimitive; + fn doit<T>(val: T, f: &Fn(T)) { f.call((val,)) } pub fn main() { diff --git a/src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs b/src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs index b279eb5fbba..8497bf7f987 100644 --- a/src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs +++ b/src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs @@ -13,6 +13,8 @@ #![feature(unboxed_closures)] +use std::num::ToPrimitive; + fn doit<T,F>(val: T, f: &F) where F : Fn(&T) { diff --git a/src/test/run-pass/unique-send-2.rs b/src/test/run-pass/unique-send-2.rs index 672cd2d00e8..e66c8730898 100644 --- a/src/test/run-pass/unique-send-2.rs +++ b/src/test/run-pass/unique-send-2.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::task; +use std::comm::{channel, Sender}; fn child(tx: &Sender<Box<uint>>, i: uint) { tx.send(box i); diff --git a/src/test/run-pass/unique-send.rs b/src/test/run-pass/unique-send.rs index 22b5a8cdaa4..0a661a51bf1 100644 --- a/src/test/run-pass/unique-send.rs +++ b/src/test/run-pass/unique-send.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::comm::channel; + pub fn main() { let (tx, rx) = channel(); tx.send(box 100i); diff --git a/src/test/run-pass/unwind-resource.rs b/src/test/run-pass/unwind-resource.rs index 9789deef636..1284c938d55 100644 --- a/src/test/run-pass/unwind-resource.rs +++ b/src/test/run-pass/unwind-resource.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - +use std::comm::{channel, Sender}; use std::task; struct complainer { diff --git a/src/test/run-pass/variadic-ffi.rs b/src/test/run-pass/variadic-ffi.rs index f8eef988561..ec320c1f8a3 100644 --- a/src/test/run-pass/variadic-ffi.rs +++ b/src/test/run-pass/variadic-ffi.rs @@ -9,7 +9,8 @@ // except according to those terms. extern crate libc; -use std::c_str::CString; + +use std::c_str::{CString, ToCStr}; use libc::{c_char, c_int}; // ignore-fast doesn't like extern crate diff --git a/src/test/run-pass/wait-forked-but-failed-child.rs b/src/test/run-pass/wait-forked-but-failed-child.rs index 577e114945c..624b4176704 100644 --- a/src/test/run-pass/wait-forked-but-failed-child.rs +++ b/src/test/run-pass/wait-forked-but-failed-child.rs @@ -12,10 +12,10 @@ extern crate libc; use std::io::process::Command; use std::iter::IteratorExt; +use std::str::from_str; use libc::funcs::posix88::unistd; - // The output from "ps -A -o pid,ppid,args" should look like this: // PID PPID COMMAND // 1 0 /sbin/init |
