]> git.lizzy.rs Git - rust.git/commitdiff
std: Stabilize the prelude module
authorAlex Crichton <alex@alexcrichton.com>
Mon, 22 Dec 2014 17:04:23 +0000 (09:04 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 2 Jan 2015 16:54:06 +0000 (08:54 -0800)
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

314 files changed:
src/compiletest/compiletest.rs
src/doc/guide-ffi.md
src/doc/guide.md
src/doc/reference.md
src/libcollections/binary_heap.rs
src/libcollections/bit.rs
src/libcollections/btree/map.rs
src/libcollections/btree/node.rs
src/libcollections/btree/set.rs
src/libcollections/dlist.rs
src/libcollections/enum_set.rs
src/libcollections/ring_buf.rs
src/libcollections/slice.rs
src/libcollections/string.rs
src/libcollections/vec.rs
src/libcollections/vec_map.rs
src/libcore/cmp.rs
src/libcore/ops.rs
src/libcore/prelude.rs
src/libcore/tuple.rs
src/libcoretest/cmp.rs
src/libcoretest/num/int_macros.rs
src/libcoretest/num/mod.rs
src/libcoretest/num/uint_macros.rs
src/libcoretest/str.rs
src/libcoretest/tuple.rs
src/libgraphviz/lib.rs
src/libgraphviz/maybe_owned_vec.rs
src/librand/chacha.rs
src/librand/distributions/exponential.rs
src/librand/distributions/gamma.rs
src/librand/distributions/mod.rs
src/librand/distributions/normal.rs
src/librand/distributions/range.rs
src/librand/isaac.rs
src/librand/rand_impls.rs
src/librand/reseeding.rs
src/libregex/re.rs
src/libregex/vm.rs
src/librustc/lint/builtin.rs
src/librustc/metadata/decoder.rs
src/librustc/metadata/tydecode.rs
src/librustc/middle/cfg/graphviz.rs
src/librustc/middle/check_match.rs
src/librustc/middle/const_eval.rs
src/librustc/middle/infer/region_inference/mod.rs
src/librustc/middle/lang_items.rs
src/librustc/middle/ty.rs
src/librustc/session/config.rs
src/librustc_borrowck/borrowck/gather_loans/move_error.rs
src/librustc_borrowck/graphviz.rs
src/librustc_driver/lib.rs
src/librustc_llvm/archive_ro.rs
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/check_unused.rs
src/librustc_resolve/record_exports.rs
src/librustc_trans/back/lto.rs
src/librustc_trans/back/write.rs
src/librustc_trans/save/mod.rs
src/librustc_trans/trans/builder.rs
src/librustc_trans/trans/foreign.rs
src/librustdoc/flock.rs
src/librustdoc/html/markdown.rs
src/librustdoc/html/render.rs
src/librustdoc/stability_summary.rs
src/librustdoc/test.rs
src/libstd/ascii.rs
src/libstd/bitflags.rs
src/libstd/c_str.rs
src/libstd/c_vec.rs
src/libstd/collections/hash/bench.rs
src/libstd/collections/hash/map.rs
src/libstd/collections/hash/set.rs
src/libstd/comm/mod.rs
src/libstd/comm/mpsc_queue.rs
src/libstd/comm/select.rs
src/libstd/comm/spsc_queue.rs
src/libstd/dynamic_lib.rs
src/libstd/error.rs
src/libstd/failure.rs
src/libstd/io/buffered.rs
src/libstd/io/comm_adapters.rs
src/libstd/io/extensions.rs
src/libstd/io/fs.rs
src/libstd/io/mem.rs
src/libstd/io/mod.rs
src/libstd/io/net/addrinfo.rs
src/libstd/io/net/ip.rs
src/libstd/io/net/pipe.rs
src/libstd/io/net/tcp.rs
src/libstd/io/net/udp.rs
src/libstd/io/pipe.rs
src/libstd/io/process.rs
src/libstd/io/result.rs
src/libstd/io/stdio.rs
src/libstd/io/test.rs
src/libstd/io/timer.rs
src/libstd/io/util.rs
src/libstd/lib.rs
src/libstd/macros.rs
src/libstd/num/f32.rs
src/libstd/num/f64.rs
src/libstd/num/mod.rs
src/libstd/num/uint_macros.rs
src/libstd/os.rs
src/libstd/path/mod.rs
src/libstd/path/posix.rs
src/libstd/path/windows.rs
src/libstd/prelude.rs [deleted file]
src/libstd/prelude/mod.rs [new file with mode: 0644]
src/libstd/prelude/v1.rs [new file with mode: 0644]
src/libstd/rand/mod.rs
src/libstd/rand/os.rs
src/libstd/rand/reader.rs
src/libstd/rt/args.rs
src/libstd/rt/backtrace.rs
src/libstd/rt/exclusive.rs
src/libstd/rt/mod.rs
src/libstd/rt/task.rs
src/libstd/rt/unwind.rs
src/libstd/rt/util.rs
src/libstd/sync/atomic.rs
src/libstd/sync/barrier.rs
src/libstd/sync/condvar.rs
src/libstd/sync/future.rs
src/libstd/sync/mutex.rs
src/libstd/sync/once.rs
src/libstd/sync/poison.rs
src/libstd/sync/rwlock.rs
src/libstd/sync/semaphore.rs
src/libstd/sync/task_pool.rs
src/libstd/sys/common/backtrace.rs
src/libstd/sys/common/helper_thread.rs
src/libstd/sys/common/mod.rs
src/libstd/sys/common/net.rs
src/libstd/sys/common/thread_local.rs
src/libstd/sys/unix/fs.rs
src/libstd/sys/unix/mod.rs
src/libstd/sys/unix/os.rs
src/libstd/sys/unix/pipe.rs
src/libstd/sys/unix/process.rs
src/libstd/sys/unix/tcp.rs
src/libstd/sys/unix/thread_local.rs
src/libstd/sys/unix/timer.rs
src/libstd/sys/unix/tty.rs
src/libstd/sys/windows/c.rs
src/libstd/sys/windows/fs.rs
src/libstd/sys/windows/mod.rs
src/libstd/sys/windows/mutex.rs
src/libstd/sys/windows/os.rs
src/libstd/sys/windows/pipe.rs
src/libstd/sys/windows/process.rs
src/libstd/sys/windows/tcp.rs
src/libstd/sys/windows/thread_local.rs
src/libstd/sys/windows/timer.rs
src/libstd/sys/windows/tty.rs
src/libstd/thread.rs
src/libstd/thread_local/mod.rs
src/libstd/thread_local/scoped.rs
src/libstd/tuple.rs
src/libsyntax/codemap.rs
src/libsyntax/ext/bytes.rs
src/libsyntax/ext/quote.rs
src/libsyntax/owned_slice.rs
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/parser.rs
src/libsyntax/parse/token.rs
src/libsyntax/ptr.rs
src/libsyntax/std_inject.rs
src/libsyntax/util/interner.rs
src/libsyntax/util/small_vector.rs
src/libtest/lib.rs
src/libtest/stats.rs
src/libtime/lib.rs
src/test/auxiliary/cci_capture_clause.rs
src/test/auxiliary/static-methods-crate.rs
src/test/auxiliary/trait_inheritance_overloading_xc.rs
src/test/auxiliary/unboxed-closures-cross-crate.rs
src/test/bench/core-map.rs
src/test/bench/core-set.rs
src/test/bench/core-uint-to-str.rs
src/test/bench/msgsend-pipes-shared.rs
src/test/bench/msgsend-pipes.rs
src/test/bench/msgsend-ring-mutex-arcs.rs
src/test/bench/rt-messaging-ping-pong.rs
src/test/bench/rt-parfib.rs
src/test/bench/shootout-ackermann.rs
src/test/bench/shootout-binarytrees.rs
src/test/bench/shootout-chameneos-redux.rs
src/test/bench/shootout-fannkuch-redux.rs
src/test/bench/shootout-fasta-redux.rs
src/test/bench/shootout-fasta.rs
src/test/bench/shootout-fibo.rs
src/test/bench/shootout-k-nucleotide-pipes.rs
src/test/bench/shootout-k-nucleotide.rs
src/test/bench/shootout-mandelbrot.rs
src/test/bench/shootout-meteor.rs
src/test/bench/shootout-nbody.rs
src/test/bench/shootout-pfib.rs
src/test/bench/shootout-reverse-complement.rs
src/test/bench/shootout-spectralnorm.rs
src/test/bench/shootout-threadring.rs
src/test/bench/spawnone.rs [deleted file]
src/test/bench/std-smallintmap.rs
src/test/bench/sudoku.rs
src/test/bench/task-perf-jargon-metal-smoke.rs
src/test/bench/task-perf-spawnalot.rs
src/test/compile-fail/bind-by-move-no-guards.rs
src/test/compile-fail/binop-consume-args.rs
src/test/compile-fail/binop-move-semantics.rs
src/test/compile-fail/borrowck-loan-in-overloaded-op.rs
src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs
src/test/compile-fail/borrowck-overloaded-index-2.rs
src/test/compile-fail/borrowck-overloaded-index-autoderef.rs
src/test/compile-fail/borrowck-overloaded-index.rs
src/test/compile-fail/builtin-superkinds-self-type.rs
src/test/compile-fail/comm-not-freeze-receiver.rs
src/test/compile-fail/comm-not-freeze.rs
src/test/compile-fail/issue-12041.rs
src/test/compile-fail/issue-16709.rs
src/test/compile-fail/issue-18566.rs
src/test/compile-fail/issue-3702-2.rs
src/test/compile-fail/unop-move-semantics.rs
src/test/compile-fail/unsendable-class.rs
src/test/compile-fail/wrong-mul-method-signature.rs
src/test/pretty/issue-4264.pp
src/test/run-pass/bool.rs
src/test/run-pass/builtin-superkinds-capabilities-transitive.rs
src/test/run-pass/builtin-superkinds-capabilities-xc.rs
src/test/run-pass/builtin-superkinds-capabilities.rs
src/test/run-pass/builtin-superkinds-self-type.rs
src/test/run-pass/c-stack-returning-int64.rs
src/test/run-pass/capturing-logging.rs
src/test/run-pass/closure-bounds-can-capture-chan.rs
src/test/run-pass/cmp-default.rs
src/test/run-pass/comm.rs
src/test/run-pass/const-str-ptr.rs
src/test/run-pass/core-run-destroy.rs
src/test/run-pass/deref-mut-on-ref.rs
src/test/run-pass/deref-on-ref.rs
src/test/run-pass/deriving-cmp-shortcircuit.rs
src/test/run-pass/deriving-zero.rs
src/test/run-pass/drop-trait-enum.rs
src/test/run-pass/dst-deref-mut.rs
src/test/run-pass/dst-deref.rs
src/test/run-pass/fixup-deref-mut.rs
src/test/run-pass/foreign-fn-linkname.rs
src/test/run-pass/hashmap-memory.rs
src/test/run-pass/issue-13264.rs
src/test/run-pass/issue-13494.rs
src/test/run-pass/issue-15734.rs
src/test/run-pass/issue-16560.rs
src/test/run-pass/issue-16774.rs
src/test/run-pass/issue-3609.rs
src/test/run-pass/issue-3743.rs
src/test/run-pass/issue-3979-generics.rs
src/test/run-pass/issue-4446.rs
src/test/run-pass/issue-4448.rs
src/test/run-pass/issue-7784.rs
src/test/run-pass/issue-8827.rs
src/test/run-pass/issue-9396.rs
src/test/run-pass/ivec-tag.rs
src/test/run-pass/logging-only-prints-once.rs
src/test/run-pass/macro-with-braces-in-expr-position.rs
src/test/run-pass/match-with-ret-arm.rs
src/test/run-pass/numeric-method-autoexport.rs
src/test/run-pass/out-of-stack-new-thread-no-split.rs
src/test/run-pass/overloaded-autoderef-indexing.rs
src/test/run-pass/overloaded-autoderef-order.rs
src/test/run-pass/overloaded-autoderef.rs
src/test/run-pass/overloaded-calls-param-vtables.rs
src/test/run-pass/overloaded-index-autoderef.rs
src/test/run-pass/overloaded-index-in-field.rs
src/test/run-pass/overloaded-index.rs
src/test/run-pass/rename-directory.rs
src/test/run-pass/running-with-no-runtime.rs
src/test/run-pass/rust-log-filter.rs
src/test/run-pass/send-resource.rs
src/test/run-pass/send-type-inference.rs
src/test/run-pass/send_str_hashmap.rs
src/test/run-pass/send_str_treemap.rs
src/test/run-pass/sendable-class.rs
src/test/run-pass/spawn-types.rs
src/test/run-pass/supertrait-default-generics.rs
src/test/run-pass/task-comm-0.rs
src/test/run-pass/task-comm-10.rs
src/test/run-pass/task-comm-11.rs
src/test/run-pass/task-comm-13.rs
src/test/run-pass/task-comm-14.rs
src/test/run-pass/task-comm-15.rs
src/test/run-pass/task-comm-16.rs
src/test/run-pass/task-comm-3.rs
src/test/run-pass/task-comm-4.rs
src/test/run-pass/task-comm-5.rs
src/test/run-pass/task-comm-6.rs
src/test/run-pass/task-comm-7.rs
src/test/run-pass/task-comm-9.rs
src/test/run-pass/task-comm-chan-nil.rs
src/test/run-pass/task-spawn-move-and-copy.rs
src/test/run-pass/task-stderr.rs
src/test/run-pass/tcp-accept-stress.rs
src/test/run-pass/tcp-connect-timeouts.rs
src/test/run-pass/tempfile.rs
src/test/run-pass/trait-bounds-in-arc.rs
src/test/run-pass/trait-inheritance-overloading.rs
src/test/run-pass/trivial-message.rs
src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs
src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs
src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs
src/test/run-pass/unique-send-2.rs
src/test/run-pass/unique-send.rs
src/test/run-pass/unwind-resource.rs
src/test/run-pass/variadic-ffi.rs
src/test/run-pass/wait-forked-but-failed-child.rs

index bdbfbfd7c89d60a9e1933b94c312ebc362ede8d2..ad1264828cb9679506e13084c82d97633b93009e 100644 (file)
@@ -22,8 +22,8 @@
 use std::os;
 use std::io;
 use std::io::fs;
-use std::str::FromStr;
-use std::thunk::{Thunk};
+use std::str::{FromStr, from_str};
+use std::thunk::Thunk;
 use getopts::{optopt, optflag, reqopt};
 use common::Config;
 use common::{Pretty, DebugInfoGdb, DebugInfoLldb, Codegen};
index 3a87271ede7d85572c4ac36225f8678bdaf1c6c0..b8808eaf57d93e076b5b90829ecd0d45b5317202 100644 (file)
@@ -450,6 +450,8 @@ them.
 
 ~~~no_run
 extern crate libc;
+
+use std::c_str::ToCStr;
 use std::ptr;
 
 #[link(name = "readline")]
index f4ec787a7949109c7a2a95801cfdf49ce958baa3..e90f30cb86473ea95ffa74d7af1fc00148bef806 100644 (file)
@@ -26,7 +26,7 @@ in the `$`s, they just indicate the start of each command):
 curl -L https://static.rust-lang.org/rustup.sh | sudo sh
 ```
 
-If you're concerned about the [potential insecurity](http://curlpipesh.tumblr.com/) of using `curl | sudo sh`, 
+If you're concerned about the [potential insecurity](http://curlpipesh.tumblr.com/) of using `curl | sudo sh`,
 please keep reading and see our disclaimer below. And feel free to use a two-step version of the installation and examine our installation script:
 
 ```bash
@@ -1109,10 +1109,11 @@ An `Ordering` can only be _one_ of `Less`, `Equal`, or `Greater` at any given
 time. Here's an example:
 
 ```{rust}
+# use std::cmp::Ordering;
 fn cmp(a: int, b: int) -> Ordering {
-    if a < b { Less }
-    else if a > b { Greater }
-    else { Equal }
+    if a < b { Ordering::Less }
+    else if a > b { Ordering::Greater }
+    else { Ordering::Equal }
 }
 
 fn main() {
@@ -1121,11 +1122,11 @@ fn main() {
 
     let ordering = cmp(x, y); // ordering: Ordering
 
-    if ordering == Less {
+    if ordering == Ordering::Less {
         println!("less");
-    } else if ordering == Greater {
+    } else if ordering == Ordering::Greater {
         println!("greater");
-    } else if ordering == Equal {
+    } else if ordering == Ordering::Equal {
         println!("equal");
     }
 }
@@ -1280,10 +1281,11 @@ for every possible value of `x`, and so our program will compile successfully.
 section on enums?
 
 ```{rust}
+# use std::cmp::Ordering;
 fn cmp(a: int, b: int) -> Ordering {
-    if a < b { Less }
-    else if a > b { Greater }
-    else { Equal }
+    if a < b { Ordering::Less }
+    else if a > b { Ordering::Greater }
+    else { Ordering::Equal }
 }
 
 fn main() {
@@ -1292,11 +1294,11 @@ fn main() {
 
     let ordering = cmp(x, y);
 
-    if ordering == Less {
+    if ordering == Ordering::Less {
         println!("less");
-    } else if ordering == Greater {
+    } else if ordering == Ordering::Greater {
         println!("greater");
-    } else if ordering == Equal {
+    } else if ordering == Ordering::Equal {
         println!("equal");
     }
 }
@@ -1305,10 +1307,11 @@ fn main() {
 We can re-write this as a `match`:
 
 ```{rust}
+# use std::cmp::Ordering;
 fn cmp(a: int, b: int) -> Ordering {
-    if a < b { Less }
-    else if a > b { Greater }
-    else { Equal }
+    if a < b { Ordering::Less }
+    else if a > b { Ordering::Greater }
+    else { Ordering::Equal }
 }
 
 fn main() {
@@ -1316,9 +1319,9 @@ fn main() {
     let y = 10i;
 
     match cmp(x, y) {
-        Less    => println!("less"),
-        Greater => println!("greater"),
-        Equal   => println!("equal"),
+        Ordering::Less    => println!("less"),
+        Ordering::Greater => println!("greater"),
+        Ordering::Equal   => println!("equal"),
     }
 }
 ```
@@ -1365,10 +1368,11 @@ side of a `let` binding or directly where an expression is used. We could
 also implement the previous line like this:
 
 ```{rust}
+# use std::cmp::Ordering;
 fn cmp(a: int, b: int) -> Ordering {
-    if a < b { Less }
-    else if a > b { Greater }
-    else { Equal }
+    if a < b { Ordering::Less }
+    else if a > b { Ordering::Greater }
+    else { Ordering::Equal }
 }
 
 fn main() {
@@ -1376,9 +1380,9 @@ fn main() {
     let y = 10i;
 
     println!("{}", match cmp(x, y) {
-        Less    => "less",
-        Greater => "greater",
-        Equal   => "equal",
+        Ordering::Less    => "less",
+        Ordering::Greater => "greater",
+        Ordering::Equal   => "equal",
     });
 }
 ```
@@ -2139,6 +2143,7 @@ guess to the secret number:
 ```{rust,ignore}
 use std::io;
 use std::rand;
+use std::cmp::Ordering;
 
 fn main() {
     println!("Guess the number!");
@@ -2157,16 +2162,16 @@ fn main() {
     println!("You guessed: {}", input);
 
     match cmp(input, secret_number) {
-        Less    => println!("Too small!"),
-        Greater => println!("Too big!"),
-        Equal   => println!("You win!"),
+        Ordering::Less    => println!("Too small!"),
+        Ordering::Greater => println!("Too big!"),
+        Ordering::Equal   => println!("You win!"),
     }
 }
 
 fn cmp(a: int, b: int) -> Ordering {
-    if a < b { Less }
-    else if a > b { Greater }
-    else { Equal }
+    if a < b { Ordering::Less }
+    else if a > b { Ordering::Greater }
+    else { Ordering::Equal }
 }
 ```
 
@@ -2193,6 +2198,7 @@ we wrote the `cmp` function! Let's change it to take `uint`s:
 ```{rust,ignore}
 use std::io;
 use std::rand;
+use std::cmp::Ordering;
 
 fn main() {
     println!("Guess the number!");
@@ -2211,16 +2217,16 @@ fn main() {
     println!("You guessed: {}", input);
 
     match cmp(input, secret_number) {
-        Less    => println!("Too small!"),
-        Greater => println!("Too big!"),
-        Equal   => println!("You win!"),
+        Ordering::Less    => println!("Too small!"),
+        Ordering::Greater => println!("Too big!"),
+        Ordering::Equal   => println!("You win!"),
     }
 }
 
 fn cmp(a: uint, b: uint) -> Ordering {
-    if a < b { Less }
-    else if a > b { Greater }
-    else { Equal }
+    if a < b { Ordering::Less }
+    else if a > b { Ordering::Greater }
+    else { Ordering::Equal }
 }
 ```
 
@@ -2290,6 +2296,7 @@ Anyway, with us now converting our input to a number, our code looks like this:
 ```{rust,ignore}
 use std::io;
 use std::rand;
+use std::cmp::Ordering;
 
 fn main() {
     println!("Guess the number!");
@@ -2308,16 +2315,16 @@ fn main() {
     println!("You guessed: {}", input_num);
 
     match cmp(input_num, secret_number) {
-        Less    => println!("Too small!"),
-        Greater => println!("Too big!"),
-        Equal   => println!("You win!"),
+        Ordering::Less    => println!("Too small!"),
+        Ordering::Greater => println!("Too big!"),
+        Ordering::Equal   => println!("You win!"),
     }
 }
 
 fn cmp(a: uint, b: uint) -> Ordering {
-    if a < b { Less }
-    else if a > b { Greater }
-    else { Equal }
+    if a < b { Ordering::Less }
+    else if a > b { Ordering::Greater }
+    else { Ordering::Equal }
 }
 ```
 
@@ -2339,6 +2346,7 @@ to do that. Try this code:
 ```{rust,no_run}
 use std::io;
 use std::rand;
+use std::cmp::Ordering;
 
 fn main() {
     println!("Guess the number!");
@@ -2366,16 +2374,16 @@ fn main() {
     println!("You guessed: {}", num);
 
     match cmp(num, secret_number) {
-        Less    => println!("Too small!"),
-        Greater => println!("Too big!"),
-        Equal   => println!("You win!"),
+        Ordering::Less    => println!("Too small!"),
+        Ordering::Greater => println!("Too big!"),
+        Ordering::Equal   => println!("You win!"),
     }
 }
 
 fn cmp(a: uint, b: uint) -> Ordering {
-    if a < b { Less }
-    else if a > b { Greater }
-    else { Equal }
+    if a < b { Ordering::Less }
+    else if a > b { Ordering::Greater }
+    else { Ordering::Equal }
 }
 ```
 
@@ -2405,6 +2413,7 @@ code looks like this:
 ```{rust,no_run}
 use std::io;
 use std::rand;
+use std::cmp::Ordering;
 
 fn main() {
     println!("Guess the number!");
@@ -2432,16 +2441,16 @@ fn main() {
     println!("You guessed: {}", num);
 
     match cmp(num, secret_number) {
-        Less    => println!("Too small!"),
-        Greater => println!("Too big!"),
-        Equal   => println!("You win!"),
+        Ordering::Less    => println!("Too small!"),
+        Ordering::Greater => println!("Too big!"),
+        Ordering::Equal   => println!("You win!"),
     }
 }
 
 fn cmp(a: uint, b: uint) -> Ordering {
-    if a < b { Less }
-    else if a > b { Greater }
-    else { Equal }
+    if a < b { Ordering::Less }
+    else if a > b { Ordering::Greater }
+    else { Ordering::Equal }
 }
 ```
 
@@ -2478,6 +2487,7 @@ Let's add that in:
 ```{rust,no_run}
 use std::io;
 use std::rand;
+use std::cmp::Ordering;
 
 fn main() {
     println!("Guess the number!");
@@ -2507,17 +2517,17 @@ fn main() {
         println!("You guessed: {}", num);
 
         match cmp(num, secret_number) {
-            Less    => println!("Too small!"),
-            Greater => println!("Too big!"),
-            Equal   => println!("You win!"),
+            Ordering::Less    => println!("Too small!"),
+            Ordering::Greater => println!("Too big!"),
+            Ordering::Equal   => println!("You win!"),
         }
     }
 }
 
 fn cmp(a: uint, b: uint) -> Ordering {
-    if a < b { Less }
-    else if a > b { Greater }
-    else { Equal }
+    if a < b { Ordering::Less }
+    else if a > b { Ordering::Greater }
+    else { Ordering::Equal }
 }
 ```
 
@@ -2553,6 +2563,7 @@ suboptimal to say the least. First, let's actually quit when you win the game:
 ```{rust,no_run}
 use std::io;
 use std::rand;
+use std::cmp::Ordering;
 
 fn main() {
     println!("Guess the number!");
@@ -2582,9 +2593,9 @@ fn main() {
         println!("You guessed: {}", num);
 
         match cmp(num, secret_number) {
-            Less    => println!("Too small!"),
-            Greater => println!("Too big!"),
-            Equal   => {
+            Ordering::Less    => println!("Too small!"),
+            Ordering::Greater => println!("Too big!"),
+            Ordering::Equal   => {
                 println!("You win!");
                 return;
             },
@@ -2593,9 +2604,9 @@ fn main() {
 }
 
 fn cmp(a: uint, b: uint) -> Ordering {
-    if a < b { Less }
-    else if a > b { Greater }
-    else { Equal }
+    if a < b { Ordering::Less }
+    else if a > b { Ordering::Greater }
+    else { Ordering::Equal }
 }
 ```
 
@@ -2608,6 +2619,7 @@ we don't want to quit, we just want to ignore it. Change that `return` to
 ```{rust,no_run}
 use std::io;
 use std::rand;
+use std::cmp::Ordering;
 
 fn main() {
     println!("Guess the number!");
@@ -2637,9 +2649,9 @@ fn main() {
         println!("You guessed: {}", num);
 
         match cmp(num, secret_number) {
-            Less    => println!("Too small!"),
-            Greater => println!("Too big!"),
-            Equal   => {
+            Ordering::Less    => println!("Too small!"),
+            Ordering::Greater => println!("Too big!"),
+            Ordering::Equal   => {
                 println!("You win!");
                 return;
             },
@@ -2648,9 +2660,9 @@ fn main() {
 }
 
 fn cmp(a: uint, b: uint) -> Ordering {
-    if a < b { Less }
-    else if a > b { Greater }
-    else { Equal }
+    if a < b { Ordering::Less }
+    else if a > b { Ordering::Greater }
+    else { Ordering::Equal }
 }
 ```
 
@@ -2686,6 +2698,7 @@ It was good for testing, but it kind of ruins the game. Here's our final source:
 ```{rust,no_run}
 use std::io;
 use std::rand;
+use std::cmp::Ordering;
 
 fn main() {
     println!("Guess the number!");
@@ -2713,9 +2726,9 @@ fn main() {
         println!("You guessed: {}", num);
 
         match cmp(num, secret_number) {
-            Less    => println!("Too small!"),
-            Greater => println!("Too big!"),
-            Equal   => {
+            Ordering::Less    => println!("Too small!"),
+            Ordering::Greater => println!("Too big!"),
+            Ordering::Equal   => {
                 println!("You win!");
                 return;
             },
@@ -2724,9 +2737,9 @@ fn main() {
 }
 
 fn cmp(a: uint, b: uint) -> Ordering {
-    if a < b { Less }
-    else if a > b { Greater }
-    else { Equal }
+    if a < b { Ordering::Less }
+    else if a > b { Ordering::Greater }
+    else { Ordering::Equal }
 }
 ```
 
@@ -5217,7 +5230,7 @@ as you can see, there's no overhead of deciding which version to call here,
 hence 'statically dispatched'. The downside is that we have two copies of
 the same function, so our binary is a little bit larger.
 
-# Threads 
+# Threads
 
 Concurrency and parallelism are topics that are of increasing interest to a
 broad subsection of software developers. Modern computers are often multi-core,
index f3ad19bbd2a6c038cdb2b2ea3ff730a054035cb4..7b3a0b74b8a5ce274c0e1b5a2271c429c38b4797 100644 (file)
@@ -4149,11 +4149,11 @@ Unwinding the stack of a thread is done by the thread itself, on its own control
 stack. If a value with a destructor is freed during unwinding, the code for the
 destructor is run, also on the thread's control stack. Running the destructor
 code causes a temporary transition to a *running* state, and allows the
-destructor code to cause any subsequent state transitions. The original thread 
+destructor code to cause any subsequent state transitions. The original thread
 of unwinding and panicking thereby may suspend temporarily, and may involve
 (recursive) unwinding of the stack of a failed destructor. Nonetheless, the
 outermost unwinding activity will continue until the stack is unwound and the
-thread transitions to the *dead* state. There is no way to "recover" from thread 
+thread transitions to the *dead* state. There is no way to "recover" from thread
 panics. Once a thread has temporarily suspended its unwinding in the *panicking*
 state, a panic occurring from within this destructor results in *hard* panic.
 A hard panic currently results in the process aborting.
index 64e10e69a2ef3c0153f78c691994fdbde8e13a30..f748c8ad1eb2a24b10628eb0a1276e84a744a3d1 100644 (file)
@@ -26,6 +26,7 @@
 //! [dir_graph]: http://en.wikipedia.org/wiki/Directed_graph
 //!
 //! ```
+//! use std::cmp::Ordering;
 //! use std::collections::BinaryHeap;
 //! use std::uint;
 //!
 use core::prelude::*;
 
 use core::default::Default;
+use core::iter::FromIterator;
 use core::mem::{zeroed, replace, swap};
 use core::ptr;
 
index d8dfc02c97a46eda982c9eb3f16216eb282c1e33..0b3de113042112ca2d34f79c8b64e5e736a49eb5 100644 (file)
 
 use core::prelude::*;
 
+use core::cmp::Ordering;
 use core::cmp;
 use core::default::Default;
 use core::fmt;
+use core::hash;
 use core::iter::{Cloned, Chain, Enumerate, Repeat, Skip, Take, repeat};
-use core::iter;
+use core::iter::{mod, FromIterator, RandomAccessIterator};
 use core::num::Int;
-use core::slice;
+use core::ops::Index;
+use core::slice::{Iter, IterMut};
 use core::{u8, u32, uint};
 use bitv_set; //so meta
 
-use core::hash;
 use Vec;
 
 type Blocks<'a> = Cloned<slice::Iter<'a, u32>>;
@@ -2507,7 +2509,7 @@ fn test_bitv_extend() {
 
 #[cfg(test)]
 mod bitv_bench {
-    use std::prelude::*;
+    use std::prelude::v1::*;
     use std::rand;
     use std::rand::Rng;
     use std::u32;
@@ -3002,7 +3004,7 @@ fn test_bitv_clone() {
 
 #[cfg(test)]
 mod bitv_set_bench {
-    use std::prelude::*;
+    use std::prelude::v1::*;
     use std::rand;
     use std::rand::Rng;
     use std::u32;
index 87b40aa1ceeaf427d8438ad9d0ba1a59a5a28407..6d41883dc8d9ea40c2400ce611206811dba27e55 100644 (file)
 
 use core::prelude::*;
 
-use self::StackOp::*;
-use super::node::{mod, Node, Found, GoDown};
-use super::node::{Traversal, MutTraversal, MoveTraversal};
-use super::node::TraversalItem::{mod, Elem, Edge};
-use super::node::ForceResult::{Leaf, Internal};
 use core::borrow::BorrowFrom;
-use std::hash::{Writer, Hash};
+use core::cmp::Ordering;
 use core::default::Default;
-use core::{iter, fmt, mem};
 use core::fmt::Show;
-use core::iter::Map;
+use core::hash::{Writer, Hash};
+use core::iter::{Map, FromIterator};
+use core::ops::{Index, IndexMut};
+use core::{iter, fmt, mem};
 
 use ring_buf::RingBuf;
 
 use self::Continuation::{Continue, Finished};
+use self::StackOp::*;
+use super::node::ForceResult::{Leaf, Internal};
+use super::node::TraversalItem::{mod, Elem, Edge};
+use super::node::{Traversal, MutTraversal, MoveTraversal};
+use super::node::{mod, Node, Found, GoDown};
 
 // FIXME(conventions): implement bounded iterators
 
@@ -501,6 +503,7 @@ mod stack {
     use core::prelude::*;
     use core::kinds::marker;
     use core::mem;
+    use core::ops::{Deref, DerefMut};
     use super::BTreeMap;
     use super::super::node::{mod, Node, Fit, Split, Internal, Leaf};
     use super::super::node::handle;
index 3907f28092a379ebf7bf5a4204e479106ab1779b..053563683653b0b0fe28a2446130e47795c5e246 100644 (file)
 
 use core::prelude::*;
 
-use core::{slice, mem, ptr, cmp, num, raw};
-use core::iter::Zip;
 use core::borrow::BorrowFrom;
+use core::cmp::Ordering::{Greater, Less, Equal};
+use core::iter::Zip;
+use core::ops::{Deref, DerefMut};
 use core::ptr::Unique;
+use core::{slice, mem, ptr, cmp, num, raw};
 use alloc::heap;
 
 /// Represents the result of an Insertion: either the item fit, or the node had to split
index f3f6727f1c06b537d5c765d24e10dc141a244a58..3e8988530e63e147302f2f7b38ae6860bc6b791c 100644 (file)
 
 use core::prelude::*;
 
-use btree_map::{BTreeMap, Keys};
-use std::hash::Hash;
 use core::borrow::BorrowFrom;
+use core::cmp::Ordering::{mod, Less, Greater, Equal};
 use core::default::Default;
-use core::fmt;
-use core::iter::{Peekable, Map};
 use core::fmt::Show;
+use core::fmt;
+use core::hash::Hash;
+use core::iter::{Peekable, Map, FromIterator};
+use core::ops::{BitOr, BitAnd, BitXor, Sub};
+
+use btree_map::{BTreeMap, Keys};
 
 // FIXME(conventions): implement bounded iterators
 
index 8b7b7176b80e0713edafe3cbc0f800d6c9ffe559..68acbfcb3c3c80d412811d4341e25db7887d59b6 100644 (file)
 use core::prelude::*;
 
 use alloc::boxed::Box;
+use core::cmp::Ordering;
 use core::default::Default;
 use core::fmt;
-use core::iter;
+use core::hash::{Writer, Hash};
+use core::iter::{mod, FromIterator};
 use core::mem;
 use core::ptr;
-use std::hash::{Writer, Hash};
 
 /// A doubly-linked list.
 #[stable]
index b484fc41ff6e5bed9e43cbdc8783749e66a949de..ea3d8659f54a471706edc038ffa5174a7dd0f885 100644 (file)
@@ -16,6 +16,8 @@
 use core::prelude::*;
 use core::fmt;
 use core::num::Int;
+use core::iter::FromIterator;
+use core::ops::{Sub, BitOr, BitAnd, BitXor};
 
 // FIXME(contentions): implement union family of methods? (general design may be wrong here)
 
index 12148947a19a699c047704ab8bb69d8287105ebc..e4c9e51a8455b46f4eb7e31e312527d8056fac39 100644 (file)
 
 use core::prelude::*;
 
+use core::cmp::Ordering;
 use core::default::Default;
 use core::fmt;
-use core::iter;
-use core::raw::Slice as RawSlice;
-use core::ptr;
+use core::iter::{mod, FromIterator, RandomAccessIterator};
 use core::kinds::marker;
 use core::mem;
 use core::num::{Int, UnsignedInt};
+use core::ops::{Index, IndexMut};
+use core::ptr;
+use core::raw::Slice as RawSlice;
 
 use std::hash::{Writer, Hash};
 use std::cmp;
index 61111d96bd064cf3a7f8e9b13d0cd2d9ec587ee1..9e2b4b77910e225434e2c24ae955479bef2561a4 100644 (file)
 
 use alloc::boxed::Box;
 use core::borrow::{BorrowFrom, BorrowFromMut, ToOwned};
-use core::cmp;
-use core::iter::{range_step, MultiplicativeIterator};
+use core::clone::Clone;
+use core::cmp::Ordering::{mod, Greater, Less};
+use core::cmp::{mod, Ord};
+use core::iter::{Iterator, IteratorExt, IteratorCloneExt};
+use core::iter::{range, range_step, MultiplicativeIterator};
 use core::kinds::Sized;
 use core::mem::size_of;
 use core::mem;
-use core::ops::{FnMut,SliceMut};
-use core::prelude::{Clone, Greater, Iterator, IteratorExt, Less, None, Option};
-use core::prelude::{Ord, Ordering, PtrExt, Some, range, IteratorCloneExt, Result};
+use core::ops::{FnMut, SliceMut};
+use core::option::Option::{mod, Some, None};
+use core::ptr::PtrExt;
 use core::ptr;
+use core::result::Result;
 use core::slice as core_slice;
 use self::Direction::*;
 
index 37a6e690f5d30ee5688931da70761286a34b67a7..ae038a9f0891f4b800a02cd0c025388b43ee12e2 100644 (file)
 use core::prelude::*;
 
 use core::borrow::{Cow, IntoCow};
+use core::cmp::Equiv;
 use core::default::Default;
 use core::fmt;
 use core::hash;
+use core::iter::FromIterator;
 use core::mem;
+use core::ops::{mod, Deref, Add};
 use core::ptr;
-use core::ops;
 use core::raw::Slice as RawSlice;
 use unicode::str as unicode_str;
 use unicode::str::Utf16Item;
index a1952352badfaa28115cfad197b07a9840bd463a..4b7aa896870527b3419138d6e1b00b7e259d5852 100644 (file)
 use alloc::heap::{EMPTY, allocate, reallocate, deallocate};
 use core::borrow::{Cow, IntoCow};
 use core::cmp::max;
+use core::cmp::{Equiv, Ordering};
 use core::default::Default;
 use core::fmt;
 use core::hash::{mod, Hash};
-use core::iter::repeat;
+use core::iter::{repeat, FromIterator};
 use core::kinds::marker::{ContravariantLifetime, InvariantType};
 use core::mem;
 use core::nonzero::NonZero;
 use core::num::{Int, UnsignedInt};
+use core::ops::{Index, IndexMut, Deref, Add};
 use core::ops;
 use core::ptr;
 use core::raw::Slice as RawSlice;
index 7c30912cf91bace41266194e5786a72ccd4c8cfd..172fd56ed3962bca413debf9c4256224dedadb16 100644 (file)
 
 use core::prelude::*;
 
+use core::cmp::Ordering;
 use core::default::Default;
 use core::fmt;
 use core::hash::{Hash, Writer};
+use core::iter::{Enumerate, FilterMap, Map, FromIterator};
 use core::iter;
-use core::iter::{Enumerate, FilterMap, Map};
 use core::mem::replace;
+use core::ops::{Index, IndexMut};
 
 use {vec, slice};
 use vec::Vec;
index 367c794e84bb647b9687c05bbc41b339c9f73561..38906892a339f24a3c5ab81b0ab470c5929ec202 100644 (file)
@@ -125,11 +125,12 @@ impl Ordering {
     /// # Example
     ///
     /// ```rust
+    /// use std::cmp::Ordering::{Less, Equal, Greater};
+    ///
     /// assert_eq!(Less.reverse(), Greater);
     /// assert_eq!(Equal.reverse(), Equal);
     /// assert_eq!(Greater.reverse(), Less);
     ///
-    ///
     /// let mut data: &mut [_] = &mut [2u, 10, 5, 8];
     ///
     /// // sort the array from largest to smallest.
@@ -170,6 +171,8 @@ pub trait Ord for Sized?: Eq + PartialOrd<Self> {
     /// the expression `self <operator> other` if true.  For example:
     ///
     /// ```
+    /// use std::cmp::Ordering::{Less, Equal, Greater};
+    ///
     /// assert_eq!( 5u.cmp(&10), Less);     // because 5 < 10
     /// assert_eq!(10u.cmp(&5),  Greater);  // because 10 > 5
     /// assert_eq!( 5u.cmp(&5),  Equal);    // because 5 == 5
index af07869e95feb291c707b46634adfc97b33469ed..15016562699d6a800dff9c790ff5fac228fb3799 100644 (file)
@@ -25,6 +25,8 @@
 //! demonstrates adding and subtracting two `Point`s.
 //!
 //! ```rust
+//! use std::ops::{Add, Sub};
+//!
 //! #[deriving(Show)]
 //! struct Point {
 //!     x: int,
 /// struct HasDrop;
 ///
 /// impl Drop for HasDrop {
-///   fn drop(&mut self) {
-///       println!("Dropping!");
-///   }
+///     fn drop(&mut self) {
+///         println!("Dropping!");
+///     }
 /// }
 ///
 /// fn main() {
-///   let _x = HasDrop;
+///     let _x = HasDrop;
 /// }
 /// ```
 #[lang="drop"]
@@ -91,6 +93,8 @@ pub trait Drop {
 /// calling `add`, and therefore, `main` prints `Adding!`.
 ///
 /// ```rust
+/// use std::ops::Add;
+///
 /// #[deriving(Copy)]
 /// struct Foo;
 ///
@@ -130,6 +134,8 @@ fn add(self, other: $t) -> $t { self + other }
 /// calling `sub`, and therefore, `main` prints `Subtracting!`.
 ///
 /// ```rust
+/// use std::ops::Sub;
+///
 /// #[deriving(Copy)]
 /// struct Foo;
 ///
@@ -169,6 +175,8 @@ fn sub(self, other: $t) -> $t { self - other }
 /// calling `mul`, and therefore, `main` prints `Multiplying!`.
 ///
 /// ```rust
+/// use std::ops::Mul;
+///
 /// #[deriving(Copy)]
 /// struct Foo;
 ///
@@ -208,6 +216,8 @@ fn mul(self, other: $t) -> $t { self * other }
 /// calling `div`, and therefore, `main` prints `Dividing!`.
 ///
 /// ```
+/// use std::ops::Div;
+///
 /// #[deriving(Copy)]
 /// struct Foo;
 ///
@@ -247,6 +257,8 @@ fn div(self, other: $t) -> $t { self / other }
 /// calling `rem`, and therefore, `main` prints `Remainder-ing!`.
 ///
 /// ```
+/// use std::ops::Rem;
+///
 /// #[deriving(Copy)]
 /// struct Foo;
 ///
@@ -300,6 +312,8 @@ fn rem(self, other: $t) -> $t {
 /// `neg`, and therefore, `main` prints `Negating!`.
 ///
 /// ```
+/// use std::ops::Neg;
+///
 /// struct Foo;
 ///
 /// impl Copy for Foo {}
@@ -356,6 +370,8 @@ fn neg(self) -> $t { -(self as $t_signed) as $t }
 /// `not`, and therefore, `main` prints `Not-ing!`.
 ///
 /// ```
+/// use std::ops::Not;
+///
 /// struct Foo;
 ///
 /// impl Copy for Foo {}
@@ -396,6 +412,8 @@ fn not(self) -> $t { !self }
 /// calling `bitand`, and therefore, `main` prints `Bitwise And-ing!`.
 ///
 /// ```
+/// use std::ops::BitAnd;
+///
 /// #[deriving(Copy)]
 /// struct Foo;
 ///
@@ -435,6 +453,8 @@ fn bitand(self, rhs: $t) -> $t { self & rhs }
 /// calling `bitor`, and therefore, `main` prints `Bitwise Or-ing!`.
 ///
 /// ```
+/// use std::ops::BitOr;
+///
 /// #[deriving(Copy)]
 /// struct Foo;
 ///
@@ -474,6 +494,8 @@ fn bitor(self, rhs: $t) -> $t { self | rhs }
 /// calling `bitxor`, and therefore, `main` prints `Bitwise Xor-ing!`.
 ///
 /// ```
+/// use std::ops::BitXor;
+///
 /// #[deriving(Copy)]
 /// struct Foo;
 ///
@@ -513,6 +535,8 @@ fn bitxor(self, other: $t) -> $t { self ^ other }
 /// calling `shl`, and therefore, `main` prints `Shifting left!`.
 ///
 /// ```
+/// use std::ops::Shl;
+///
 /// #[deriving(Copy)]
 /// struct Foo;
 ///
@@ -554,6 +578,8 @@ fn shl(self, other: uint) -> $t {
 /// calling `shr`, and therefore, `main` prints `Shifting right!`.
 ///
 /// ```
+/// use std::ops::Shr;
+///
 /// #[deriving(Copy)]
 /// struct Foo;
 ///
@@ -594,6 +620,8 @@ fn shr(self, other: uint) -> $t { self >> other }
 /// calling `index`, and therefore, `main` prints `Indexing!`.
 ///
 /// ```
+/// use std::ops::Index;
+///
 /// #[deriving(Copy)]
 /// struct Foo;
 ///
@@ -623,6 +651,8 @@ pub trait Index<Sized? Index, Sized? Result> for Sized? {
 /// calling `index_mut`, and therefore, `main` prints `Indexing!`.
 ///
 /// ```
+/// use std::ops::IndexMut;
+///
 /// #[deriving(Copy)]
 /// struct Foo;
 ///
@@ -652,6 +682,8 @@ pub trait IndexMut<Sized? Index, Sized? Result> for Sized? {
 /// calling `slice_to`, and therefore, `main` prints `Slicing!`.
 ///
 /// ```ignore
+/// use std::ops::Slice;
+///
 /// #[deriving(Copy)]
 /// struct Foo;
 ///
@@ -699,6 +731,8 @@ pub trait Slice<Sized? Idx, Sized? Result> for Sized? {
 /// calling `slice_from_mut`, and therefore, `main` prints `Slicing!`.
 ///
 /// ```ignore
+/// use std::ops::SliceMut;
+///
 /// #[deriving(Copy)]
 /// struct Foo;
 ///
@@ -827,6 +861,8 @@ pub struct RangeTo<Idx> {
 /// struct.
 ///
 /// ```
+/// use std::ops::Deref;
+///
 /// struct DerefExample<T> {
 ///     value: T
 /// }
@@ -865,6 +901,8 @@ fn deref(&self) -> &T { *self }
 /// struct.
 ///
 /// ```
+/// use std::ops::{Deref, DerefMut};
+///
 /// struct DerefMutExample<T> {
 ///     value: T
 /// }
index cecb49381538035f4c309205994f5e193e082129..210850be13a8e960a58e82cce392afc09ca44dd5 100644 (file)
 
 // Reexported core operators
 pub use kinds::{Copy, Send, Sized, Sync};
-pub use ops::{Add, Sub, Mul, Div, Rem, Neg, Not};
-pub use ops::{BitAnd, BitOr, BitXor};
-pub use ops::{Drop, Deref, DerefMut};
-pub use ops::{Shl, Shr};
-pub use ops::{Index, IndexMut};
-pub use ops::{Slice, SliceMut};
-pub use ops::{Fn, FnMut, FnOnce};
+pub use ops::{Drop, Fn, FnMut, FnOnce};
 
 // Reexported functions
 pub use iter::range;
 pub use mem::drop;
-pub use str::from_str;
 
 // Reexported types and traits
 
 pub use char::Char;
 pub use clone::Clone;
 pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
-pub use cmp::{Ordering, Equiv};
-pub use cmp::Ordering::{Less, Equal, Greater};
-pub use iter::{FromIterator, Extend, IteratorExt};
-pub use iter::{Iterator, DoubleEndedIterator, DoubleEndedIteratorExt, RandomAccessIterator};
-pub use iter::{IteratorCloneExt, CloneIteratorExt, IteratorPairExt};
-pub use iter::{IteratorOrdExt, MutableDoubleEndedIterator, ExactSizeIterator};
-pub use num::{ToPrimitive, FromPrimitive};
-pub use option::Option;
-pub use option::Option::{Some, None};
+pub use iter::{Extend, IteratorExt};
+pub use iter::{Iterator, DoubleEndedIterator, DoubleEndedIteratorExt};
+pub use iter::{IteratorCloneExt, CloneIteratorExt};
+pub use iter::{IteratorOrdExt, ExactSizeIterator, IteratorPairExt};
+pub use option::Option::{mod, Some, None};
 pub use ptr::{PtrExt, MutPtrExt};
-pub use result::Result;
-pub use result::Result::{Ok, Err};
-pub use str::{Str, StrExt};
-pub use tuple::{Tuple1, Tuple2, Tuple3, Tuple4};
-pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8};
-pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12};
-pub use slice::{PartialEqSliceExt, OrdSliceExt};
+pub use result::Result::{mod, Ok, Err};
 pub use slice::{AsSlice, SliceExt};
+pub use slice::{PartialEqSliceExt, OrdSliceExt};
+pub use str::{Str, StrExt};
index 576989fabe77c92a573e6d348b5ff411c3ee6e31..ad2323296d97f5dcfb8d24700e4b852e1a33c7d8 100644 (file)
 //! * `PartialOrd`
 //! * `Ord`
 //! * `Default`
-//!
-//! # Examples
-//!
-//! Using methods:
-//!
-//! ```
-//! #[allow(deprecated)]
-//! # fn main() {
-//! let pair = ("pi", 3.14f64);
-//! assert_eq!(pair.val0(), "pi");
-//! assert_eq!(pair.val1(), 3.14f64);
-//! # }
-//! ```
-//!
-//! Using traits implemented for tuples:
-//!
-//! ```
-//! use std::default::Default;
-//!
-//! let a = (1i, 2i);
-//! let b = (3i, 4i);
-//! assert!(a != b);
-//!
-//! let c = b.clone();
-//! assert!(b == c);
-//!
-//! let d : (u32, f32) = Default::default();
-//! assert_eq!(d, (0u32, 0.0f32));
-//! ```
 
 #![stable]
 
index 716300f652d674c5a2a2cf2a401e4d66b1ded1c1..992c99f1f9fe0a609ee8e12a542ff96f0a062a92 100644 (file)
@@ -8,7 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use core::cmp::{ partial_min, partial_max };
+use core::cmp::{partial_min, partial_max};
+use core::cmp::Ordering::{Less, Greater, Equal};
 
 #[test]
 fn test_int_totalord() {
index 55e0f10c8655c4f873a02479aebf65a824dd99a8..e409dc61510f6e3ecc5a0a9f37271eaa62bd80ab 100644 (file)
@@ -17,6 +17,7 @@ mod tests {
     use core::int;
     use core::num::{FromStrRadix, Int, SignedInt};
     use core::str::from_str;
+    use core::ops::{Shl, Shr, Not, BitXor, BitAnd, BitOr};
     use num;
 
     #[test]
index acc593d7be9c0d8d2ee6261aaa051d362956e5e5..82e91c5b7120a6af93dc5812ba68e01e8f2357cb 100644 (file)
@@ -13,6 +13,7 @@
 use core::num::{NumCast, cast};
 use core::ops::{Add, Sub, Mul, Div, Rem};
 use core::kinds::Copy;
+use std::str::from_str;
 
 mod int_macros;
 mod i8;
@@ -54,6 +55,7 @@ mod test {
     use core::option::Option::{Some, None};
     use core::num::Float;
     use core::num::from_str_radix;
+    use core::str::from_str;
 
     #[test]
     fn from_str_issue7588() {
index b21ac11e6a0b5832908252a91b34c770ca0fb8b4..2311c19d5573ae0200d571f7c922ff15a237f2a8 100644 (file)
@@ -16,6 +16,7 @@ mod tests {
     use core::$T_i::*;
     use core::num::Int;
     use num;
+    use core::ops::{BitOr, BitAnd, BitXor, Shl, Shr, Not};
 
     #[test]
     fn test_overflows() {
index 63d6e14a4a6b88165b72589aa0158a184777fe2b..fc02f46724fb8a5c466a968b89af00434da7ac1a 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::str::from_str;
+
 #[test]
 fn test_bool_from_str() {
     assert_eq!(from_str::<bool>("true"), Some(true));
index f7b714757f8da4ed21074e835a7acf283588911a..c3bc38a6614b8ce270ccd214cfddb212d0581151 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::cmp::Ordering::{Equal, Less, Greater};
+
 #[test]
 fn test_clone() {
     let a = (1i, "2");
index 7dd0649e4837df827b145a76995d5372949f3790..01e55fb2edd9a9e58ab807e543d55fbf39378f25 100644 (file)
@@ -47,6 +47,7 @@
 //! which is cyclic.
 //!
 //! ```rust
+//! use std::borrow::IntoCow;
 //! use graphviz as dot;
 //!
 //! type Nd = int;
 //! entity `&sube`).
 //!
 //! ```rust
+//! use std::borrow::IntoCow;
 //! use graphviz as dot;
 //!
 //! type Nd = uint;
 //! Hasse-diagram for the subsets of the set `{x, y}`.
 //!
 //! ```rust
+//! use std::borrow::IntoCow;
 //! use graphviz as dot;
 //!
 //! type Nd<'a> = (uint, &'a str);
 
 pub use self::LabelText::*;
 
+use std::borrow::IntoCow;
 use std::io;
 use std::str::CowString;
 use std::vec::CowVec;
@@ -586,6 +590,7 @@ mod tests {
     use super::{Nodes, Edges, GraphWalk, render};
     use std::io::IoResult;
     use std::str;
+    use std::borrow::IntoCow;
 
     /// each node is an index in a vector in the graph.
     type Node = uint;
index ddda2b38c223a20c5978706a70cef4cc5196fdd7..573f0926e29150035e684539f5b3bb2d995faa02 100644 (file)
 
 pub use self::MaybeOwnedVector::*;
 
+use std::cmp::{Equiv, Ordering};
 use std::default::Default;
 use std::fmt;
+use std::iter::FromIterator;
 use std::path::BytesContainer;
 use std::slice;
 
@@ -125,7 +127,7 @@ impl<'a,T> FromIterator<T> for MaybeOwnedVector<'a,T> {
     fn from_iter<I:Iterator<T>>(iterator: I) -> MaybeOwnedVector<'a,T> {
         // If we are building from scratch, might as well build the
         // most flexible variant.
-        Growable(FromIterator::from_iter(iterator))
+        Growable(iterator.collect())
     }
 }
 
index 49577cd279bf84bb22c341ff236448ba237f3ffe..8e6c7de305f823edc50450f7055d633aeb7f14e8 100644 (file)
@@ -206,7 +206,7 @@ fn rand<R: Rng>(other: &mut R) -> ChaChaRng {
 
 #[cfg(test)]
 mod test {
-    use std::prelude::*;
+    use std::prelude::v1::*;
 
     use core::iter::order;
     use {Rng, SeedableRng};
index f31f3468a4c0065947d957f11a65f0e36c577a57..981b0eeee53e0c55187dcbe2409ab26c3fefde29 100644 (file)
@@ -94,7 +94,7 @@ fn ind_sample<R: Rng>(&self, rng: &mut R) -> f64 {
 
 #[cfg(test)]
 mod test {
-    use std::prelude::*;
+    use std::prelude::v1::*;
 
     use distributions::{Sample, IndependentSample};
     use super::Exp;
@@ -124,7 +124,7 @@ fn test_exp_invalid_lambda_neg() {
 mod bench {
     extern crate test;
 
-    use std::prelude::*;
+    use std::prelude::v1::*;
 
     use self::test::Bencher;
     use std::mem::size_of;
index 618db380db8d4d8bdf13e9df1ac8dbf9574d974a..378029d1f9b377df231d85969c8d23f6cb5a074e 100644 (file)
@@ -323,7 +323,7 @@ fn ind_sample<R: Rng>(&self, rng: &mut R) -> f64 {
 
 #[cfg(test)]
 mod test {
-    use std::prelude::*;
+    use std::prelude::v1::*;
 
     use distributions::{Sample, IndependentSample};
     use super::{ChiSquared, StudentT, FisherF};
@@ -385,7 +385,7 @@ fn test_t() {
 #[cfg(test)]
 mod bench {
     extern crate test;
-    use std::prelude::*;
+    use std::prelude::v1::*;
     use self::test::Bencher;
     use std::mem::size_of;
     use distributions::IndependentSample;
index 54cb8ae19071893eb320ef1f13bc208111c83ea1..d0123d9c76c997f8206341d6125f8e817fc3fb23 100644 (file)
@@ -258,7 +258,7 @@ fn ziggurat<R: Rng, P, Z>(
 
 #[cfg(test)]
 mod tests {
-    use std::prelude::*;
+    use std::prelude::v1::*;
 
     use {Rng, Rand};
     use super::{RandSample, WeightedChoice, Weighted, Sample, IndependentSample};
index 3507282ec486af51ce63639998b1c1c624ed3fd7..543e236f96dd2ab0c451b4120b35cd54696a1f33 100644 (file)
@@ -160,7 +160,7 @@ fn ind_sample<R: Rng>(&self, rng: &mut R) -> f64 {
 
 #[cfg(test)]
 mod tests {
-    use std::prelude::*;
+    use std::prelude::v1::*;
 
     use distributions::{Sample, IndependentSample};
     use super::{Normal, LogNormal};
@@ -200,7 +200,7 @@ fn test_log_normal_invalid_sd() {
 #[cfg(test)]
 mod bench {
     extern crate test;
-    use std::prelude::*;
+    use std::prelude::v1::*;
     use self::test::Bencher;
     use std::mem::size_of;
     use distributions::{Sample};
index 20ba3566d5b1226601d66f2697a9a8d15c97c63a..558fa2012567591e312d39a657e2f9480bc0337c 100644 (file)
@@ -164,7 +164,7 @@ fn sample_range<R: Rng>(r: &Range<$ty>, rng: &mut R) -> $ty {
 #[cfg(test)]
 mod tests {
     use std::num::Int;
-    use std::prelude::*;
+    use std::prelude::v1::*;
     use distributions::{Sample, IndependentSample};
     use super::Range;
 
index 1fe435a59adcbd7186205c2316592485339c0bf9..1ea4784407592d44b95bbe4dea2da79619cf9db8 100644 (file)
@@ -487,7 +487,7 @@ fn rand<R: Rng>(other: &mut R) -> Isaac64Rng {
 
 #[cfg(test)]
 mod test {
-    use std::prelude::*;
+    use std::prelude::v1::*;
 
     use core::iter::order;
     use {Rng, SeedableRng};
index e50153076c390698759ab5f9832b016c0f9c5b5b..c331807c1b9d3d0acb3175635a1e1000cbbe31bc 100644 (file)
@@ -214,7 +214,7 @@ fn rand<R: Rng>(rng: &mut R) -> Option<T> {
 
 #[cfg(test)]
 mod tests {
-    use std::prelude::*;
+    use std::prelude::v1::*;
     use std::rand::{Rng, thread_rng, Open01, Closed01};
 
     struct ConstantRng(u64);
index 94a11c040e49758e7a8f34e1cafc7a84310b6aa1..46371d427e63fba95ad0cd60f01f00d9d5102fee 100644 (file)
@@ -149,7 +149,7 @@ fn default() -> ReseedWithDefault { ReseedWithDefault }
 
 #[cfg(test)]
 mod test {
-    use std::prelude::*;
+    use std::prelude::v1::*;
 
     use core::iter::order;
     use super::{ReseedingRng, ReseedWithDefault};
index 51c234631550cf9c1e57c78398421614dff5cb70..3171966a596dbad5e8167493154847818c8e6296 100644 (file)
@@ -11,6 +11,7 @@
 pub use self::NamesIter::*;
 pub use self::Regex::*;
 
+use std::borrow::IntoCow;
 use std::collections::HashMap;
 use std::fmt;
 use std::str::CowString;
index 72e0e559c805bb7f0192088050576b7e29d648f2..603ca57d15d5bc010ae1575ca2a5cb28889c0b2d 100644 (file)
@@ -37,6 +37,7 @@
 pub use self::StepState::*;
 
 use std::cmp;
+use std::cmp::Ordering::{mod, Less, Equal, Greater};
 use std::mem;
 use std::iter::repeat;
 use std::slice::SliceExt;
index 692ecf75091c4bd622108b574d2382eddd07ed33..5e74b90dba34cbeb2f1c694ebb7e8c90cf61b900 100644 (file)
 use util::nodemap::{FnvHashMap, NodeSet};
 use lint::{Context, LintPass, LintArray};
 
-use std::{cmp, slice};
 use std::collections::hash_map::Entry::{Occupied, Vacant};
 use std::num::SignedInt;
+use std::{cmp, slice};
 use std::{i8, i16, i32, i64, u8, u16, u32, u64, f32, f64};
+
 use syntax::{abi, ast, ast_map};
 use syntax::ast_util::is_shift_binop;
 use syntax::attr::{mod, AttrMetaMethods};
index d079d0e52aafa523cfa2aa2bbb9af00914089de4..70325294743e8bb658e2f79ee2a2836be5337a19 100644 (file)
 use middle::ty::{mod, Ty};
 use middle::astencode::vtable_decoder_helpers;
 
+use std::collections::HashMap;
 use std::hash::Hash;
 use std::hash;
 use std::io::extensions::u64_from_be_bytes;
 use std::io;
-use std::collections::hash_map::HashMap;
+use std::num::FromPrimitive;
 use std::rc::Rc;
 use std::str;
+
 use rbml::reader;
 use rbml;
 use serialize::Decodable;
index 88c7ccf1b1e36e4860264db404f2d07c29a0bddc..2d3ff95ffa66e64b2085d3289d6e832201740229 100644 (file)
@@ -25,7 +25,6 @@
 
 use std::rc::Rc;
 use std::str;
-use std::string::String;
 use syntax::abi;
 use syntax::ast;
 use syntax::parse::token;
index 13bd22a67c410dc2da59f07d217198f41037e568..06fef66c1e0033609f053b0e8ca3b6190f3c2c9f 100644 (file)
@@ -11,7 +11,9 @@
 /// This module provides linkage between rustc::middle::graph and
 /// libgraphviz traits.
 
-/// For clarity, rename the graphviz crate locally to dot.
+use std::borrow::IntoCow;
+
+// For clarity, rename the graphviz crate locally to dot.
 use graphviz as dot;
 
 use syntax::ast;
index 4c5d76a2c40e57d0507faa689fc5106f21f02677..d16224ec5b8ac19c79b2db17bb51b382bd96b25d 100644 (file)
@@ -24,8 +24,7 @@
 use middle::ty::*;
 use middle::ty;
 use std::fmt;
-use std::iter::AdditiveIterator;
-use std::iter::{range_inclusive, repeat};
+use std::iter::{range_inclusive, AdditiveIterator, FromIterator, repeat};
 use std::num::Float;
 use std::slice;
 use syntax::ast::{mod, DUMMY_NODE_ID, NodeId, Pat};
index 5b89912dd03fcadec6cd0f130a82ad7dc44bf1d7..9fc5cb03353138b46ef8dba1d5717fd4b6532da5 100644 (file)
@@ -27,8 +27,8 @@
 use syntax::visit::{mod, Visitor};
 use syntax::{ast_map, ast_util, codemap};
 
-use std::rc::Rc;
 use std::collections::hash_map::Entry::Vacant;
+use std::rc::Rc;
 
 //
 // This pass classifies expressions by their constant-ness.
index 7372bb267b06c853de1e77c1fe5e327af1cfb67f..6ac1c5470cc755f2abda790cc38f69ff7421bebb 100644 (file)
@@ -33,8 +33,9 @@
 use util::ppaux::Repr;
 
 use std::cell::{Cell, RefCell};
-use std::u32;
+use std::cmp::Ordering::{mod, Less, Greater, Equal};
 use std::iter::repeat;
+use std::u32;
 use syntax::ast;
 
 mod doc;
index 2aef43071992398eefc9197c2c8053e7e302b5dd..78fabcd588a28353ea6021f9535895089971f516 100644 (file)
@@ -36,6 +36,7 @@
 use syntax::visit;
 
 use std::iter::Enumerate;
+use std::num::FromPrimitive;
 use std::slice;
 
 // The actual lang items defined come at the end of this file in one handy table.
index 7bc5d3d070894a263179be6cd01a5f6142bebfb9..07ff0ed67a64e7ac5e0e2b88b2547d82bae54553 100644 (file)
@@ -69,7 +69,7 @@
 use arena::TypedArena;
 use std::borrow::BorrowFrom;
 use std::cell::{Cell, RefCell};
-use std::cmp;
+use std::cmp::{mod, Ordering};
 use std::fmt::{mod, Show};
 use std::hash::{Hash, sip, Writer};
 use std::mem;
index 19ac6d466fb5856cd3d768ca54c9b707a81cb29c..f6f46017f37b95afa9b16aa91f7c3c1b789d93e6 100644 (file)
@@ -394,6 +394,7 @@ mod cg_type_descs {
 
     mod cgsetters {
         use super::{CodegenOptions, Passes, SomePasses, AllPasses};
+        use std::str::from_str;
 
         $(
             pub fn $opt(cg: &mut CodegenOptions, v: Option<&str>) -> bool {
index 73b345a70af4665484821ace157ff4a331d9ab08..8d3aa397f306163063c5aeee492f0f05b2297eba 100644 (file)
@@ -33,7 +33,7 @@ pub fn add_error(&self, error: MoveError<'tcx>) {
     }
 
     pub fn report_potential_errors<'a>(&self, bccx: &BorrowckCtxt<'a, 'tcx>) {
-        report_move_errors(bccx, self.errors.borrow().deref())
+        report_move_errors(bccx, &*self.errors.borrow())
     }
 }
 
index e2813c8e9882ad112e55896fafd6d3357d3ec902..ac6b962d6470448e43958c0eb41109df4d5732c3 100644 (file)
@@ -24,6 +24,7 @@
 use rustc::middle::dataflow::{DataFlowOperator, DataFlowContext, EntryOrExit};
 use rustc::middle::dataflow;
 use std::rc::Rc;
+use std::borrow::IntoCow;
 
 #[deriving(Show, Copy)]
 pub enum Variant {
index 181f38d89939e0beda86e3d5fbbf6caf23ea390a..f3013d2066c3dcab9ebfc5b39cd3ce86f0fa3716 100644 (file)
@@ -54,6 +54,8 @@
 use rustc::DIAGNOSTICS;
 
 use std::any::AnyRefExt;
+use std::cmp::Ordering::Equal;
+use std::comm::channel;
 use std::io;
 use std::iter::repeat;
 use std::os;
index 6c3778787e2e24e5fd3cc2a663fdacce258d56d5..53992d4567a34915148e2c9e87957e05cbc81517 100644 (file)
@@ -13,8 +13,9 @@
 use libc;
 use ArchiveRef;
 
-use std::raw;
+use std::c_str::ToCStr;
 use std::mem;
+use std::raw;
 
 pub struct ArchiveRO {
     ptr: ArchiveRef,
index 7dbcc810b571b521a0b1435ea109eef9df387e25..8553a209005134120fe5dfa1cbd450bd689064cd 100644 (file)
@@ -61,8 +61,9 @@
 use syntax::codemap::{Span, DUMMY_SP};
 use syntax::visit::{mod, Visitor};
 
-use std::rc::Rc;
 use std::mem::replace;
+use std::ops::{Deref, DerefMut};
+use std::rc::Rc;
 
 // Specifies how duplicates should be handled when adding a child item if
 // another item exists with the same name in some namespace.
index 78527315199ca3d044c40743789cdafeb51d1dd3..b3d0d30726c5df9c09d9554406cf8c31ba5dcebb 100644 (file)
@@ -17,6 +17,8 @@
 // `use` directives.
 //
 
+use std::ops::{Deref, DerefMut};
+
 use Resolver;
 use Namespace::{TypeNS, ValueNS};
 
index 9c2437c376ddd20592d3c8ab1e83ab7297900487..4f314291da62810f02f318daac632072f3da94c8 100644 (file)
@@ -27,6 +27,7 @@
 use syntax::ast;
 use syntax::parse::token;
 
+use std::ops::{Deref, DerefMut};
 use std::rc::Rc;
 
 struct ExportRecorder<'a, 'b:'a, 'tcx:'b> {
index 1271330897e737fa5171e8334ae6dafbc0c3203d..7cf4bafe032e0728d0cde8ba8ebe8415e49faa29 100644 (file)
@@ -20,6 +20,7 @@
 use libc;
 use flate;
 
+use std::c_str::ToCStr;
 use std::iter;
 use std::mem;
 use std::num::Int;
index a6f2c7dfed0b18cebf9a4e7b1cb0075cf64f8b2e..f74f0abc18625230da46ca3934ba0586b7aa3bae 100644 (file)
@@ -23,6 +23,7 @@
 use syntax::diagnostic::{Emitter, Handler, Level, mk_handler};
 
 use std::c_str::{ToCStr, CString};
+use std::comm::channel;
 use std::io::Command;
 use std::io::fs;
 use std::iter::Unfold;
index 51ea0af8e10eaa3ccccdfed1883069cf6c16bebc..b877a771bbc6ce80ebc0b6bca809f0cdf0fd08cc 100644 (file)
@@ -1202,8 +1202,7 @@ fn visit_view_item(&mut self, i: &ast::ViewItem) {
                         let glob_map = &self.analysis.glob_map;
                         let glob_map = glob_map.as_ref().unwrap();
                         if glob_map.contains_key(&id) {
-                            let names = glob_map.index(&id);
-                            for n in names.iter() {
+                            for n in glob_map[id].iter() {
                                 if name_string.len() > 0 {
                                     name_string.push_str(", ");
                                 }
index b39dbd71117e818b933e64f2b0d9aaeb134944cc..97f0b92a290f839ab9871f6819dce94038bef53f 100644 (file)
@@ -20,7 +20,7 @@
 use trans::type_::Type;
 use util::nodemap::FnvHashMap;
 use libc::{c_uint, c_char};
-use std::string::String;
+use std::c_str::ToCStr;
 use syntax::codemap::Span;
 
 pub struct Builder<'a, 'tcx: 'a> {
index 83765270ef103d4e48a1ddd7d19e4693144e6f18..99dc971ed945d15e4bdc7025f175cb08062a78a4 100644 (file)
@@ -26,6 +26,7 @@
 use middle::ty::{mod, Ty};
 use middle::subst::{Substs};
 use std::cmp;
+use std::c_str::ToCStr;
 use libc::c_uint;
 use syntax::abi::{Cdecl, Aapcs, C, Win64, Abi};
 use syntax::abi::{RustIntrinsic, Rust, RustCall, Stdcall, Fastcall, System};
index a89b20c949b4040b2a14c4f674a06e5b1a3a9d57..0f0dbf6a24dffc7de58cbf2bdeb6a4fc18a8870c 100644 (file)
 
 pub use self::imp::Lock;
 
-
 #[cfg(unix)]
 mod imp {
     use libc;
+    use std::c_str::ToCStr;
 
     #[cfg(target_os = "linux")]
     mod os {
index 2c05524ea7f7b51b0133db598fc6bee72c75b8ce..468fed1d33910769ce72bae9435fde770a80c501 100644 (file)
 
 use libc;
 use std::ascii::AsciiExt;
+use std::c_str::ToCStr;
 use std::cell::{RefCell, Cell};
+use std::collections::HashMap;
 use std::fmt;
 use std::slice;
 use std::str;
-use std::collections::HashMap;
 
 use html::toc::TocBuilder;
 use html::highlight;
index f8a0b88b4088d99ac4ffcf7fbf56771f3d7d359a..ceb66be2d667439b3e7feb078174940bc9766fd8 100644 (file)
@@ -35,6 +35,7 @@
 pub use self::ExternalLocation::*;
 
 use std::cell::RefCell;
+use std::cmp::Ordering::{mod, Less, Greater, Equal};
 use std::collections::hash_map::Entry::{Occupied, Vacant};
 use std::collections::{HashMap, HashSet};
 use std::default::Default;
index 2e3adf8e767873181fd74af7dcba70f1fea941e4..058a7acd4550b7874be6c7090df920d72d1ac12c 100644 (file)
@@ -13,8 +13,9 @@
 //! hierarchy, with item counts for every stability level per module. A parent
 //! module's count includes its children's.
 
-use std::ops::Add;
+use std::cmp::Ordering;
 use std::num::Zero;
+use std::ops::Add;
 
 use syntax::attr::{Deprecated, Experimental, Unstable, Stable, Frozen, Locked};
 use syntax::ast::Public;
index ba66c51b8fc686cb8c0a992ab3f775e910e61458..b7b8360fced85e89fa383959b627dad055b1a859 100644 (file)
@@ -9,14 +9,14 @@
 // except according to those terms.
 
 use std::cell::RefCell;
+use std::comm::channel;
 use std::dynamic_lib::DynamicLibrary;
 use std::io::{Command, TempDir};
 use std::io;
 use std::os;
 use std::str;
-use std::string::String;
-use std::thunk::Thunk;
 use std::thread::Thread;
+use std::thunk::Thunk;
 
 use std::collections::{HashSet, HashMap};
 use testing;
index 2c2b7313a7bb44a3e3ef053bae2a758329d9ce17..857a7072009bdb6119fc4284fc17b499de009d4d 100644 (file)
@@ -315,8 +315,8 @@ pub fn escape_default<F>(c: u8, mut f: F) where
 
 #[cfg(test)]
 mod tests {
+    use prelude::v1::*;
     use super::*;
-    use prelude::*;
     use char::from_u32;
 
     #[test]
index aeb4df402a2cff3ffa96169caac74a237dc00dee..72220926c0d866105d262d9fa5dc27349f7ddd05 100644 (file)
@@ -209,7 +209,7 @@ pub fn toggle(&mut self, other: $BitFlags) {
             }
         }
 
-        impl BitOr<$BitFlags, $BitFlags> for $BitFlags {
+        impl ::std::ops::BitOr<$BitFlags, $BitFlags> for $BitFlags {
             /// Returns the union of the two sets of flags.
             #[inline]
             fn bitor(self, other: $BitFlags) -> $BitFlags {
@@ -217,7 +217,7 @@ fn bitor(self, other: $BitFlags) -> $BitFlags {
             }
         }
 
-        impl BitXor<$BitFlags, $BitFlags> for $BitFlags {
+        impl ::std::ops::BitXor<$BitFlags, $BitFlags> for $BitFlags {
             /// Returns the left flags, but with all the right flags toggled.
             #[inline]
             fn bitxor(self, other: $BitFlags) -> $BitFlags {
@@ -225,7 +225,7 @@ fn bitxor(self, other: $BitFlags) -> $BitFlags {
             }
         }
 
-        impl BitAnd<$BitFlags, $BitFlags> for $BitFlags {
+        impl ::std::ops::BitAnd<$BitFlags, $BitFlags> for $BitFlags {
             /// Returns the intersection between the two sets of flags.
             #[inline]
             fn bitand(self, other: $BitFlags) -> $BitFlags {
@@ -233,7 +233,7 @@ fn bitand(self, other: $BitFlags) -> $BitFlags {
             }
         }
 
-        impl Sub<$BitFlags, $BitFlags> for $BitFlags {
+        impl ::std::ops::Sub<$BitFlags, $BitFlags> for $BitFlags {
             /// Returns the set difference of the two sets of flags.
             #[inline]
             fn sub(self, other: $BitFlags) -> $BitFlags {
@@ -241,7 +241,7 @@ fn sub(self, other: $BitFlags) -> $BitFlags {
             }
         }
 
-        impl Not<$BitFlags> for $BitFlags {
+        impl ::std::ops::Not<$BitFlags> for $BitFlags {
             /// Returns the complement of this set of flags.
             #[inline]
             fn not(self) -> $BitFlags {
index 46498610e560448242951eeb504e8af32414a3b6..6418841eda8cf36a82b7341259b0529742128871 100644 (file)
@@ -45,6 +45,8 @@
 //! ```rust
 //! extern crate libc;
 //!
+//! use std::c_str::ToCStr;
+//!
 //! extern {
 //!     fn puts(s: *const libc::c_char);
 //! }
@@ -70,6 +72,7 @@
 use core::prelude::*;
 use libc;
 
+use cmp::Ordering;
 use fmt;
 use hash;
 use mem;
@@ -155,6 +158,8 @@ pub unsafe fn new(buf: *const libc::c_char, owns_buffer: bool) -> CString {
     /// one).
     ///
     /// ```rust
+    /// use std::c_str::ToCStr;
+    ///
     /// let foo = "some string";
     ///
     /// // right
@@ -170,6 +175,8 @@ pub unsafe fn new(buf: *const libc::c_char, owns_buffer: bool) -> CString {
     /// ```rust
     /// extern crate libc;
     ///
+    /// use std::c_str::ToCStr;
+    ///
     /// fn main() {
     ///     let c_str = "foo bar".to_c_str();
     ///     unsafe {
@@ -189,6 +196,8 @@ pub fn as_ptr(&self) -> *const libc::c_char {
     /// one).
     ///
     /// ```rust
+    /// use std::c_str::ToCStr;
+    ///
     /// let foo = "some string";
     ///
     /// // right
@@ -309,6 +318,8 @@ pub trait ToCStr for Sized? {
     /// ```rust
     /// extern crate libc;
     ///
+    /// use std::c_str::ToCStr;
+    ///
     /// fn main() {
     ///     let s = "PATH".with_c_str(|path| unsafe {
     ///         libc::getenv(path)
@@ -539,8 +550,7 @@ pub unsafe fn from_c_multistring<F>(buf: *const libc::c_char,
 #[cfg(test)]
 mod tests {
     use super::*;
-    use prelude::{spawn, Some, None, Option, FnOnce, ToString, CloneSliceExt};
-    use prelude::{Clone, PtrExt, Iterator, SliceExt, StrExt};
+    use prelude::v1::*;
     use ptr;
     use thread::Thread;
     use libc;
@@ -732,9 +742,10 @@ fn foo<F>(f: F) where F: FnOnce(&CString) {
 mod bench {
     extern crate test;
 
+    use prelude::v1::*;
     use self::test::Bencher;
     use libc;
-    use prelude::*;
+    use c_str::ToCStr;
 
     #[inline]
     fn check(s: &str, c_str: *const libc::c_char) {
index 0aa51ee66ed63dc30324fcd75b43ddc5d8b7d13b..de60f06efd218dee3c4272a94842938ea2ee90b2 100644 (file)
@@ -172,7 +172,7 @@ fn as_slice<'a>(&'a self) -> &'a [T] {
 
 #[cfg(test)]
 mod tests {
-    use prelude::*;
+    use prelude::v1::*;
 
     use super::CVec;
     use libc;
index 87aebb24f987b7c6295c59031a3e3a82dbbda012..28689767cb0e3524323238c3f7fdc10893b769ab 100644 (file)
@@ -11,7 +11,7 @@
 #![cfg(test)]
 
 extern crate test;
-use prelude::*;
+use prelude::v1::*;
 
 use self::test::Bencher;
 use iter::{range_inclusive};
index f6063df543489754cd6992a123af55b28a58a67f..c0536fc5ca4e4c38294b58a49116c3e77ac1a28f 100644 (file)
@@ -87,7 +87,7 @@ fn usable_capacity(&self, cap: uint) -> uint {
 
 #[test]
 fn test_resize_policy() {
-    use prelude::*;
+    use prelude::v1::*;
     let rp = DefaultResizePolicy;
     for n in range(0u, 1000) {
         assert!(rp.min_capacity(rp.usable_capacity(n)) <= n);
@@ -1530,8 +1530,9 @@ fn extend<T: Iterator<(K, V)>>(&mut self, mut iter: T) {
 
 #[cfg(test)]
 mod test_map {
-    use prelude::*;
+    use prelude::v1::*;
 
+    use cmp::Equiv;
     use super::HashMap;
     use super::Entry::{Occupied, Vacant};
     use hash;
index 74fb63a7a9e12280ea77689a6acb97a26f8f3a93..6132d288da2799ca4698acf467c3ab6db7cb935e 100644 (file)
@@ -866,7 +866,7 @@ fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
 
 #[cfg(test)]
 mod test_set {
-    use prelude::*;
+    use prelude::v1::*;
 
     use super::HashSet;
 
index a405627aecc45a9be9e9a1ea705bf8c4524c428e..dcef24c62bd23c4c0a360b2cca96e1aa8b618dd6 100644 (file)
@@ -60,6 +60,7 @@
 //!
 //! ```
 //! use std::thread::Thread;
+//! use std::comm::channel;
 //!
 //! // Create a simple streaming channel
 //! let (tx, rx) = channel();
@@ -73,6 +74,7 @@
 //!
 //! ```
 //! use std::thread::Thread;
+//! use std::comm::channel;
 //!
 //! // Create a shared channel that can be sent along from many threads
 //! // where tx is the sending half (tx for transmission), and rx is the receiving
@@ -94,6 +96,8 @@
 //! Propagating panics:
 //!
 //! ```should_fail
+//! use std::comm::channel;
+//!
 //! // The call to recv() will panic!() because the channel has already hung
 //! // up (or been deallocated)
 //! let (tx, rx) = channel::<int>();
 //!
 //! ```
 //! use std::thread::Thread;
+//! use std::comm::sync_channel;
 //!
 //! let (tx, rx) = sync_channel::<int>(0);
 //! Thread::spawn(move|| {
 //! after 10 seconds no matter what:
 //!
 //! ```no_run
+//! use std::comm::channel;
 //! use std::io::timer::Timer;
 //! use std::time::Duration;
 //!
 //! has been inactive for 5 seconds:
 //!
 //! ```no_run
+//! use std::comm::channel;
 //! use std::io::timer::Timer;
 //! use std::time::Duration;
 //!
 use self::select::StartResult::*;
 use self::blocking::SignalToken;
 
-macro_rules! test {
-    { fn $name:ident() $b:block $(#[$a:meta])*} => (
-        mod $name {
-            #![allow(unused_imports)]
-
-            use super::*;
-            use comm::*;
-            use thread::Thread;
-            use prelude::{Ok, Err, spawn, range, drop, Box, Some, None, Option};
-            use prelude::{Vec, Buffer, from_str, Clone};
-
-            $(#[$a])* #[test] fn f() { $b }
-        }
-    )
-}
-
 mod blocking;
 mod oneshot;
 mod select;
@@ -458,6 +449,7 @@ fn inner_unsafe<'a>(&'a self) -> &'a UnsafeCell<Flavor<T>> {
 /// # Example
 ///
 /// ```
+/// use std::comm::channel;
 /// use std::thread::Thread;
 ///
 /// // tx is is the sending half (tx for transmission), and rx is the receiving
@@ -499,6 +491,7 @@ pub fn channel<T: Send>() -> (Sender<T>, Receiver<T>) {
 /// # Example
 ///
 /// ```
+/// use std::comm::sync_channel;
 /// use std::thread::Thread;
 ///
 /// let (tx, rx) = sync_channel(1);
@@ -580,6 +573,8 @@ pub fn send(&self, t: T) {
     /// # Example
     ///
     /// ```
+    /// use std::comm::channel;
+    ///
     /// let (tx, rx) = channel();
     ///
     /// // This send is always successful
@@ -1046,9 +1041,12 @@ unsafe impl<T> kinds::Sync for RacyCell<T> { } // Oh dear
 
 #[cfg(test)]
 mod test {
-    use super::*;
-    use prelude::{spawn, range, Some, None, from_str, Clone, Str};
+    use prelude::v1::*;
+
     use os;
+    use super::*;
+    use thread::Thread;
+    use str::from_str;
 
     pub fn stress_factor() -> uint {
         match os::getenv("RUST_TEST_STRESS") {
@@ -1057,121 +1055,144 @@ pub fn stress_factor() -> uint {
         }
     }
 
-    test! { fn smoke() {
+    #[test]
+    fn smoke() {
         let (tx, rx) = channel::<int>();
         tx.send(1);
         assert_eq!(rx.recv(), 1);
-    } }
+    }
 
-    test! { fn drop_full() {
+    #[test]
+    fn drop_full() {
         let (tx, _rx) = channel();
         tx.send(box 1i);
-    } }
+    }
 
-    test! { fn drop_full_shared() {
+    #[test]
+    fn drop_full_shared() {
         let (tx, _rx) = channel();
         drop(tx.clone());
         drop(tx.clone());
         tx.send(box 1i);
-    } }
+    }
 
-    test! { fn smoke_shared() {
+    #[test]
+    fn smoke_shared() {
         let (tx, rx) = channel::<int>();
         tx.send(1);
         assert_eq!(rx.recv(), 1);
         let tx = tx.clone();
         tx.send(1);
         assert_eq!(rx.recv(), 1);
-    } }
+    }
 
-    test! { fn smoke_threads() {
+    #[test]
+    fn smoke_threads() {
         let (tx, rx) = channel::<int>();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             tx.send(1);
         });
         assert_eq!(rx.recv(), 1);
-    } }
+    }
 
-    test! { fn smoke_port_gone() {
+    #[test]
+    #[should_fail]
+    fn smoke_port_gone() {
         let (tx, rx) = channel::<int>();
         drop(rx);
         tx.send(1);
-    } #[should_fail] }
+    }
 
-    test! { fn smoke_shared_port_gone() {
+    #[test]
+    #[should_fail]
+    fn smoke_shared_port_gone() {
         let (tx, rx) = channel::<int>();
         drop(rx);
         tx.send(1);
-    } #[should_fail] }
+    }
 
-    test! { fn smoke_shared_port_gone2() {
+    #[test]
+    #[should_fail]
+    fn smoke_shared_port_gone2() {
         let (tx, rx) = channel::<int>();
         drop(rx);
         let tx2 = tx.clone();
         drop(tx);
         tx2.send(1);
-    } #[should_fail] }
+    }
 
-    test! { fn port_gone_concurrent() {
+    #[test]
+    #[should_fail]
+    fn port_gone_concurrent() {
         let (tx, rx) = channel::<int>();
-        spawn(move|| {
+        Thread::spawn(move|| {
             rx.recv();
-        });
+        }).detach();
         loop { tx.send(1) }
-    } #[should_fail] }
+    }
 
-    test! { fn port_gone_concurrent_shared() {
+    #[test]
+    #[should_fail]
+    fn port_gone_concurrent_shared() {
         let (tx, rx) = channel::<int>();
         let tx2 = tx.clone();
-        spawn(move|| {
+        Thread::spawn(move|| {
             rx.recv();
-        });
+        }).detach();
         loop {
             tx.send(1);
             tx2.send(1);
         }
-    } #[should_fail] }
+    }
 
-    test! { fn smoke_chan_gone() {
+    #[test]
+    #[should_fail]
+    fn smoke_chan_gone() {
         let (tx, rx) = channel::<int>();
         drop(tx);
         rx.recv();
-    } #[should_fail] }
+    }
 
-    test! { fn smoke_chan_gone_shared() {
+    #[test]
+    #[should_fail]
+    fn smoke_chan_gone_shared() {
         let (tx, rx) = channel::<()>();
         let tx2 = tx.clone();
         drop(tx);
         drop(tx2);
         rx.recv();
-    } #[should_fail] }
+    }
 
-    test! { fn chan_gone_concurrent() {
+    #[test]
+    #[should_fail]
+    fn chan_gone_concurrent() {
         let (tx, rx) = channel::<int>();
-        spawn(move|| {
+        Thread::spawn(move|| {
             tx.send(1);
             tx.send(1);
-        });
+        }).detach();
         loop { rx.recv(); }
-    } #[should_fail] }
+    }
 
-    test! { fn stress() {
+    #[test]
+    fn stress() {
         let (tx, rx) = channel::<int>();
-        spawn(move|| {
+        let t = Thread::spawn(move|| {
             for _ in range(0u, 10000) { tx.send(1i); }
         });
         for _ in range(0u, 10000) {
             assert_eq!(rx.recv(), 1);
         }
-    } }
+        t.join().ok().unwrap();
+    }
 
-    test! { fn stress_shared() {
+    #[test]
+    fn stress_shared() {
         static AMT: uint = 10000;
         static NTHREADS: uint = 8;
         let (tx, rx) = channel::<int>();
-        let (dtx, drx) = channel::<()>();
 
-        spawn(move|| {
+        let t = Thread::spawn(move|| {
             for _ in range(0, AMT * NTHREADS) {
                 assert_eq!(rx.recv(), 1);
             }
@@ -1179,99 +1200,93 @@ pub fn stress_factor() -> uint {
                 Ok(..) => panic!(),
                 _ => {}
             }
-            dtx.send(());
         });
 
         for _ in range(0, NTHREADS) {
             let tx = tx.clone();
-            spawn(move|| {
+            Thread::spawn(move|| {
                 for _ in range(0, AMT) { tx.send(1); }
-            });
+            }).detach();
         }
         drop(tx);
-        drx.recv();
-    } }
+        t.join().ok().unwrap();
+    }
 
     #[test]
     fn send_from_outside_runtime() {
         let (tx1, rx1) = channel::<()>();
         let (tx2, rx2) = channel::<int>();
-        let (tx3, rx3) = channel::<()>();
-        let tx4 = tx3.clone();
-        spawn(move|| {
+        let t1 = Thread::spawn(move|| {
             tx1.send(());
             for _ in range(0i, 40) {
                 assert_eq!(rx2.recv(), 1);
             }
-            tx3.send(());
         });
         rx1.recv();
-        spawn(move|| {
+        let t2 = Thread::spawn(move|| {
             for _ in range(0i, 40) {
                 tx2.send(1);
             }
-            tx4.send(());
         });
-        rx3.recv();
-        rx3.recv();
+        t1.join().ok().unwrap();
+        t2.join().ok().unwrap();
     }
 
     #[test]
     fn recv_from_outside_runtime() {
         let (tx, rx) = channel::<int>();
-        let (dtx, drx) = channel();
-        spawn(move|| {
+        let t = Thread::spawn(move|| {
             for _ in range(0i, 40) {
                 assert_eq!(rx.recv(), 1);
             }
-            dtx.send(());
         });
         for _ in range(0u, 40) {
             tx.send(1);
         }
-        drx.recv();
+        t.join().ok().unwrap();
     }
 
     #[test]
     fn no_runtime() {
         let (tx1, rx1) = channel::<int>();
         let (tx2, rx2) = channel::<int>();
-        let (tx3, rx3) = channel::<()>();
-        let tx4 = tx3.clone();
-        spawn(move|| {
+        let t1 = Thread::spawn(move|| {
             assert_eq!(rx1.recv(), 1);
             tx2.send(2);
-            tx4.send(());
         });
-        spawn(move|| {
+        let t2 = Thread::spawn(move|| {
             tx1.send(1);
             assert_eq!(rx2.recv(), 2);
-            tx3.send(());
         });
-        rx3.recv();
-        rx3.recv();
+        t1.join().ok().unwrap();
+        t2.join().ok().unwrap();
     }
 
-    test! { fn oneshot_single_thread_close_port_first() {
+    #[test]
+    fn oneshot_single_thread_close_port_first() {
         // Simple test of closing without sending
         let (_tx, rx) = channel::<int>();
         drop(rx);
-    } }
+    }
 
-    test! { fn oneshot_single_thread_close_chan_first() {
+    #[test]
+    fn oneshot_single_thread_close_chan_first() {
         // Simple test of closing without sending
         let (tx, _rx) = channel::<int>();
         drop(tx);
-    } }
+    }
 
-    test! { fn oneshot_single_thread_send_port_close() {
+    #[test]
+    #[should_fail]
+    fn oneshot_single_thread_send_port_close() {
         // Testing that the sender cleans up the payload if receiver is closed
         let (tx, rx) = channel::<Box<int>>();
         drop(rx);
         tx.send(box 0);
-    } #[should_fail] }
+    }
 
-    test! { fn oneshot_single_thread_recv_chan_close() {
+    #[test]
+    fn oneshot_single_thread_recv_chan_close() {
         // Receiving on a closed chan will panic
         let res = Thread::spawn(move|| {
             let (tx, rx) = channel::<int>();
@@ -1280,129 +1295,142 @@ fn no_runtime() {
         }).join();
         // What is our res?
         assert!(res.is_err());
-    } }
+    }
 
-    test! { fn oneshot_single_thread_send_then_recv() {
+    #[test]
+    fn oneshot_single_thread_send_then_recv() {
         let (tx, rx) = channel::<Box<int>>();
         tx.send(box 10);
         assert!(rx.recv() == box 10);
-    } }
+    }
 
-    test! { fn oneshot_single_thread_try_send_open() {
+    #[test]
+    fn oneshot_single_thread_try_send_open() {
         let (tx, rx) = channel::<int>();
         assert!(tx.send_opt(10).is_ok());
         assert!(rx.recv() == 10);
-    } }
+    }
 
-    test! { fn oneshot_single_thread_try_send_closed() {
+    #[test]
+    fn oneshot_single_thread_try_send_closed() {
         let (tx, rx) = channel::<int>();
         drop(rx);
         assert!(tx.send_opt(10).is_err());
-    } }
+    }
 
-    test! { fn oneshot_single_thread_try_recv_open() {
+    #[test]
+    fn oneshot_single_thread_try_recv_open() {
         let (tx, rx) = channel::<int>();
         tx.send(10);
         assert!(rx.recv_opt() == Ok(10));
-    } }
+    }
 
-    test! { fn oneshot_single_thread_try_recv_closed() {
+    #[test]
+    fn oneshot_single_thread_try_recv_closed() {
         let (tx, rx) = channel::<int>();
         drop(tx);
         assert!(rx.recv_opt() == Err(()));
-    } }
+    }
 
-    test! { fn oneshot_single_thread_peek_data() {
+    #[test]
+    fn oneshot_single_thread_peek_data() {
         let (tx, rx) = channel::<int>();
         assert_eq!(rx.try_recv(), Err(Empty));
         tx.send(10);
         assert_eq!(rx.try_recv(), Ok(10));
-    } }
+    }
 
-    test! { fn oneshot_single_thread_peek_close() {
+    #[test]
+    fn oneshot_single_thread_peek_close() {
         let (tx, rx) = channel::<int>();
         drop(tx);
         assert_eq!(rx.try_recv(), Err(Disconnected));
         assert_eq!(rx.try_recv(), Err(Disconnected));
-    } }
+    }
 
-    test! { fn oneshot_single_thread_peek_open() {
+    #[test]
+    fn oneshot_single_thread_peek_open() {
         let (_tx, rx) = channel::<int>();
         assert_eq!(rx.try_recv(), Err(Empty));
-    } }
+    }
 
-    test! { fn oneshot_multi_task_recv_then_send() {
+    #[test]
+    fn oneshot_multi_task_recv_then_send() {
         let (tx, rx) = channel::<Box<int>>();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             assert!(rx.recv() == box 10);
         });
 
         tx.send(box 10);
-    } }
+    }
 
-    test! { fn oneshot_multi_task_recv_then_close() {
+    #[test]
+    fn oneshot_multi_task_recv_then_close() {
         let (tx, rx) = channel::<Box<int>>();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             drop(tx);
         });
         let res = Thread::spawn(move|| {
             assert!(rx.recv() == box 10);
         }).join();
         assert!(res.is_err());
-    } }
+    }
 
-    test! { fn oneshot_multi_thread_close_stress() {
+    #[test]
+    fn oneshot_multi_thread_close_stress() {
         for _ in range(0, stress_factor()) {
             let (tx, rx) = channel::<int>();
-            spawn(move|| {
+            let _t = Thread::spawn(move|| {
                 drop(rx);
             });
             drop(tx);
         }
-    } }
+    }
 
-    test! { fn oneshot_multi_thread_send_close_stress() {
+    #[test]
+    fn oneshot_multi_thread_send_close_stress() {
         for _ in range(0, stress_factor()) {
             let (tx, rx) = channel::<int>();
-            spawn(move|| {
+            let _t = Thread::spawn(move|| {
                 drop(rx);
             });
             let _ = Thread::spawn(move|| {
                 tx.send(1);
             }).join();
         }
-    } }
+    }
 
-    test! { fn oneshot_multi_thread_recv_close_stress() {
+    #[test]
+    fn oneshot_multi_thread_recv_close_stress() {
         for _ in range(0, stress_factor()) {
             let (tx, rx) = channel::<int>();
-            spawn(move|| {
+            Thread::spawn(move|| {
                 let res = Thread::spawn(move|| {
                     rx.recv();
                 }).join();
                 assert!(res.is_err());
-            });
-            spawn(move|| {
-                spawn(move|| {
+            }).detach();
+            let _t = Thread::spawn(move|| {
+                Thread::spawn(move|| {
                     drop(tx);
-                });
+                }).detach();
             });
         }
-    } }
+    }
 
-    test! { fn oneshot_multi_thread_send_recv_stress() {
+    #[test]
+    fn oneshot_multi_thread_send_recv_stress() {
         for _ in range(0, stress_factor()) {
             let (tx, rx) = channel();
-            spawn(move|| {
+            let _t = Thread::spawn(move|| {
                 tx.send(box 10i);
             });
-            spawn(move|| {
-                assert!(rx.recv() == box 10i);
-            });
+            assert!(rx.recv() == box 10i);
         }
-    } }
+    }
 
-    test! { fn stream_send_recv_stress() {
+    #[test]
+    fn stream_send_recv_stress() {
         for _ in range(0, stress_factor()) {
             let (tx, rx) = channel();
 
@@ -1412,50 +1440,53 @@ fn no_runtime() {
             fn send(tx: Sender<Box<int>>, i: int) {
                 if i == 10 { return }
 
-                spawn(move|| {
+                Thread::spawn(move|| {
                     tx.send(box i);
                     send(tx, i + 1);
-                });
+                }).detach();
             }
 
             fn recv(rx: Receiver<Box<int>>, i: int) {
                 if i == 10 { return }
 
-                spawn(move|| {
+                Thread::spawn(move|| {
                     assert!(rx.recv() == box i);
                     recv(rx, i + 1);
-                });
+                }).detach();
             }
         }
-    } }
+    }
 
-    test! { fn recv_a_lot() {
+    #[test]
+    fn recv_a_lot() {
         // Regression test that we don't run out of stack in scheduler context
         let (tx, rx) = channel();
         for _ in range(0i, 10000) { tx.send(()); }
         for _ in range(0i, 10000) { rx.recv(); }
-    } }
+    }
 
-    test! { fn shared_chan_stress() {
+    #[test]
+    fn shared_chan_stress() {
         let (tx, rx) = channel();
         let total = stress_factor() + 100;
         for _ in range(0, total) {
             let tx = tx.clone();
-            spawn(move|| {
+            Thread::spawn(move|| {
                 tx.send(());
-            });
+            }).detach();
         }
 
         for _ in range(0, total) {
             rx.recv();
         }
-    } }
+    }
 
-    test! { fn test_nested_recv_iter() {
+    #[test]
+    fn test_nested_recv_iter() {
         let (tx, rx) = channel::<int>();
         let (total_tx, total_rx) = channel::<int>();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut acc = 0;
             for x in rx.iter() {
                 acc += x;
@@ -1468,13 +1499,14 @@ fn recv(rx: Receiver<Box<int>>, i: int) {
         tx.send(2);
         drop(tx);
         assert_eq!(total_rx.recv(), 6);
-    } }
+    }
 
-    test! { fn test_recv_iter_break() {
+    #[test]
+    fn test_recv_iter_break() {
         let (tx, rx) = channel::<int>();
         let (count_tx, count_rx) = channel();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut count = 0;
             for x in rx.iter() {
                 if count >= 3 {
@@ -1492,13 +1524,14 @@ fn recv(rx: Receiver<Box<int>>, i: int) {
         let _ = tx.send_opt(2);
         drop(tx);
         assert_eq!(count_rx.recv(), 4);
-    } }
+    }
 
-    test! { fn try_recv_states() {
+    #[test]
+    fn try_recv_states() {
         let (tx1, rx1) = channel::<int>();
         let (tx2, rx2) = channel::<()>();
         let (tx3, rx3) = channel::<()>();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             rx2.recv();
             tx1.send(1);
             tx3.send(());
@@ -1515,14 +1548,15 @@ fn recv(rx: Receiver<Box<int>>, i: int) {
         tx2.send(());
         rx3.recv();
         assert_eq!(rx1.try_recv(), Err(Disconnected));
-    } }
+    }
 
     // This bug used to end up in a livelock inside of the Receiver destructor
     // because the internal state of the Shared packet was corrupted
-    test! { fn destroy_upgraded_shared_port_when_sender_still_active() {
+    #[test]
+    fn destroy_upgraded_shared_port_when_sender_still_active() {
         let (tx, rx) = channel();
         let (tx2, rx2) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             rx.recv(); // wait on a oneshot
             drop(rx);  // destroy a shared
             tx2.send(());
@@ -1537,13 +1571,16 @@ fn recv(rx: Receiver<Box<int>>, i: int) {
 
         // wait for the child task to exit before we exit
         rx2.recv();
-    }}
+    }
 }
 
 #[cfg(test)]
 mod sync_tests {
-    use prelude::*;
+    use prelude::v1::*;
     use os;
+    use thread::Thread;
+    use super::*;
+    use str::from_str;
 
     pub fn stress_factor() -> uint {
         match os::getenv("RUST_TEST_STRESS") {
@@ -1552,108 +1589,128 @@ pub fn stress_factor() -> uint {
         }
     }
 
-    test! { fn smoke() {
+    #[test]
+    fn smoke() {
         let (tx, rx) = sync_channel::<int>(1);
         tx.send(1);
         assert_eq!(rx.recv(), 1);
-    } }
+    }
 
-    test! { fn drop_full() {
+    #[test]
+    fn drop_full() {
         let (tx, _rx) = sync_channel(1);
         tx.send(box 1i);
-    } }
+    }
 
-    test! { fn smoke_shared() {
+    #[test]
+    fn smoke_shared() {
         let (tx, rx) = sync_channel::<int>(1);
         tx.send(1);
         assert_eq!(rx.recv(), 1);
         let tx = tx.clone();
         tx.send(1);
         assert_eq!(rx.recv(), 1);
-    } }
+    }
 
-    test! { fn smoke_threads() {
+    #[test]
+    fn smoke_threads() {
         let (tx, rx) = sync_channel::<int>(0);
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             tx.send(1);
         });
         assert_eq!(rx.recv(), 1);
-    } }
+    }
 
-    test! { fn smoke_port_gone() {
+    #[test]
+    #[should_fail]
+    fn smoke_port_gone() {
         let (tx, rx) = sync_channel::<int>(0);
         drop(rx);
         tx.send(1);
-    } #[should_fail] }
+    }
 
-    test! { fn smoke_shared_port_gone2() {
+    #[test]
+    #[should_fail]
+    fn smoke_shared_port_gone2() {
         let (tx, rx) = sync_channel::<int>(0);
         drop(rx);
         let tx2 = tx.clone();
         drop(tx);
         tx2.send(1);
-    } #[should_fail] }
+    }
 
-    test! { fn port_gone_concurrent() {
+    #[test]
+    #[should_fail]
+    fn port_gone_concurrent() {
         let (tx, rx) = sync_channel::<int>(0);
-        spawn(move|| {
+        Thread::spawn(move|| {
             rx.recv();
-        });
+        }).detach();
         loop { tx.send(1) }
-    } #[should_fail] }
+    }
 
-    test! { fn port_gone_concurrent_shared() {
+    #[test]
+    #[should_fail]
+    fn port_gone_concurrent_shared() {
         let (tx, rx) = sync_channel::<int>(0);
         let tx2 = tx.clone();
-        spawn(move|| {
+        Thread::spawn(move|| {
             rx.recv();
-        });
+        }).detach();
         loop {
             tx.send(1);
             tx2.send(1);
         }
-    } #[should_fail] }
+    }
 
-    test! { fn smoke_chan_gone() {
+    #[test]
+    #[should_fail]
+    fn smoke_chan_gone() {
         let (tx, rx) = sync_channel::<int>(0);
         drop(tx);
         rx.recv();
-    } #[should_fail] }
+    }
 
-    test! { fn smoke_chan_gone_shared() {
+    #[test]
+    #[should_fail]
+    fn smoke_chan_gone_shared() {
         let (tx, rx) = sync_channel::<()>(0);
         let tx2 = tx.clone();
         drop(tx);
         drop(tx2);
         rx.recv();
-    } #[should_fail] }
+    }
 
-    test! { fn chan_gone_concurrent() {
+    #[test]
+    #[should_fail]
+    fn chan_gone_concurrent() {
         let (tx, rx) = sync_channel::<int>(0);
-        spawn(move|| {
+        Thread::spawn(move|| {
             tx.send(1);
             tx.send(1);
-        });
+        }).detach();
         loop { rx.recv(); }
-    } #[should_fail] }
+    }
 
-    test! { fn stress() {
+    #[test]
+    fn stress() {
         let (tx, rx) = sync_channel::<int>(0);
-        spawn(move|| {
+        Thread::spawn(move|| {
             for _ in range(0u, 10000) { tx.send(1); }
-        });
+        }).detach();
         for _ in range(0u, 10000) {
             assert_eq!(rx.recv(), 1);
         }
-    } }
+    }
 
-    test! { fn stress_shared() {
+    #[test]
+    fn stress_shared() {
         static AMT: uint = 1000;
         static NTHREADS: uint = 8;
         let (tx, rx) = sync_channel::<int>(0);
         let (dtx, drx) = sync_channel::<()>(0);
 
-        spawn(move|| {
+        Thread::spawn(move|| {
             for _ in range(0, AMT * NTHREADS) {
                 assert_eq!(rx.recv(), 1);
             }
@@ -1662,38 +1719,43 @@ pub fn stress_factor() -> uint {
                 _ => {}
             }
             dtx.send(());
-        });
+        }).detach();
 
         for _ in range(0, NTHREADS) {
             let tx = tx.clone();
-            spawn(move|| {
+            Thread::spawn(move|| {
                 for _ in range(0, AMT) { tx.send(1); }
-            });
+            }).detach();
         }
         drop(tx);
         drx.recv();
-    } }
+    }
 
-    test! { fn oneshot_single_thread_close_port_first() {
+    #[test]
+    fn oneshot_single_thread_close_port_first() {
         // Simple test of closing without sending
         let (_tx, rx) = sync_channel::<int>(0);
         drop(rx);
-    } }
+    }
 
-    test! { fn oneshot_single_thread_close_chan_first() {
+    #[test]
+    fn oneshot_single_thread_close_chan_first() {
         // Simple test of closing without sending
         let (tx, _rx) = sync_channel::<int>(0);
         drop(tx);
-    } }
+    }
 
-    test! { fn oneshot_single_thread_send_port_close() {
+    #[test]
+    #[should_fail]
+    fn oneshot_single_thread_send_port_close() {
         // Testing that the sender cleans up the payload if receiver is closed
         let (tx, rx) = sync_channel::<Box<int>>(0);
         drop(rx);
         tx.send(box 0);
-    } #[should_fail] }
+    }
 
-    test! { fn oneshot_single_thread_recv_chan_close() {
+    #[test]
+    fn oneshot_single_thread_recv_chan_close() {
         // Receiving on a closed chan will panic
         let res = Thread::spawn(move|| {
             let (tx, rx) = sync_channel::<int>(0);
@@ -1702,134 +1764,148 @@ pub fn stress_factor() -> uint {
         }).join();
         // What is our res?
         assert!(res.is_err());
-    } }
+    }
 
-    test! { fn oneshot_single_thread_send_then_recv() {
+    #[test]
+    fn oneshot_single_thread_send_then_recv() {
         let (tx, rx) = sync_channel::<Box<int>>(1);
         tx.send(box 10);
         assert!(rx.recv() == box 10);
-    } }
+    }
 
-    test! { fn oneshot_single_thread_try_send_open() {
+    #[test]
+    fn oneshot_single_thread_try_send_open() {
         let (tx, rx) = sync_channel::<int>(1);
         assert_eq!(tx.try_send(10), Ok(()));
         assert!(rx.recv() == 10);
-    } }
+    }
 
-    test! { fn oneshot_single_thread_try_send_closed() {
+    #[test]
+    fn oneshot_single_thread_try_send_closed() {
         let (tx, rx) = sync_channel::<int>(0);
         drop(rx);
         assert_eq!(tx.try_send(10), Err(RecvDisconnected(10)));
-    } }
+    }
 
-    test! { fn oneshot_single_thread_try_send_closed2() {
+    #[test]
+    fn oneshot_single_thread_try_send_closed2() {
         let (tx, _rx) = sync_channel::<int>(0);
         assert_eq!(tx.try_send(10), Err(Full(10)));
-    } }
+    }
 
-    test! { fn oneshot_single_thread_try_recv_open() {
+    #[test]
+    fn oneshot_single_thread_try_recv_open() {
         let (tx, rx) = sync_channel::<int>(1);
         tx.send(10);
         assert!(rx.recv_opt() == Ok(10));
-    } }
+    }
 
-    test! { fn oneshot_single_thread_try_recv_closed() {
+    #[test]
+    fn oneshot_single_thread_try_recv_closed() {
         let (tx, rx) = sync_channel::<int>(0);
         drop(tx);
         assert!(rx.recv_opt() == Err(()));
-    } }
+    }
 
-    test! { fn oneshot_single_thread_peek_data() {
+    #[test]
+    fn oneshot_single_thread_peek_data() {
         let (tx, rx) = sync_channel::<int>(1);
         assert_eq!(rx.try_recv(), Err(Empty));
         tx.send(10);
         assert_eq!(rx.try_recv(), Ok(10));
-    } }
+    }
 
-    test! { fn oneshot_single_thread_peek_close() {
+    #[test]
+    fn oneshot_single_thread_peek_close() {
         let (tx, rx) = sync_channel::<int>(0);
         drop(tx);
         assert_eq!(rx.try_recv(), Err(Disconnected));
         assert_eq!(rx.try_recv(), Err(Disconnected));
-    } }
+    }
 
-    test! { fn oneshot_single_thread_peek_open() {
+    #[test]
+    fn oneshot_single_thread_peek_open() {
         let (_tx, rx) = sync_channel::<int>(0);
         assert_eq!(rx.try_recv(), Err(Empty));
-    } }
+    }
 
-    test! { fn oneshot_multi_task_recv_then_send() {
+    #[test]
+    fn oneshot_multi_task_recv_then_send() {
         let (tx, rx) = sync_channel::<Box<int>>(0);
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             assert!(rx.recv() == box 10);
         });
 
         tx.send(box 10);
-    } }
+    }
 
-    test! { fn oneshot_multi_task_recv_then_close() {
+    #[test]
+    fn oneshot_multi_task_recv_then_close() {
         let (tx, rx) = sync_channel::<Box<int>>(0);
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             drop(tx);
         });
         let res = Thread::spawn(move|| {
             assert!(rx.recv() == box 10);
         }).join();
         assert!(res.is_err());
-    } }
+    }
 
-    test! { fn oneshot_multi_thread_close_stress() {
+    #[test]
+    fn oneshot_multi_thread_close_stress() {
         for _ in range(0, stress_factor()) {
             let (tx, rx) = sync_channel::<int>(0);
-            spawn(move|| {
+            let _t = Thread::spawn(move|| {
                 drop(rx);
             });
             drop(tx);
         }
-    } }
+    }
 
-    test! { fn oneshot_multi_thread_send_close_stress() {
+    #[test]
+    fn oneshot_multi_thread_send_close_stress() {
         for _ in range(0, stress_factor()) {
             let (tx, rx) = sync_channel::<int>(0);
-            spawn(move|| {
+            let _t = Thread::spawn(move|| {
                 drop(rx);
             });
             let _ = Thread::spawn(move || {
                 tx.send(1);
             }).join();
         }
-    } }
+    }
 
-    test! { fn oneshot_multi_thread_recv_close_stress() {
+    #[test]
+    fn oneshot_multi_thread_recv_close_stress() {
         for _ in range(0, stress_factor()) {
             let (tx, rx) = sync_channel::<int>(0);
-            spawn(move|| {
+            let _t = Thread::spawn(move|| {
                 let res = Thread::spawn(move|| {
                     rx.recv();
                 }).join();
                 assert!(res.is_err());
             });
-            spawn(move|| {
-                spawn(move|| {
+            let _t = Thread::spawn(move|| {
+                Thread::spawn(move|| {
                     drop(tx);
-                });
+                }).detach();
             });
         }
-    } }
+    }
 
-    test! { fn oneshot_multi_thread_send_recv_stress() {
+    #[test]
+    fn oneshot_multi_thread_send_recv_stress() {
         for _ in range(0, stress_factor()) {
             let (tx, rx) = sync_channel::<Box<int>>(0);
-            spawn(move|| {
+            let _t = Thread::spawn(move|| {
                 tx.send(box 10i);
             });
-            spawn(move|| {
-                assert!(rx.recv() == box 10i);
-            });
+            assert!(rx.recv() == box 10i);
         }
-    } }
+    }
 
-    test! { fn stream_send_recv_stress() {
+    #[test]
+    fn stream_send_recv_stress() {
         for _ in range(0, stress_factor()) {
             let (tx, rx) = sync_channel::<Box<int>>(0);
 
@@ -1839,50 +1915,53 @@ pub fn stress_factor() -> uint {
             fn send(tx: SyncSender<Box<int>>, i: int) {
                 if i == 10 { return }
 
-                spawn(move|| {
+                Thread::spawn(move|| {
                     tx.send(box i);
                     send(tx, i + 1);
-                });
+                }).detach();
             }
 
             fn recv(rx: Receiver<Box<int>>, i: int) {
                 if i == 10 { return }
 
-                spawn(move|| {
+                Thread::spawn(move|| {
                     assert!(rx.recv() == box i);
                     recv(rx, i + 1);
-                });
+                }).detach();
             }
         }
-    } }
+    }
 
-    test! { fn recv_a_lot() {
+    #[test]
+    fn recv_a_lot() {
         // Regression test that we don't run out of stack in scheduler context
         let (tx, rx) = sync_channel(10000);
         for _ in range(0u, 10000) { tx.send(()); }
         for _ in range(0u, 10000) { rx.recv(); }
-    } }
+    }
 
-    test! { fn shared_chan_stress() {
+    #[test]
+    fn shared_chan_stress() {
         let (tx, rx) = sync_channel(0);
         let total = stress_factor() + 100;
         for _ in range(0, total) {
             let tx = tx.clone();
-            spawn(move|| {
+            Thread::spawn(move|| {
                 tx.send(());
-            });
+            }).detach();
         }
 
         for _ in range(0, total) {
             rx.recv();
         }
-    } }
+    }
 
-    test! { fn test_nested_recv_iter() {
+    #[test]
+    fn test_nested_recv_iter() {
         let (tx, rx) = sync_channel::<int>(0);
         let (total_tx, total_rx) = sync_channel::<int>(0);
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut acc = 0;
             for x in rx.iter() {
                 acc += x;
@@ -1895,13 +1974,14 @@ fn recv(rx: Receiver<Box<int>>, i: int) {
         tx.send(2);
         drop(tx);
         assert_eq!(total_rx.recv(), 6);
-    } }
+    }
 
-    test! { fn test_recv_iter_break() {
+    #[test]
+    fn test_recv_iter_break() {
         let (tx, rx) = sync_channel::<int>(0);
         let (count_tx, count_rx) = sync_channel(0);
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut count = 0;
             for x in rx.iter() {
                 if count >= 3 {
@@ -1919,13 +1999,14 @@ fn recv(rx: Receiver<Box<int>>, i: int) {
         let _ = tx.try_send(2);
         drop(tx);
         assert_eq!(count_rx.recv(), 4);
-    } }
+    }
 
-    test! { fn try_recv_states() {
+    #[test]
+    fn try_recv_states() {
         let (tx1, rx1) = sync_channel::<int>(1);
         let (tx2, rx2) = sync_channel::<()>(1);
         let (tx3, rx3) = sync_channel::<()>(1);
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             rx2.recv();
             tx1.send(1);
             tx3.send(());
@@ -1942,14 +2023,15 @@ fn recv(rx: Receiver<Box<int>>, i: int) {
         tx2.send(());
         rx3.recv();
         assert_eq!(rx1.try_recv(), Err(Disconnected));
-    } }
+    }
 
     // This bug used to end up in a livelock inside of the Receiver destructor
     // because the internal state of the Shared packet was corrupted
-    test! { fn destroy_upgraded_shared_port_when_sender_still_active() {
+    #[test]
+    fn destroy_upgraded_shared_port_when_sender_still_active() {
         let (tx, rx) = sync_channel::<()>(0);
         let (tx2, rx2) = sync_channel::<()>(0);
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             rx.recv(); // wait on a oneshot
             drop(rx);  // destroy a shared
             tx2.send(());
@@ -1964,78 +2046,77 @@ fn recv(rx: Receiver<Box<int>>, i: int) {
 
         // wait for the child task to exit before we exit
         rx2.recv();
-    } }
+    }
 
-    test! { fn send_opt1() {
+    #[test]
+    fn send_opt1() {
         let (tx, rx) = sync_channel::<int>(0);
-        spawn(move|| { rx.recv(); });
+        let _t = Thread::spawn(move|| { rx.recv(); });
         assert_eq!(tx.send_opt(1), Ok(()));
-    } }
+    }
 
-    test! { fn send_opt2() {
+    #[test]
+    fn send_opt2() {
         let (tx, rx) = sync_channel::<int>(0);
-        spawn(move|| { drop(rx); });
+        let _t = Thread::spawn(move|| { drop(rx); });
         assert_eq!(tx.send_opt(1), Err(1));
-    } }
+    }
 
-    test! { fn send_opt3() {
+    #[test]
+    fn send_opt3() {
         let (tx, rx) = sync_channel::<int>(1);
         assert_eq!(tx.send_opt(1), Ok(()));
-        spawn(move|| { drop(rx); });
+        let _t = Thread::spawn(move|| { drop(rx); });
         assert_eq!(tx.send_opt(1), Err(1));
-    } }
+    }
 
-    test! { fn send_opt4() {
+    #[test]
+    fn send_opt4() {
         let (tx, rx) = sync_channel::<int>(0);
         let tx2 = tx.clone();
         let (done, donerx) = channel();
         let done2 = done.clone();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             assert_eq!(tx.send_opt(1), Err(1));
             done.send(());
         });
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             assert_eq!(tx2.send_opt(2), Err(2));
             done2.send(());
         });
         drop(rx);
         donerx.recv();
         donerx.recv();
-    } }
+    }
 
-    test! { fn try_send1() {
+    #[test]
+    fn try_send1() {
         let (tx, _rx) = sync_channel::<int>(0);
         assert_eq!(tx.try_send(1), Err(Full(1)));
-    } }
+    }
 
-    test! { fn try_send2() {
+    #[test]
+    fn try_send2() {
         let (tx, _rx) = sync_channel::<int>(1);
         assert_eq!(tx.try_send(1), Ok(()));
         assert_eq!(tx.try_send(1), Err(Full(1)));
-    } }
+    }
 
-    test! { fn try_send3() {
+    #[test]
+    fn try_send3() {
         let (tx, rx) = sync_channel::<int>(1);
         assert_eq!(tx.try_send(1), Ok(()));
         drop(rx);
         assert_eq!(tx.try_send(1), Err(RecvDisconnected(1)));
-    } }
-
-    test! { fn try_send4() {
-        let (tx, rx) = sync_channel::<int>(0);
-        spawn(move|| {
-            for _ in range(0u, 1000) { Thread::yield_now(); }
-            assert_eq!(tx.try_send(1), Ok(()));
-        });
-        assert_eq!(rx.recv(), 1);
-    } #[ignore(reason = "flaky on libnative")] }
+    }
 
-    test! { fn issue_15761() {
+    #[test]
+    fn issue_15761() {
         fn repro() {
             let (tx1, rx1) = sync_channel::<()>(3);
             let (tx2, rx2) = sync_channel::<()>(3);
 
-            spawn(move|| {
+            let _t = Thread::spawn(move|| {
                 rx1.recv();
                 tx2.try_send(()).unwrap();
             });
@@ -2047,5 +2128,5 @@ fn repro() {
         for _ in range(0u, 100) {
             repro()
         }
-    } }
+    }
 }
index cddef236664343332998cf53dbaebd6358449a76..d1b6d0d697cf28e89318de5b71dbeea0aabd0901 100644 (file)
@@ -153,11 +153,12 @@ fn drop(&mut self) {
 
 #[cfg(test)]
 mod tests {
-    use prelude::*;
-
-    use alloc::arc::Arc;
+    use prelude::v1::*;
 
+    use comm::channel;
     use super::{Queue, Data, Empty, Inconsistent};
+    use sync::Arc;
+    use thread::Thread;
 
     #[test]
     fn test_full() {
@@ -181,12 +182,12 @@ fn test() {
         for _ in range(0, nthreads) {
             let tx = tx.clone();
             let q = q.clone();
-            spawn(move|| {
+            Thread::spawn(move|| {
                 for i in range(0, nmsgs) {
                     q.push(i);
                 }
                 tx.send(());
-            });
+            }).detach();
         }
 
         let mut i = 0u;
index 690b5861c2239d94b4db607c2b6f7b196e057b6b..a0a8e40b4150ecbf0aa5d558dfb4755ebd0fc422 100644 (file)
@@ -27,6 +27,8 @@
 //! # Example
 //!
 //! ```rust
+//! use std::comm::channel;
+//!
 //! let (tx1, rx1) = channel();
 //! let (tx2, rx2) = channel();
 //!
@@ -335,9 +337,10 @@ fn next(&mut self) -> Option<*mut Handle<'static, ()>> {
 #[cfg(test)]
 #[allow(unused_imports)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
 
-    use super::*;
+    use comm::*;
+    use thread::Thread;
 
     // Don't use the libstd version so we can pull in the right Select structure
     // (std::comm points at the wrong one)
@@ -357,7 +360,8 @@ macro_rules! select {
         })
     }
 
-    test! { fn smoke() {
+    #[test]
+    fn smoke() {
         let (tx1, rx1) = channel::<int>();
         let (tx2, rx2) = channel::<int>();
         tx1.send(1);
@@ -379,9 +383,10 @@ macro_rules! select {
         select! {
             bar = rx2.recv_opt() => { assert_eq!(bar, Err(())); }
         }
-    } }
+    }
 
-    test! { fn smoke2() {
+    #[test]
+    fn smoke2() {
         let (_tx1, rx1) = channel::<int>();
         let (_tx2, rx2) = channel::<int>();
         let (_tx3, rx3) = channel::<int>();
@@ -395,9 +400,10 @@ macro_rules! select {
             _foo = rx4.recv() => { panic!("4") },
             foo = rx5.recv() => { assert_eq!(foo, 4); }
         }
-    } }
+    }
 
-    test! { fn closed() {
+    #[test]
+    fn closed() {
         let (_tx1, rx1) = channel::<int>();
         let (tx2, rx2) = channel::<int>();
         drop(tx2);
@@ -406,14 +412,15 @@ macro_rules! select {
             _a1 = rx1.recv_opt() => { panic!() },
             a2 = rx2.recv_opt() => { assert_eq!(a2, Err(())); }
         }
-    } }
+    }
 
-    test! { fn unblocks() {
+    #[test]
+    fn unblocks() {
         let (tx1, rx1) = channel::<int>();
         let (_tx2, rx2) = channel::<int>();
         let (tx3, rx3) = channel::<int>();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             for _ in range(0u, 20) { Thread::yield_now(); }
             tx1.send(1);
             rx3.recv();
@@ -429,14 +436,15 @@ macro_rules! select {
             a = rx1.recv_opt() => { assert_eq!(a, Err(())); },
             _b = rx2.recv() => { panic!() }
         }
-    } }
+    }
 
-    test! { fn both_ready() {
+    #[test]
+    fn both_ready() {
         let (tx1, rx1) = channel::<int>();
         let (tx2, rx2) = channel::<int>();
         let (tx3, rx3) = channel::<()>();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             for _ in range(0u, 20) { Thread::yield_now(); }
             tx1.send(1);
             tx2.send(2);
@@ -454,15 +462,16 @@ macro_rules! select {
         assert_eq!(rx1.try_recv(), Err(Empty));
         assert_eq!(rx2.try_recv(), Err(Empty));
         tx3.send(());
-    } }
+    }
 
-    test! { fn stress() {
+    #[test]
+    fn stress() {
         static AMT: int = 10000;
         let (tx1, rx1) = channel::<int>();
         let (tx2, rx2) = channel::<int>();
         let (tx3, rx3) = channel::<()>();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             for i in range(0, AMT) {
                 if i % 2 == 0 {
                     tx1.send(i);
@@ -480,14 +489,15 @@ macro_rules! select {
             }
             tx3.send(());
         }
-    } }
+    }
 
-    test! { fn cloning() {
+    #[test]
+    fn cloning() {
         let (tx1, rx1) = channel::<int>();
         let (_tx2, rx2) = channel::<int>();
         let (tx3, rx3) = channel::<()>();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             rx3.recv();
             tx1.clone();
             assert_eq!(rx3.try_recv(), Err(Empty));
@@ -501,14 +511,15 @@ macro_rules! select {
             _i2 = rx2.recv() => panic!()
         }
         tx3.send(());
-    } }
+    }
 
-    test! { fn cloning2() {
+    #[test]
+    fn cloning2() {
         let (tx1, rx1) = channel::<int>();
         let (_tx2, rx2) = channel::<int>();
         let (tx3, rx3) = channel::<()>();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             rx3.recv();
             tx1.clone();
             assert_eq!(rx3.try_recv(), Err(Empty));
@@ -522,13 +533,14 @@ macro_rules! select {
             _i2 = rx2.recv() => panic!()
         }
         tx3.send(());
-    } }
+    }
 
-    test! { fn cloning3() {
+    #[test]
+    fn cloning3() {
         let (tx1, rx1) = channel::<()>();
         let (tx2, rx2) = channel::<()>();
         let (tx3, rx3) = channel::<()>();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let s = Select::new();
             let mut h1 = s.handle(&rx1);
             let mut h2 = s.handle(&rx2);
@@ -542,44 +554,49 @@ macro_rules! select {
         drop(tx1.clone());
         tx2.send(());
         rx3.recv();
-    } }
+    }
 
-    test! { fn preflight1() {
+    #[test]
+    fn preflight1() {
         let (tx, rx) = channel();
         tx.send(());
         select! {
             () = rx.recv() => {}
         }
-    } }
+    }
 
-    test! { fn preflight2() {
+    #[test]
+    fn preflight2() {
         let (tx, rx) = channel();
         tx.send(());
         tx.send(());
         select! {
             () = rx.recv() => {}
         }
-    } }
+    }
 
-    test! { fn preflight3() {
+    #[test]
+    fn preflight3() {
         let (tx, rx) = channel();
         drop(tx.clone());
         tx.send(());
         select! {
             () = rx.recv() => {}
         }
-    } }
+    }
 
-    test! { fn preflight4() {
+    #[test]
+    fn preflight4() {
         let (tx, rx) = channel();
         tx.send(());
         let s = Select::new();
         let mut h = s.handle(&rx);
         unsafe { h.add(); }
         assert_eq!(s.wait2(false), h.id);
-    } }
+    }
 
-    test! { fn preflight5() {
+    #[test]
+    fn preflight5() {
         let (tx, rx) = channel();
         tx.send(());
         tx.send(());
@@ -587,9 +604,10 @@ macro_rules! select {
         let mut h = s.handle(&rx);
         unsafe { h.add(); }
         assert_eq!(s.wait2(false), h.id);
-    } }
+    }
 
-    test! { fn preflight6() {
+    #[test]
+    fn preflight6() {
         let (tx, rx) = channel();
         drop(tx.clone());
         tx.send(());
@@ -597,18 +615,20 @@ macro_rules! select {
         let mut h = s.handle(&rx);
         unsafe { h.add(); }
         assert_eq!(s.wait2(false), h.id);
-    } }
+    }
 
-    test! { fn preflight7() {
+    #[test]
+    fn preflight7() {
         let (tx, rx) = channel::<()>();
         drop(tx);
         let s = Select::new();
         let mut h = s.handle(&rx);
         unsafe { h.add(); }
         assert_eq!(s.wait2(false), h.id);
-    } }
+    }
 
-    test! { fn preflight8() {
+    #[test]
+    fn preflight8() {
         let (tx, rx) = channel();
         tx.send(());
         drop(tx);
@@ -617,9 +637,10 @@ macro_rules! select {
         let mut h = s.handle(&rx);
         unsafe { h.add(); }
         assert_eq!(s.wait2(false), h.id);
-    } }
+    }
 
-    test! { fn preflight9() {
+    #[test]
+    fn preflight9() {
         let (tx, rx) = channel();
         drop(tx.clone());
         tx.send(());
@@ -629,12 +650,13 @@ macro_rules! select {
         let mut h = s.handle(&rx);
         unsafe { h.add(); }
         assert_eq!(s.wait2(false), h.id);
-    } }
+    }
 
-    test! { fn oneshot_data_waiting() {
+    #[test]
+    fn oneshot_data_waiting() {
         let (tx1, rx1) = channel();
         let (tx2, rx2) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             select! {
                 () = rx1.recv() => {}
             }
@@ -644,16 +666,17 @@ macro_rules! select {
         for _ in range(0u, 100) { Thread::yield_now() }
         tx1.send(());
         rx2.recv();
-    } }
+    }
 
-    test! { fn stream_data_waiting() {
+    #[test]
+    fn stream_data_waiting() {
         let (tx1, rx1) = channel();
         let (tx2, rx2) = channel();
         tx1.send(());
         tx1.send(());
         rx1.recv();
         rx1.recv();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             select! {
                 () = rx1.recv() => {}
             }
@@ -663,15 +686,16 @@ macro_rules! select {
         for _ in range(0u, 100) { Thread::yield_now() }
         tx1.send(());
         rx2.recv();
-    } }
+    }
 
-    test! { fn shared_data_waiting() {
+    #[test]
+    fn shared_data_waiting() {
         let (tx1, rx1) = channel();
         let (tx2, rx2) = channel();
         drop(tx1.clone());
         tx1.send(());
         rx1.recv();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             select! {
                 () = rx1.recv() => {}
             }
@@ -681,32 +705,35 @@ macro_rules! select {
         for _ in range(0u, 100) { Thread::yield_now() }
         tx1.send(());
         rx2.recv();
-    } }
+    }
 
-    test! { fn sync1() {
+    #[test]
+    fn sync1() {
         let (tx, rx) = sync_channel::<int>(1);
         tx.send(1);
         select! {
             n = rx.recv() => { assert_eq!(n, 1); }
         }
-    } }
+    }
 
-    test! { fn sync2() {
+    #[test]
+    fn sync2() {
         let (tx, rx) = sync_channel::<int>(0);
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             for _ in range(0u, 100) { Thread::yield_now() }
             tx.send(1);
         });
         select! {
             n = rx.recv() => { assert_eq!(n, 1); }
         }
-    } }
+    }
 
-    test! { fn sync3() {
+    #[test]
+    fn sync3() {
         let (tx1, rx1) = sync_channel::<int>(0);
         let (tx2, rx2): (Sender<int>, Receiver<int>) = channel();
-        spawn(move|| { tx1.send(1); });
-        spawn(move|| { tx2.send(2); });
+        let _t = Thread::spawn(move|| { tx1.send(1); });
+        let _t = Thread::spawn(move|| { tx2.send(2); });
         select! {
             n = rx1.recv() => {
                 assert_eq!(n, 1);
@@ -717,5 +744,5 @@ macro_rules! select {
                 assert_eq!(rx1.recv(), 1);
             }
         }
-    } }
+    }
 }
index becb78063aeb5ae82ae9c87676879c0f3d678686..1e2f5222d8b1a19f4cd88914d565303da9e7278c 100644 (file)
@@ -240,10 +240,12 @@ fn drop(&mut self) {
 
 #[cfg(test)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
 
     use sync::Arc;
     use super::Queue;
+    use thread::Thread;
+    use comm::channel;
 
     #[test]
     fn smoke() {
@@ -320,7 +322,7 @@ unsafe fn stress_bound(bound: uint) {
 
             let (tx, rx) = channel();
             let q2 = q.clone();
-            spawn(move|| {
+            let _t = Thread::spawn(move|| {
                 for _ in range(0u, 100000) {
                     loop {
                         match q2.pop() {
index 368abe7cb1244a55bf818df512377a80fe69fa35..ecfe2d15ae1c26deb2ab5d5adb65fdf13323e27a 100644 (file)
@@ -15,7 +15,9 @@
 #![experimental]
 #![allow(missing_docs)]
 
-use prelude::*;
+use prelude::v1::*;
+
+use c_str::ToCStr;
 use mem;
 use os;
 use str;
@@ -146,7 +148,7 @@ pub unsafe fn symbol<T>(&self, symbol: &str) -> Result<*mut T, String> {
 #[cfg(all(test, not(target_os = "ios")))]
 mod test {
     use super::*;
-    use prelude::*;
+    use prelude::v1::*;
     use libc;
     use mem;
 
@@ -202,8 +204,8 @@ fn test_errors_do_not_crash() {
 pub mod dl {
     use self::Rtld::*;
 
-    use prelude::*;
-    use c_str::CString;
+    use prelude::v1::*;
+    use c_str::{CString, ToCStr};
     use libc;
     use ptr;
 
index 9a46a500a4b4799199ccc73edbdaf75106aef405..32e1922ae74fd62a92261c95f5fb0451da6088db 100644 (file)
@@ -78,7 +78,7 @@
 //! }
 //! ```
 
-use prelude::*;
+use prelude::v1::*;
 
 use str::Utf8Error;
 use string::{FromUtf8Error, FromUtf16Error};
index 7010eae6dba0dba03e285e707d6232fc07451661..3d98b6ec40e493fd8777ab187b730643c4499da1 100644 (file)
@@ -10,7 +10,7 @@
 
 #![experimental]
 
-use prelude::*;
+use prelude::v1::*;
 
 use any::{Any, AnyRefExt};
 use cell::RefCell;
index c5405601048cea55b9f88eb1eed3804d6474e297..57dc62084e33ee29c28953085bd7abcc921358f5 100644 (file)
@@ -410,7 +410,7 @@ fn flush(&mut self) -> IoResult<()> {
 mod test {
     extern crate test;
     use io;
-    use prelude::*;
+    use prelude::v1::*;
     use super::*;
     use super::super::{IoResult, EndOfFile};
     use super::super::mem::MemReader;
index 077f75e2edd6f9e77bf88c55dd93d9bbb8f9c49c..ebadecfebb5222059f1c173098bc1d5b406ef8b7 100644 (file)
@@ -23,6 +23,7 @@
 /// # Example
 ///
 /// ```
+/// use std::comm::channel;
 /// use std::io::ChanReader;
 ///
 /// let (tx, rx) = channel();
@@ -114,6 +115,7 @@ fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
 ///
 /// ```
 /// # #![allow(unused_must_use)]
+/// use std::comm::channel;
 /// use std::io::ChanWriter;
 ///
 /// let (tx, rx) = channel();
@@ -154,7 +156,9 @@ fn write(&mut self, buf: &[u8]) -> IoResult<()> {
 
 #[cfg(test)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
+
+    use comm::channel;
     use super::*;
     use io;
     use thread::Thread;
index 51e09e547e3eef4fb77642fffd8b5344940a1ee9..94dba1f7cc70a1f539d7e78f783ce5b7afb149e1 100644 (file)
@@ -175,7 +175,7 @@ pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 {
 
 #[cfg(test)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
     use io;
     use io::{MemReader, BytesReader};
 
@@ -507,7 +507,7 @@ fn test_u64_from_be_bytes() {
 mod bench {
     extern crate test;
 
-    use prelude::*;
+    use prelude::v1::*;
     use self::test::Bencher;
 
     // why is this a macro? wouldn't an inlined function work just as well?
index 7fa6ebc6e3bac0837633496428d44f9f6721d7ab..7fa5b3cfac7e254e2c4cd5075a3653dd2ab3efed 100644 (file)
@@ -819,7 +819,7 @@ fn access_string(access: FileAccess) -> &'static str {
 #[allow(unused_variables)]
 #[allow(unused_mut)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
     use io::{SeekSet, SeekCur, SeekEnd, Read, Open, ReadWrite, FileType};
     use io;
     use str;
index f8ea373f8f456794abda187489bbb7a42200e619..ad921e43c0cc58b4be584052b2ad1a5303a14803 100644 (file)
@@ -399,9 +399,10 @@ fn fill_buf(&mut self) -> IoResult<&[u8]> {
 #[cfg(test)]
 mod test {
     extern crate "test" as test_crate;
+    use prelude::v1::*;
+
     use super::*;
-    use io::{SeekSet, SeekCur, SeekEnd, Reader, Writer, Seek};
-    use prelude::{Ok, Err, range,  Vec, Buffer,  AsSlice, SliceExt, IteratorExt, CloneSliceExt};
+    use io::{SeekSet, SeekCur, SeekEnd};
     use io;
     use self::test_crate::Bencher;
 
index e8b852ee492b95c02e42ae4bc47daf4bf7d19449..9eb860d7ec3a3966bedda7e44df54cb2649507b6 100644 (file)
 use int;
 use iter::{Iterator, IteratorExt};
 use mem::transmute;
-use ops::{BitOr, BitXor, BitAnd, Sub, Not, FnOnce};
+use ops::FnOnce;
 use option::Option;
 use option::Option::{Some, None};
 use os;
@@ -1918,8 +1918,8 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 #[cfg(test)]
 mod tests {
     use self::BadReaderBehavior::*;
-    use super::{IoResult, Reader, MemReader, NoProgress, InvalidInput, Writer};
-    use prelude::{Ok, Vec, Buffer, CloneSliceExt};
+    use super::{IoResult, MemReader, NoProgress, InvalidInput};
+    use prelude::v1::*;
     use uint;
 
     #[deriving(Clone, PartialEq, Show)]
index e8fbb12118199f9912c291ea409c6dd2dcaa1dc7..d86cb841f96cebc3e04f3e09ec205088a41e1589 100644 (file)
@@ -112,7 +112,7 @@ fn lookup(hostname: Option<&str>, servname: Option<&str>, hint: Option<Hint>)
 // permission without help of apk
 #[cfg(all(test, not(target_os = "android")))]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
     use super::*;
     use io::net::ip::*;
 
index 49ab9ddb92487a6c24038e54a910f2bbd830ac98..7ce1d1fc13bcb8bdd67a6b0b06e8b90c9f461157 100644 (file)
@@ -544,7 +544,7 @@ fn to_socket_addr_all(&self) -> IoResult<Vec<SocketAddr>> {
 
 #[cfg(test)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
     use super::*;
     use str::FromStr;
 
index 6ce66c3273bd6c2acb64ab0af2377de344bb3952..95147c52a69108120655880ecffd38b060068dca 100644 (file)
 
 #![allow(missing_docs)]
 
-use prelude::*;
+use prelude::v1::*;
 
+use c_str::ToCStr;
 use io::{Listener, Acceptor, IoResult, TimedOut, standard_error};
-use time::Duration;
-
-use sys::pipe::UnixStream as UnixStreamImp;
-use sys::pipe::UnixListener as UnixListenerImp;
 use sys::pipe::UnixAcceptor as UnixAcceptorImp;
+use sys::pipe::UnixListener as UnixListenerImp;
+use sys::pipe::UnixStream as UnixStreamImp;
+use time::Duration;
 
 use sys_common;
 
@@ -264,13 +264,17 @@ fn as_inner(&self) -> &UnixAcceptorImp {
 }
 
 #[cfg(test)]
-#[allow(experimental)]
 mod tests {
-    use super::*;
-    use io::*;
-    use io::test::*;
-    use prelude::{Ok, Err, spawn, range, drop,  Some, None, channel, Send, FnOnce, Clone};
+    use prelude::v1::*;
+
+    use comm::channel;
     use io::fs::PathExtensions;
+    use io::{EndOfFile, TimedOut, ShortWrite, IoError, ConnectionReset};
+    use io::{NotConnected, BrokenPipe, OtherIoError, FileNotFound, InvalidInput};
+    use io::{PermissionDenied, Acceptor, Listener};
+    use io::test::*;
+    use super::*;
+    use thread::Thread;
     use time::Duration;
 
     pub fn smalltest<F,G>(server: F, client: G)
@@ -282,7 +286,7 @@ pub fn smalltest<F,G>(server: F, client: G)
 
         let mut acceptor = UnixListener::bind(&path1).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             match UnixStream::connect(&path2) {
                 Ok(c) => client(c),
                 Err(e) => panic!("failed connect: {}", e),
@@ -377,7 +381,7 @@ fn accept_lots() {
             Err(e) => panic!("failed listen: {}", e),
         };
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             for _ in range(0u, times) {
                 let mut stream = UnixStream::connect(&path2);
                 match stream.write(&[100]) {
@@ -411,7 +415,7 @@ fn unix_clone_smoke() {
         let addr = next_test_unix();
         let mut acceptor = UnixListener::bind(&addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut s = UnixStream::connect(&addr);
             let mut buf = [0, 0];
             debug!("client reading");
@@ -427,7 +431,7 @@ fn unix_clone_smoke() {
 
         let (tx1, rx1) = channel();
         let (tx2, rx2) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut s2 = s2;
             rx1.recv();
             debug!("writer writing");
@@ -450,7 +454,7 @@ fn unix_clone_two_read() {
         let (tx1, rx) = channel();
         let tx2 = tx1.clone();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut s = UnixStream::connect(&addr);
             s.write(&[1]).unwrap();
             rx.recv();
@@ -462,7 +466,7 @@ fn unix_clone_two_read() {
         let s2 = s1.clone();
 
         let (done, rx) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut s2 = s2;
             let mut buf = [0, 0];
             s2.read(&mut buf).unwrap();
@@ -481,7 +485,7 @@ fn unix_clone_two_write() {
         let addr = next_test_unix();
         let mut acceptor = UnixListener::bind(&addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut s = UnixStream::connect(&addr);
             let buf = &mut [0, 1];
             s.read(buf).unwrap();
@@ -492,7 +496,7 @@ fn unix_clone_two_write() {
         let s2 = s1.clone();
 
         let (tx, rx) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut s2 = s2;
             s2.write(&[1]).unwrap();
             tx.send(());
@@ -539,7 +543,7 @@ fn accept_timeout() {
         // continue to receive any pending connections.
         let (tx, rx) = channel();
         let addr2 = addr.clone();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             tx.send(UnixStream::connect(&addr2).unwrap());
         });
         let l = rx.recv();
@@ -557,7 +561,7 @@ fn accept_timeout() {
         // Unset the timeout and make sure that this always blocks.
         a.set_timeout(None);
         let addr2 = addr.clone();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             drop(UnixStream::connect(&addr2).unwrap());
         });
         a.accept().unwrap();
@@ -595,11 +599,11 @@ fn close_readwrite_smoke() {
         let addr = next_test_unix();
         let a = UnixListener::bind(&addr).listen().unwrap();
         let (_tx, rx) = channel::<()>();
-        spawn(move|| {
+        Thread::spawn(move|| {
             let mut a = a;
             let _s = a.accept().unwrap();
             let _ = rx.recv_opt();
-        });
+        }).detach();
 
         let mut b = [0];
         let mut s = UnixStream::connect(&addr).unwrap();
@@ -632,16 +636,16 @@ fn close_read_wakes_up() {
         let addr = next_test_unix();
         let a = UnixListener::bind(&addr).listen().unwrap();
         let (_tx, rx) = channel::<()>();
-        spawn(move|| {
+        Thread::spawn(move|| {
             let mut a = a;
             let _s = a.accept().unwrap();
             let _ = rx.recv_opt();
-        });
+        }).detach();
 
         let mut s = UnixStream::connect(&addr).unwrap();
         let s2 = s.clone();
         let (tx, rx) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut s2 = s2;
             assert!(s2.read(&mut [0]).is_err());
             tx.send(());
@@ -658,12 +662,12 @@ fn readwrite_timeouts() {
         let addr = next_test_unix();
         let mut a = UnixListener::bind(&addr).listen().unwrap();
         let (tx, rx) = channel::<()>();
-        spawn(move|| {
+        Thread::spawn(move|| {
             let mut s = UnixStream::connect(&addr).unwrap();
             rx.recv();
             assert!(s.write(&[0]).is_ok());
             let _ = rx.recv_opt();
-        });
+        }).detach();
 
         let mut s = a.accept().unwrap();
         s.set_timeout(Some(20));
@@ -696,7 +700,7 @@ fn read_timeouts() {
         let addr = next_test_unix();
         let mut a = UnixListener::bind(&addr).listen().unwrap();
         let (tx, rx) = channel::<()>();
-        spawn(move|| {
+        Thread::spawn(move|| {
             let mut s = UnixStream::connect(&addr).unwrap();
             rx.recv();
             let mut amt = 0;
@@ -707,7 +711,7 @@ fn read_timeouts() {
                 }
             }
             let _ = rx.recv_opt();
-        });
+        }).detach();
 
         let mut s = a.accept().unwrap();
         s.set_read_timeout(Some(20));
@@ -725,12 +729,12 @@ fn write_timeouts() {
         let addr = next_test_unix();
         let mut a = UnixListener::bind(&addr).listen().unwrap();
         let (tx, rx) = channel::<()>();
-        spawn(move|| {
+        Thread::spawn(move|| {
             let mut s = UnixStream::connect(&addr).unwrap();
             rx.recv();
             assert!(s.write(&[0]).is_ok());
             let _ = rx.recv_opt();
-        });
+        }).detach();
 
         let mut s = a.accept().unwrap();
         s.set_write_timeout(Some(20));
@@ -752,17 +756,17 @@ fn timeout_concurrent_read() {
         let addr = next_test_unix();
         let mut a = UnixListener::bind(&addr).listen().unwrap();
         let (tx, rx) = channel::<()>();
-        spawn(move|| {
+        Thread::spawn(move|| {
             let mut s = UnixStream::connect(&addr).unwrap();
             rx.recv();
             assert!(s.write(&[0]).is_ok());
             let _ = rx.recv_opt();
-        });
+        }).detach();
 
         let mut s = a.accept().unwrap();
         let s2 = s.clone();
         let (tx2, rx2) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut s2 = s2;
             assert!(s2.read(&mut [0]).is_ok());
             tx2.send(());
@@ -784,10 +788,10 @@ fn clone_accept_smoke() {
         let mut a2 = a.clone();
 
         let addr2 = addr.clone();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let _ = UnixStream::connect(&addr2);
         });
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let _ = UnixStream::connect(&addr);
         });
 
@@ -807,14 +811,14 @@ fn clone_accept_concurrent() {
         let (tx, rx) = channel();
         let tx2 = tx.clone();
 
-        spawn(move|| { let mut a = a; tx.send(a.accept()) });
-        spawn(move|| { let mut a = a2; tx2.send(a.accept()) });
+        let _t = Thread::spawn(move|| { let mut a = a; tx.send(a.accept()) });
+        let _t = Thread::spawn(move|| { let mut a = a2; tx2.send(a.accept()) });
 
         let addr2 = addr.clone();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let _ = UnixStream::connect(&addr2);
         });
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let _ = UnixStream::connect(&addr);
         });
 
@@ -840,7 +844,7 @@ fn close_accept_concurrent() {
         let mut a2 = a.clone();
 
         let (tx, rx) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut a = a;
             tx.send(a.accept());
         });
index 826f492d85d3135f061963b85c23c9b820080e66..4492e679cd5f1a1425e80f8dbd69fc4b57fa4721 100644 (file)
@@ -141,7 +141,7 @@ pub fn set_keepalive(&mut self, delay_in_seconds: Option<uint>) -> IoResult<()>
     /// let mut stream = TcpStream::connect("127.0.0.1:34254").unwrap();
     /// let stream2 = stream.clone();
     ///
-    /// Thread::spawn(move|| {
+    /// let _t = Thread::spawn(move|| {
     ///     // close this stream after one second
     ///     timer::sleep(Duration::seconds(1));
     ///     let mut stream = stream2;
@@ -282,10 +282,10 @@ fn as_inner(&self) -> &TcpStreamImp {
 /// use std::io::{Acceptor, Listener};
 /// use std::thread::Thread;
 ///
-/// let listener = TcpListener::bind("127.0.0.1:80");
+/// let listener = TcpListener::bind("127.0.0.1:80").unwrap();
 ///
 /// // bind the listener to the specified address
-/// let mut acceptor = listener.listen();
+/// let mut acceptor = listener.listen().unwrap();
 ///
 /// fn handle_client(mut stream: TcpStream) {
 ///     // ...
@@ -423,7 +423,7 @@ impl TcpAcceptor {
     /// let mut a = TcpListener::bind("127.0.0.1:8482").listen().unwrap();
     /// let a2 = a.clone();
     ///
-    /// Thread::spawn(move|| {
+    /// let _t = Thread::spawn(move|| {
     ///     let mut a2 = a2;
     ///     for socket in a2.incoming() {
     ///         match socket {
@@ -482,14 +482,16 @@ fn as_inner(&self) -> &TcpAcceptorImp {
 #[cfg(test)]
 #[allow(experimental)]
 mod test {
+    use prelude::v1::*;
+
+    use comm::channel;
+    use thread::Thread;
     use io::net::tcp::*;
     use io::net::ip::*;
     use io::{EndOfFile, TimedOut, IoError, ShortWrite, OtherIoError, ConnectionAborted};
     use io::{ConnectionRefused, ConnectionReset, BrokenPipe, NotConnected};
     use io::{PermissionDenied, Listener, Acceptor};
     use io::test::*;
-    use prelude::{Ok, Err, spawn, range, drop, Some, None, channel, Clone};
-    use prelude::{Reader, Writer, IteratorExt};
 
     // FIXME #11530 this fails on android because tests are run as root
     #[cfg_attr(any(windows, target_os = "android"), ignore)]
@@ -515,7 +517,7 @@ fn listen_ip4_localhost() {
         let listener = TcpListener::bind(socket_addr);
         let mut acceptor = listener.listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut stream = TcpStream::connect(("localhost", socket_addr.port));
             stream.write(&[144]).unwrap();
         });
@@ -531,7 +533,7 @@ fn connect_localhost() {
         let addr = next_test_ip4();
         let mut acceptor = TcpListener::bind(addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut stream = TcpStream::connect(("localhost", addr.port));
             stream.write(&[64]).unwrap();
         });
@@ -547,7 +549,7 @@ fn connect_ip4_loopback() {
         let addr = next_test_ip4();
         let mut acceptor = TcpListener::bind(addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut stream = TcpStream::connect(("127.0.0.1", addr.port));
             stream.write(&[44]).unwrap();
         });
@@ -563,7 +565,7 @@ fn connect_ip6_loopback() {
         let addr = next_test_ip6();
         let mut acceptor = TcpListener::bind(addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut stream = TcpStream::connect(("::1", addr.port));
             stream.write(&[66]).unwrap();
         });
@@ -579,7 +581,7 @@ fn smoke_test_ip4() {
         let addr = next_test_ip4();
         let mut acceptor = TcpListener::bind(addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut stream = TcpStream::connect(addr);
             stream.write(&[99]).unwrap();
         });
@@ -595,7 +597,7 @@ fn smoke_test_ip6() {
         let addr = next_test_ip6();
         let mut acceptor = TcpListener::bind(addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut stream = TcpStream::connect(addr);
             stream.write(&[99]).unwrap();
         });
@@ -611,7 +613,7 @@ fn read_eof_ip4() {
         let addr = next_test_ip4();
         let mut acceptor = TcpListener::bind(addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let _stream = TcpStream::connect(addr);
             // Close
         });
@@ -627,7 +629,7 @@ fn read_eof_ip6() {
         let addr = next_test_ip6();
         let mut acceptor = TcpListener::bind(addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let _stream = TcpStream::connect(addr);
             // Close
         });
@@ -643,7 +645,7 @@ fn read_eof_twice_ip4() {
         let addr = next_test_ip4();
         let mut acceptor = TcpListener::bind(addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let _stream = TcpStream::connect(addr);
             // Close
         });
@@ -667,7 +669,7 @@ fn read_eof_twice_ip6() {
         let addr = next_test_ip6();
         let mut acceptor = TcpListener::bind(addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let _stream = TcpStream::connect(addr);
             // Close
         });
@@ -692,7 +694,7 @@ fn write_close_ip4() {
         let mut acceptor = TcpListener::bind(addr).listen();
 
         let (tx, rx) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             drop(TcpStream::connect(addr));
             tx.send(());
         });
@@ -717,7 +719,7 @@ fn write_close_ip6() {
         let mut acceptor = TcpListener::bind(addr).listen();
 
         let (tx, rx) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             drop(TcpStream::connect(addr));
             tx.send(());
         });
@@ -742,7 +744,7 @@ fn multiple_connect_serial_ip4() {
         let max = 10u;
         let mut acceptor = TcpListener::bind(addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             for _ in range(0, max) {
                 let mut stream = TcpStream::connect(addr);
                 stream.write(&[99]).unwrap();
@@ -762,7 +764,7 @@ fn multiple_connect_serial_ip6() {
         let max = 10u;
         let mut acceptor = TcpListener::bind(addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             for _ in range(0, max) {
                 let mut stream = TcpStream::connect(addr);
                 stream.write(&[99]).unwrap();
@@ -782,11 +784,11 @@ fn multiple_connect_interleaved_greedy_schedule_ip4() {
         static MAX: int = 10;
         let acceptor = TcpListener::bind(addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut acceptor = acceptor;
             for (i, stream) in acceptor.incoming().enumerate().take(MAX as uint) {
                 // Start another task to handle the connection
-                spawn(move|| {
+                let _t = Thread::spawn(move|| {
                     let mut stream = stream;
                     let mut buf = [0];
                     stream.read(&mut buf).unwrap();
@@ -801,7 +803,7 @@ fn multiple_connect_interleaved_greedy_schedule_ip4() {
         fn connect(i: int, addr: SocketAddr) {
             if i == MAX { return }
 
-            spawn(move|| {
+            let _t = Thread::spawn(move|| {
                 debug!("connecting");
                 let mut stream = TcpStream::connect(addr);
                 // Connect again before writing
@@ -818,11 +820,11 @@ fn multiple_connect_interleaved_greedy_schedule_ip6() {
         static MAX: int = 10;
         let acceptor = TcpListener::bind(addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut acceptor = acceptor;
             for (i, stream) in acceptor.incoming().enumerate().take(MAX as uint) {
                 // Start another task to handle the connection
-                spawn(move|| {
+                let _t = Thread::spawn(move|| {
                     let mut stream = stream;
                     let mut buf = [0];
                     stream.read(&mut buf).unwrap();
@@ -837,7 +839,7 @@ fn multiple_connect_interleaved_greedy_schedule_ip6() {
         fn connect(i: int, addr: SocketAddr) {
             if i == MAX { return }
 
-            spawn(move|| {
+            let _t = Thread::spawn(move|| {
                 debug!("connecting");
                 let mut stream = TcpStream::connect(addr);
                 // Connect again before writing
@@ -854,11 +856,11 @@ fn multiple_connect_interleaved_lazy_schedule_ip4() {
         let addr = next_test_ip4();
         let acceptor = TcpListener::bind(addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut acceptor = acceptor;
             for stream in acceptor.incoming().take(MAX as uint) {
                 // Start another task to handle the connection
-                spawn(move|| {
+                let _t = Thread::spawn(move|| {
                     let mut stream = stream;
                     let mut buf = [0];
                     stream.read(&mut buf).unwrap();
@@ -873,7 +875,7 @@ fn multiple_connect_interleaved_lazy_schedule_ip4() {
         fn connect(i: int, addr: SocketAddr) {
             if i == MAX { return }
 
-            spawn(move|| {
+            let _t = Thread::spawn(move|| {
                 debug!("connecting");
                 let mut stream = TcpStream::connect(addr);
                 // Connect again before writing
@@ -890,11 +892,11 @@ fn multiple_connect_interleaved_lazy_schedule_ip6() {
         let addr = next_test_ip6();
         let acceptor = TcpListener::bind(addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut acceptor = acceptor;
             for stream in acceptor.incoming().take(MAX as uint) {
                 // Start another task to handle the connection
-                spawn(move|| {
+                let _t = Thread::spawn(move|| {
                     let mut stream = stream;
                     let mut buf = [0];
                     stream.read(&mut buf).unwrap();
@@ -909,7 +911,7 @@ fn multiple_connect_interleaved_lazy_schedule_ip6() {
         fn connect(i: int, addr: SocketAddr) {
             if i == MAX { return }
 
-            spawn(move|| {
+            let _t = Thread::spawn(move|| {
                 debug!("connecting");
                 let mut stream = TcpStream::connect(addr);
                 // Connect again before writing
@@ -932,7 +934,7 @@ pub fn socket_name(addr: SocketAddr) {
 
     pub fn peer_name(addr: SocketAddr) {
         let acceptor = TcpListener::bind(addr).listen();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut acceptor = acceptor;
             acceptor.accept().unwrap();
         });
@@ -967,7 +969,7 @@ fn socket_and_peer_name_ip6() {
     fn partial_read() {
         let addr = next_test_ip4();
         let (tx, rx) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut srv = TcpListener::bind(addr).listen().unwrap();
             tx.send(());
             let mut cl = srv.accept().unwrap();
@@ -1004,7 +1006,7 @@ fn fast_rebind() {
         let addr = next_test_ip4();
         let (tx, rx) = channel();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             rx.recv();
             let _stream = TcpStream::connect(addr).unwrap();
             // Close
@@ -1029,7 +1031,7 @@ fn tcp_clone_smoke() {
         let addr = next_test_ip4();
         let mut acceptor = TcpListener::bind(addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut s = TcpStream::connect(addr);
             let mut buf = [0, 0];
             assert_eq!(s.read(&mut buf), Ok(1));
@@ -1042,7 +1044,7 @@ fn tcp_clone_smoke() {
 
         let (tx1, rx1) = channel();
         let (tx2, rx2) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut s2 = s2;
             rx1.recv();
             s2.write(&[1]).unwrap();
@@ -1061,7 +1063,7 @@ fn tcp_clone_two_read() {
         let (tx1, rx) = channel();
         let tx2 = tx1.clone();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut s = TcpStream::connect(addr);
             s.write(&[1]).unwrap();
             rx.recv();
@@ -1073,7 +1075,7 @@ fn tcp_clone_two_read() {
         let s2 = s1.clone();
 
         let (done, rx) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut s2 = s2;
             let mut buf = [0, 0];
             s2.read(&mut buf).unwrap();
@@ -1092,7 +1094,7 @@ fn tcp_clone_two_write() {
         let addr = next_test_ip4();
         let mut acceptor = TcpListener::bind(addr).listen();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut s = TcpStream::connect(addr);
             let mut buf = [0, 1];
             s.read(&mut buf).unwrap();
@@ -1103,7 +1105,7 @@ fn tcp_clone_two_write() {
         let s2 = s1.clone();
 
         let (done, rx) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut s2 = s2;
             s2.write(&[1]).unwrap();
             done.send(());
@@ -1117,7 +1119,7 @@ fn tcp_clone_two_write() {
     fn shutdown_smoke() {
         let addr = next_test_ip4();
         let a = TcpListener::bind(addr).unwrap().listen();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut a = a;
             let mut c = a.accept().unwrap();
             assert_eq!(c.read_to_end(), Ok(vec!()));
@@ -1151,7 +1153,7 @@ fn accept_timeout() {
         //        flakiness.
         if !cfg!(target_os = "freebsd") {
             let (tx, rx) = channel();
-            spawn(move|| {
+            let _t = Thread::spawn(move|| {
                 tx.send(TcpStream::connect(addr).unwrap());
             });
             let _l = rx.recv();
@@ -1168,7 +1170,7 @@ fn accept_timeout() {
 
         // Unset the timeout and make sure that this always blocks.
         a.set_timeout(None);
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             drop(TcpStream::connect(addr).unwrap());
         });
         a.accept().unwrap();
@@ -1179,11 +1181,11 @@ fn close_readwrite_smoke() {
         let addr = next_test_ip4();
         let a = TcpListener::bind(addr).listen().unwrap();
         let (_tx, rx) = channel::<()>();
-        spawn(move|| {
+        Thread::spawn(move|| {
             let mut a = a;
             let _s = a.accept().unwrap();
             let _ = rx.recv_opt();
-        });
+        }).detach();
 
         let mut b = [0];
         let mut s = TcpStream::connect(addr).unwrap();
@@ -1216,16 +1218,16 @@ fn close_read_wakes_up() {
         let addr = next_test_ip4();
         let a = TcpListener::bind(addr).listen().unwrap();
         let (_tx, rx) = channel::<()>();
-        spawn(move|| {
+        Thread::spawn(move|| {
             let mut a = a;
             let _s = a.accept().unwrap();
             let _ = rx.recv_opt();
-        });
+        }).detach();
 
         let mut s = TcpStream::connect(addr).unwrap();
         let s2 = s.clone();
         let (tx, rx) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut s2 = s2;
             assert!(s2.read(&mut [0]).is_err());
             tx.send(());
@@ -1242,12 +1244,12 @@ fn readwrite_timeouts() {
         let addr = next_test_ip6();
         let mut a = TcpListener::bind(addr).listen().unwrap();
         let (tx, rx) = channel::<()>();
-        spawn(move|| {
+        Thread::spawn(move|| {
             let mut s = TcpStream::connect(addr).unwrap();
             rx.recv();
             assert!(s.write(&[0]).is_ok());
             let _ = rx.recv_opt();
-        });
+        }).detach();
 
         let mut s = a.accept().unwrap();
         s.set_timeout(Some(20));
@@ -1275,7 +1277,7 @@ fn read_timeouts() {
         let addr = next_test_ip6();
         let mut a = TcpListener::bind(addr).listen().unwrap();
         let (tx, rx) = channel::<()>();
-        spawn(move|| {
+        Thread::spawn(move|| {
             let mut s = TcpStream::connect(addr).unwrap();
             rx.recv();
             let mut amt = 0;
@@ -1286,7 +1288,7 @@ fn read_timeouts() {
                 }
             }
             let _ = rx.recv_opt();
-        });
+        }).detach();
 
         let mut s = a.accept().unwrap();
         s.set_read_timeout(Some(20));
@@ -1304,12 +1306,12 @@ fn write_timeouts() {
         let addr = next_test_ip6();
         let mut a = TcpListener::bind(addr).listen().unwrap();
         let (tx, rx) = channel::<()>();
-        spawn(move|| {
+        Thread::spawn(move|| {
             let mut s = TcpStream::connect(addr).unwrap();
             rx.recv();
             assert!(s.write(&[0]).is_ok());
             let _ = rx.recv_opt();
-        });
+        }).detach();
 
         let mut s = a.accept().unwrap();
         s.set_write_timeout(Some(20));
@@ -1332,17 +1334,17 @@ fn timeout_concurrent_read() {
         let addr = next_test_ip6();
         let mut a = TcpListener::bind(addr).listen().unwrap();
         let (tx, rx) = channel::<()>();
-        spawn(move|| {
+        Thread::spawn(move|| {
             let mut s = TcpStream::connect(addr).unwrap();
             rx.recv();
             assert_eq!(s.write(&[0]), Ok(()));
             let _ = rx.recv_opt();
-        });
+        }).detach();
 
         let mut s = a.accept().unwrap();
         let s2 = s.clone();
         let (tx2, rx2) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut s2 = s2;
             assert_eq!(s2.read(&mut [0]), Ok(1));
             tx2.send(());
@@ -1365,7 +1367,7 @@ fn clone_while_reading() {
         let (tx, rx) = channel();
         let (txdone, rxdone) = channel();
         let txdone2 = txdone.clone();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut tcp = TcpStream::connect(addr).unwrap();
             rx.recv();
             tcp.write_u8(0).unwrap();
@@ -1376,7 +1378,7 @@ fn clone_while_reading() {
         let tcp = accept.accept().unwrap();
         let tcp2 = tcp.clone();
         let txdone3 = txdone.clone();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut tcp2 = tcp2;
             tcp2.read_u8().unwrap();
             txdone3.send(());
@@ -1402,10 +1404,10 @@ fn clone_accept_smoke() {
         let mut a = l.listen().unwrap();
         let mut a2 = a.clone();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let _ = TcpStream::connect(addr);
         });
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let _ = TcpStream::connect(addr);
         });
 
@@ -1423,13 +1425,13 @@ fn clone_accept_concurrent() {
         let (tx, rx) = channel();
         let tx2 = tx.clone();
 
-        spawn(move|| { let mut a = a; tx.send(a.accept()) });
-        spawn(move|| { let mut a = a2; tx2.send(a.accept()) });
+        let _t = Thread::spawn(move|| { let mut a = a; tx.send(a.accept()) });
+        let _t = Thread::spawn(move|| { let mut a = a2; tx2.send(a.accept()) });
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let _ = TcpStream::connect(addr);
         });
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let _ = TcpStream::connect(addr);
         });
 
@@ -1455,7 +1457,7 @@ fn close_accept_concurrent() {
         let mut a2 = a.clone();
 
         let (tx, rx) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut a = a;
             tx.send(a.accept());
         });
index 11c2f956c355259d922bba4c5eecceab72f55bf0..2e366c7e27ba7c6fa1683c8a8f45098f60313b02 100644 (file)
@@ -248,11 +248,14 @@ fn write(&mut self, buf: &[u8]) -> IoResult<()> {
 #[cfg(test)]
 #[allow(experimental)]
 mod test {
-    use super::*;
+    use prelude::v1::*;
+
+    use comm::channel;
     use io::net::ip::*;
-    use io::{ShortWrite, IoError, TimedOut, PermissionDenied};
+    use io::{IoError, ShortWrite, TimedOut, PermissionDenied};
     use io::test::*;
-    use prelude::{Ok, Err, spawn, range, drop, Some, None, channel, Clone, Reader, Writer};
+    use super::*;
+    use thread::Thread;
 
     // FIXME #11530 this fails on android because tests are run as root
     #[cfg_attr(any(windows, target_os = "android"), ignore)]
@@ -272,7 +275,7 @@ fn socket_smoke_test_ip4() {
         let (tx1, rx1) = channel();
         let (tx2, rx2) = channel();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             match UdpSocket::bind(client_ip) {
                 Ok(ref mut client) => {
                     rx1.recv();
@@ -307,7 +310,7 @@ fn socket_smoke_test_ip6() {
         let client_ip = next_test_ip6();
         let (tx, rx) = channel::<()>();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             match UdpSocket::bind(client_ip) {
                 Ok(ref mut client) => {
                     rx.recv();
@@ -343,8 +346,8 @@ fn stream_smoke_test_ip4() {
         let (tx1, rx1) = channel();
         let (tx2, rx2) = channel();
 
-        spawn(move|| {
-            let send_as = |&: ip, val: &[u8]| {
+        let _t = Thread::spawn(move|| {
+            let send_as = |&:ip, val: &[u8]| {
                 match UdpSocket::bind(ip) {
                     Ok(client) => {
                         let client = box client;
@@ -387,7 +390,7 @@ fn stream_smoke_test_ip6() {
         let (tx1, rx1) = channel();
         let (tx2, rx2) = channel();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             match UdpSocket::bind(client_ip) {
                 Ok(client) => {
                     let client = box client;
@@ -449,7 +452,7 @@ fn udp_clone_smoke() {
         let mut sock1 = UdpSocket::bind(addr1).unwrap();
         let sock2 = UdpSocket::bind(addr2).unwrap();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut sock2 = sock2;
             let mut buf = [0, 0];
             assert_eq!(sock2.recv_from(&mut buf), Ok((1, addr1)));
@@ -461,7 +464,7 @@ fn udp_clone_smoke() {
 
         let (tx1, rx1) = channel();
         let (tx2, rx2) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut sock3 = sock3;
             rx1.recv();
             sock3.send_to(&[1], addr2).unwrap();
@@ -482,7 +485,7 @@ fn udp_clone_two_read() {
         let (tx1, rx) = channel();
         let tx2 = tx1.clone();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut sock2 = sock2;
             sock2.send_to(&[1], addr1).unwrap();
             rx.recv();
@@ -493,7 +496,7 @@ fn udp_clone_two_read() {
         let sock3 = sock1.clone();
 
         let (done, rx) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut sock3 = sock3;
             let mut buf = [0, 0];
             sock3.recv_from(&mut buf).unwrap();
@@ -517,7 +520,7 @@ fn udp_clone_two_write() {
         let (tx, rx) = channel();
         let (serv_tx, serv_rx) = channel();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut sock2 = sock2;
             let mut buf = [0, 1];
 
@@ -533,7 +536,7 @@ fn udp_clone_two_write() {
 
         let (done, rx) = channel();
         let tx2 = tx.clone();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut sock3 = sock3;
             match sock3.send_to(&[1], addr2) {
                 Ok(..) => { let _ = tx2.send_opt(()); }
@@ -561,7 +564,7 @@ fn recv_from_timeout() {
 
         let (tx, rx) = channel();
         let (tx2, rx2) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut a = a2;
             assert_eq!(a.recv_from(&mut [0]), Ok((1, addr1)));
             assert_eq!(a.send_to(&[0], addr1), Ok(()));
index 93465d5510b87893a2373627362686da901218fb..ee86eae058da02c1ea50d0d6ec0a878d763fa21a 100644 (file)
@@ -15,7 +15,7 @@
 
 #![allow(missing_docs)]
 
-use prelude::*;
+use prelude::v1::*;
 
 use io::IoResult;
 use libc;
@@ -112,7 +112,10 @@ fn write(&mut self, buf: &[u8]) -> IoResult<()> {
 
 #[cfg(test)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
+
+    use comm::channel;
+    use thread::Thread;
 
     #[test]
     fn partial_read() {
@@ -123,7 +126,7 @@ fn partial_read() {
         let out = PipeStream::open(writer);
         let mut input = PipeStream::open(reader);
         let (tx, rx) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut out = out;
             out.write(&[10]).unwrap();
             rx.recv(); // don't close the pipe until the other read has finished
index b127507f048d22ff0d7751feb212277d075979f4..b93e091af7e88150e57d4048b1c52500a476aab0 100644 (file)
 pub use self::StdioContainer::*;
 pub use self::ProcessExit::*;
 
-use prelude::*;
+use prelude::v1::*;
 
+use c_str::{CString, ToCStr};
+use collections::HashMap;
+use comm::{channel, Receiver};
 use fmt;
-use os;
+use hash::Hash;
+use io::pipe::{PipeStream, PipePair};
 use io::{IoResult, IoError};
 use io;
 use libc;
-use c_str::CString;
-use collections::HashMap;
-use hash::Hash;
-#[cfg(windows)]
-use std::hash::sip::SipState;
-use io::pipe::{PipeStream, PipePair};
+use os;
 use path::BytesContainer;
-use thread::Thread;
-
-use sys;
 use sys::fs::FileDesc;
 use sys::process::Process as ProcessImp;
+use sys;
+use thread::Thread;
+
+#[cfg(windows)] use std::hash::sip::SipState;
 
 /// Signal a process to exit, without forcibly killing it. Corresponds to
 /// SIGTERM on unix platforms.
@@ -741,18 +741,17 @@ fn drop(&mut self) {
 
 #[cfg(test)]
 mod tests {
-    #![allow(unused_imports)]
+    use prelude::v1::*;
 
-    use super::*;
+    use comm::channel;
+    use io::fs::PathExtensions;
     use io::timer::*;
     use io::{Truncate, Write, TimedOut, timer, process, FileNotFound};
-    use prelude::{Ok, Err, spawn, range, drop, Box, Some, None, Option, Vec, Buffer};
-    use prelude::{from_str, Path, String, channel, Reader, Writer, Clone, Slice};
-    use prelude::{SliceExt, Str, StrExt, AsSlice, ToString, GenericPath};
-    use io::fs::PathExtensions;
-    use time::Duration;
-    use str;
     use rt::running_on_valgrind;
+    use str;
+    use super::*;
+    use thread::Thread;
+    use time::Duration;
 
     // FIXME(#10380) these tests should not all be ignored on android.
 
@@ -1156,14 +1155,14 @@ fn wait_timeout() {
     fn wait_timeout2() {
         let (tx, rx) = channel();
         let tx2 = tx.clone();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut p = sleeper();
             p.set_timeout(Some(10));
             assert_eq!(p.wait().err().unwrap().kind, TimedOut);
             p.signal_kill().unwrap();
             tx.send(());
         });
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut p = sleeper();
             p.set_timeout(Some(10));
             assert_eq!(p.wait().err().unwrap().kind, TimedOut);
index 32965d23971ed132de3376e702d907d6bc9d1b60..c1474650f1eb479fa73245b253105b9b708302c3 100644 (file)
@@ -78,7 +78,7 @@ fn accept(&mut self) -> IoResult<T> {
 
 #[cfg(test)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
     use super::super::mem::*;
     use io;
 
index b7d069eb19e581313b203e57bd293078d5e5b23e..789fdeba8a2cb0ae2291320137d7074c5fcf905b 100644 (file)
@@ -520,8 +520,11 @@ fn write(&mut self, buf: &[u8]) -> IoResult<()> {
 
 #[cfg(test)]
 mod tests {
+    use prelude::v1::*;
+
     use super::*;
-    use prelude::*;
+    use comm::channel;
+    use thread::Thread;
 
     #[test]
     fn smoke() {
@@ -537,7 +540,7 @@ fn capture_stdout() {
 
         let (tx, rx) = channel();
         let (mut r, w) = (ChanReader::new(rx), ChanWriter::new(tx));
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             set_stdout(box w);
             println!("hello!");
         });
@@ -550,7 +553,7 @@ fn capture_stderr() {
 
         let (tx, rx) = channel();
         let (mut r, w) = (ChanReader::new(rx), ChanWriter::new(tx));
-        spawn(move|| {
+        let _t = Thread::spawn(move || -> () {
             set_stderr(box w);
             panic!("my special message");
         });
index 40941fda79c93821cd3a604fc7a1516f48c68d90..7592e7692db0d50db732d57d8bc1302d484bfedc 100644 (file)
 
 #![macro_escape]
 
+use prelude::v1::*;
+
 use libc;
 use os;
-use prelude::*;
 use std::io::net::ip::*;
 use sync::atomic::{AtomicUint, INIT_ATOMIC_UINT, Relaxed};
 
index 953effe4345ceb18bac732b07d45b4fa7224f10d..2067a97fdacf906f35725ee5bad0256899ea7c16 100644 (file)
@@ -225,9 +225,10 @@ fn in_ms_u64(d: Duration) -> u64 {
 
 #[cfg(test)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
 
     use super::Timer;
+    use thread::Thread;
     use time::Duration;
 
     #[test]
@@ -357,9 +358,9 @@ fn closing_channel_during_drop_doesnt_kill_everything() {
         let mut timer = Timer::new().unwrap();
         let timer_rx = timer.periodic(Duration::milliseconds(1000));
 
-        spawn(move|| {
+        Thread::spawn(move|| {
             let _ = timer_rx.recv_opt();
-        });
+        }).detach();
 
         // when we drop the TimerWatcher we're going to destroy the channel,
         // which must wake up the task on the other end
@@ -371,9 +372,9 @@ fn reset_doesnt_switch_tasks() {
         let mut timer = Timer::new().unwrap();
         let timer_rx = timer.periodic(Duration::milliseconds(1000));
 
-        spawn(move|| {
+        Thread::spawn(move|| {
             let _ = timer_rx.recv_opt();
-        });
+        }).detach();
 
         timer.oneshot(Duration::milliseconds(1));
     }
@@ -384,9 +385,9 @@ fn reset_doesnt_switch_tasks2() {
         let mut timer = Timer::new().unwrap();
         let timer_rx = timer.periodic(Duration::milliseconds(1000));
 
-        spawn(move|| {
+        Thread::spawn(move|| {
             let _ = timer_rx.recv_opt();
-        });
+        }).detach();
 
         timer.sleep(Duration::milliseconds(1));
     }
index 9840412160d9fb431e33d0c5bb0f9e99291f7be8..36986b8fdc5e54540171f5a28f46d9bec8debf85 100644 (file)
@@ -10,7 +10,7 @@
 
 //! Utility implementations of Reader and Writer
 
-use prelude::*;
+use prelude::v1::*;
 use cmp;
 use io;
 use slice::bytes::MutableByteVector;
@@ -278,11 +278,11 @@ fn read(&mut self, buf: &mut [u8]) -> io::IoResult<uint> {
 
 #[cfg(test)]
 mod test {
+    use prelude::v1::*;
+
     use io::{MemReader, ByRefReader};
     use io;
-    use boxed::Box;
     use super::*;
-    use prelude::{Ok, range, Vec, Buffer, Writer, Reader, ToString, AsSlice};
 
     #[test]
     fn test_limit_reader_unlimited() {
index 74c387c5eeaf1aafe95b437b12be97ac58f07ba7..8beb002cf4899dcf492f91f6f8ad910538cd60c7 100644 (file)
@@ -265,6 +265,7 @@ mod std {
     pub use cell; // used for tls!
     pub use thread_local; // used for thread_local!
     pub use kinds; // used for tls!
+    pub use ops; // used for bitflags!
 
     // The test runner calls ::std::os::args() but really wants realstd
     #[cfg(test)] pub use realstd::os as os;
index ebb64bc2f2d518a8081fe3b79ed1de3742ff9a17..fa77ae6418dd30a6cf21b95675c12565d26c8ad1 100644 (file)
@@ -334,6 +334,7 @@ macro_rules! vec {
 ///
 /// ```
 /// use std::thread::Thread;
+/// use std::comm::channel;
 ///
 /// let (tx1, rx1) = channel();
 /// let (tx2, rx2) = channel();
index 1f76382ce8a41c153b5d6983e8f142a39d717c84..6de49c38b732e98b6195de7e6d7d5210a802c7df 100644 (file)
@@ -15,7 +15,7 @@
 #![allow(unsigned_negation)]
 #![doc(primitive = "f32")]
 
-use prelude::*;
+use prelude::v1::*;
 
 use intrinsics;
 use libc::c_int;
index 221ecf62c058d999a589e30f9c4c312a37f16892..50855d21b4ab89aac9a618ad40e99fa7dd912855 100644 (file)
@@ -14,7 +14,7 @@
 #![allow(missing_docs)]
 #![doc(primitive = "f64")]
 
-use prelude::*;
+use prelude::v1::*;
 
 use intrinsics;
 use libc::c_int;
index 48ff1a364e93c7d73f750df61d6597ca3a5bf27e..01aa21c692bf54cce2047b2cfd694ee89262932f 100644 (file)
@@ -147,10 +147,8 @@ pub fn test_num<T>(ten: T, two: T) where
 
 #[cfg(test)]
 mod tests {
-    use prelude::{range, Some, None, Option, IteratorExt};
-    use super::{from_int, from_uint, from_i32, from_i64, from_u64, from_u32};
-    use super::{from_f64, from_f32, from_u16, from_i16, from_u8, from_i8, Int};
-    use super::{cast, NumCast, ToPrimitive, FromPrimitive, UnsignedInt};
+    use prelude::v1::*;
+    use super::*;
     use i8;
     use i16;
     use i32;
@@ -802,7 +800,7 @@ mod bench {
     extern crate test;
     use self::test::Bencher;
     use num::Int;
-    use prelude::*;
+    use prelude::v1::*;
 
     #[bench]
     fn bench_pow_function(b: &mut Bencher) {
index e74f45f8f0a159d26f744a9ba40962673797e613..b52e4fda7af2c8c2af4aa104e5fe4f58e9b5c0a6 100644 (file)
@@ -49,8 +49,9 @@ pub fn to_str_bytes<U, F>(n: $T, radix: uint, f: F) -> U where
 
 #[cfg(test)]
 mod tests {
-    use prelude::*;
+    use prelude::v1::*;
     use num::FromStrRadix;
+    use str::from_str;
 
     #[test]
     pub fn test_from_str() {
index df50b7f81afcf24d4c61c399cb90090d63a687d6..bceae6102165e322dbb158a6dd9bdc88be549145 100644 (file)
@@ -1427,7 +1427,7 @@ mod arch_consts {
 
 #[cfg(test)]
 mod tests {
-    use prelude::*;
+    use prelude::v1::*;
     use option;
     use os::{env, getcwd, getenv, make_absolute};
     use os::{split_paths, join_paths, setenv, unsetenv};
index 30f3f56bc1c10be7fd520fc9e175f5fbadf5f45b..024dc56073d04b4d189c5e6c7572287bf2d93cec 100644 (file)
@@ -931,7 +931,9 @@ fn contains_nul<T: BytesContainer>(v: &T) -> bool {
 
 #[cfg(test)]
 mod tests {
-    use prelude::*;
+    use prelude::v1::*;
+    use c_str::ToCStr;
+    use path::{WindowsPath, PosixPath};
 
     #[test]
     fn test_cstring() {
index bd4031e623085ee0c1263833ba9eef187918c109..102da31a2933a46e473d80b1949a965c4efa2e1c 100644 (file)
@@ -448,10 +448,15 @@ fn normalize_helper<'a>(v: &'a [u8], is_abs: bool) -> Option<Vec<&'a [u8]>> {
 #[cfg(test)]
 mod tests {
     use super::*;
-    use prelude::Option::{mod, Some, None};
-    use prelude::{Vec, Clone, AsSlice, SliceExt, CloneSliceExt, IteratorExt};
-    use prelude::{DoubleEndedIteratorExt, Str, StrExt, ToString, GenericPath};
-    use str;
+
+    use clone::Clone;
+    use iter::{IteratorExt, DoubleEndedIteratorExt};
+    use option::Option::{mod, Some, None};
+    use path::GenericPath;
+    use slice::{AsSlice, SliceExt, CloneSliceExt};
+    use str::{mod, Str, StrExt};
+    use string::ToString;
+    use vec::Vec;
 
     macro_rules! t {
         (s: $path:expr, $exp:expr) => (
@@ -1239,7 +1244,7 @@ mod bench {
     extern crate test;
     use self::test::Bencher;
     use super::*;
-    use prelude::{Clone, GenericPath};
+    use prelude::v1::{Clone, GenericPath};
 
     #[bench]
     fn join_home_dir(b: &mut Bencher) {
index 751ed4b70fb38fa1646c49a1b5ae47217d45d0ea..107e9d80fc3d36f693a0d919c7b9c4262ced2774 100644 (file)
@@ -1120,12 +1120,18 @@ fn prefix_len(p: Option<PathPrefix>) -> uint {
 #[cfg(test)]
 mod tests {
     use super::*;
-    use prelude::Option::{mod, Some, None};
-    use prelude::{Vec, Clone, AsSlice, SliceExt, CloneSliceExt, IteratorExt};
-    use prelude::{DoubleEndedIteratorExt, Str, ToString, GenericPath};
     use super::PathPrefix::*;
     use super::parse_prefix;
 
+    use clone::Clone;
+    use iter::{IteratorExt, DoubleEndedIteratorExt};
+    use option::Option::{mod, Some, None};
+    use path::GenericPath;
+    use slice::{AsSlice, SliceExt, CloneSliceExt};
+    use str::Str;
+    use string::ToString;
+    use vec::Vec;
+
     macro_rules! t {
         (s: $path:expr, $exp:expr) => (
             {
diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs
deleted file mode 100644 (file)
index f016683..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2013 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.
-
-//! The Rust prelude
-//!
-//! Because `std` is required by most serious Rust software, it is
-//! imported at the topmost level of every crate by default, as if the
-//! first line of each crate was
-//!
-//! ```ignore
-//! extern crate std;
-//! ```
-//!
-//! This means that the contents of std can be accessed from any context
-//! with the `std::` path prefix, as in `use std::vec`, `use std::task::spawn`,
-//! etc.
-//!
-//! Additionally, `std` contains a `prelude` module that reexports many of the
-//! most common traits, types and functions. The contents of the prelude are
-//! imported into every *module* by default.  Implicitly, all modules behave as if
-//! they contained the following prologue:
-//!
-//! ```ignore
-//! use std::prelude::*;
-//! ```
-//!
-//! The prelude is primarily concerned with exporting *traits* that are so
-//! pervasive that it would be obnoxious to import for every use, particularly
-//! those that define methods on primitive types. It does include a few
-//! particularly useful standalone functions, like `from_str`, `range`, and
-//! `drop`, `spawn`, and `channel`.
-
-#![experimental]
-
-// Reexported core operators
-#[doc(no_inline)] pub use kinds::{Copy, Send, Sized, Sync};
-#[doc(no_inline)] pub use ops::{Add, Sub, Mul, Div, Rem, Neg, Not};
-#[doc(no_inline)] pub use ops::{BitAnd, BitOr, BitXor};
-#[doc(no_inline)] pub use ops::{Drop, Deref, DerefMut};
-#[doc(no_inline)] pub use ops::{Shl, Shr};
-#[doc(no_inline)] pub use ops::{Index, IndexMut};
-#[doc(no_inline)] pub use ops::{Slice, SliceMut};
-#[doc(no_inline)] pub use ops::{Fn, FnMut, FnOnce};
-
-// Reexported functions
-#[doc(no_inline)] pub use iter::range;
-#[doc(no_inline)] pub use mem::drop;
-#[doc(no_inline)] pub use str::from_str;
-
-// Reexported types and traits
-
-#[doc(no_inline)] pub use borrow::IntoCow;
-#[doc(no_inline)] pub use c_str::ToCStr;
-#[doc(no_inline)] pub use char::{Char, UnicodeChar};
-#[doc(no_inline)] pub use clone::Clone;
-#[doc(no_inline)] pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
-#[doc(no_inline)] pub use cmp::{Ordering, Equiv};
-#[doc(no_inline)] pub use cmp::Ordering::{Less, Equal, Greater};
-#[doc(no_inline)] pub use iter::{FromIterator, Extend, ExactSizeIterator};
-#[doc(no_inline)] pub use iter::{Iterator, IteratorExt, DoubleEndedIterator};
-#[doc(no_inline)] pub use iter::{DoubleEndedIteratorExt, CloneIteratorExt};
-#[doc(no_inline)] pub use iter::{RandomAccessIterator, IteratorCloneExt, IteratorPairExt};
-#[doc(no_inline)] pub use iter::{IteratorOrdExt, MutableDoubleEndedIterator};
-#[doc(no_inline)] pub use num::{ToPrimitive, FromPrimitive};
-#[doc(no_inline)] pub use boxed::Box;
-#[doc(no_inline)] pub use option::Option;
-#[doc(no_inline)] pub use option::Option::{Some, None};
-#[doc(no_inline)] pub use path::{GenericPath, Path, PosixPath, WindowsPath};
-#[doc(no_inline)] pub use ptr::{PtrExt, MutPtrExt};
-#[doc(no_inline)] pub use result::Result;
-#[doc(no_inline)] pub use result::Result::{Ok, Err};
-#[doc(no_inline)] pub use io::{Buffer, Writer, Reader, Seek, BufferPrelude};
-#[doc(no_inline)] pub use core::prelude::{Tuple1, Tuple2, Tuple3, Tuple4};
-#[doc(no_inline)] pub use core::prelude::{Tuple5, Tuple6, Tuple7, Tuple8};
-#[doc(no_inline)] pub use core::prelude::{Tuple9, Tuple10, Tuple11, Tuple12};
-#[doc(no_inline)] pub use str::{Str, StrExt};
-#[doc(no_inline)] pub use slice::AsSlice;
-#[doc(no_inline)] pub use slice::{SliceConcatExt, PartialEqSliceExt};
-#[doc(no_inline)] pub use slice::{CloneSliceExt, OrdSliceExt, SliceExt};
-#[doc(no_inline)] pub use slice::{BoxedSliceExt};
-#[doc(no_inline)] pub use string::{IntoString, String, ToString};
-#[doc(no_inline)] pub use vec::Vec;
-
-// Reexported runtime types
-#[doc(no_inline)] pub use comm::{sync_channel, channel};
-#[doc(no_inline)] pub use comm::{SyncSender, Sender, Receiver};
-#[doc(no_inline)] pub use task::spawn;
diff --git a/src/libstd/prelude/mod.rs b/src/libstd/prelude/mod.rs
new file mode 100644 (file)
index 0000000..da945b4
--- /dev/null
@@ -0,0 +1,42 @@
+// 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.
+//
+// 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.
+
+//! The Rust prelude
+//!
+//! Because `std` is required by most serious Rust software, it is
+//! imported at the topmost level of every crate by default, as if the
+//! first line of each crate was
+//!
+//! ```ignore
+//! extern crate std;
+//! ```
+//!
+//! This means that the contents of std can be accessed from any context
+//! with the `std::` path prefix, as in `use std::vec`, `use std::task::spawn`,
+//! etc.
+//!
+//! Additionally, `std` contains a `prelude` module that reexports many of the
+//! most common traits, types and functions. The contents of the prelude are
+//! imported into every *module* by default.  Implicitly, all modules behave as if
+//! they contained the following prologue:
+//!
+//! ```ignore
+//! use std::prelude::v1::*;
+//! ```
+//!
+//! The prelude is primarily concerned with exporting *traits* that are so
+//! pervasive that it would be obnoxious to import for every use, particularly
+//! those that define methods on primitive types.
+
+#[cfg(stage0)]
+pub use self::v1::*;
+
+#[stable]
+pub mod v1;
diff --git a/src/libstd/prelude/v1.rs b/src/libstd/prelude/v1.rs
new file mode 100644 (file)
index 0000000..33146f5
--- /dev/null
@@ -0,0 +1,51 @@
+// Copyright 2013 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.
+
+//! The first version of the prelude of the standard library.
+
+#![stable]
+
+// Reexported core operators
+#[stable] #[doc(no_inline)] pub use kinds::{Copy, Send, Sized, Sync};
+#[stable] #[doc(no_inline)] pub use ops::{Drop, Fn, FnMut, FnOnce};
+
+// Reexported functions
+#[stable] #[doc(no_inline)] pub use mem::drop;
+
+// Reexported types and traits
+
+#[stable] #[doc(no_inline)] pub use boxed::Box;
+#[stable] #[doc(no_inline)] pub use char::{Char, UnicodeChar};
+#[stable] #[doc(no_inline)] pub use clone::Clone;
+#[stable] #[doc(no_inline)] pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
+#[stable] #[doc(no_inline)] pub use iter::CloneIteratorExt;
+#[stable] #[doc(no_inline)] pub use iter::DoubleEndedIterator;
+#[stable] #[doc(no_inline)] pub use iter::DoubleEndedIteratorExt;
+#[stable] #[doc(no_inline)] pub use iter::ExactSizeIterator;
+#[stable] #[doc(no_inline)] pub use iter::{Iterator, IteratorExt, Extend};
+#[stable] #[doc(no_inline)] pub use iter::{IteratorCloneExt, IteratorOrdExt};
+#[stable] #[doc(no_inline)] pub use iter::IteratorPairExt;
+#[stable] #[doc(no_inline)] pub use option::Option::{mod, Some, None};
+#[stable] #[doc(no_inline)] pub use ptr::{PtrExt, MutPtrExt};
+#[stable] #[doc(no_inline)] pub use result::Result::{mod, Ok, Err};
+#[stable] #[doc(no_inline)] pub use slice::AsSlice;
+#[stable] #[doc(no_inline)] pub use slice::{BoxedSliceExt, SliceExt};
+#[stable] #[doc(no_inline)] pub use slice::{CloneSliceExt, OrdSliceExt};
+#[stable] #[doc(no_inline)] pub use slice::{PartialEqSliceExt, SliceConcatExt};
+#[stable] #[doc(no_inline)] pub use str::{Str, StrExt};
+#[stable] #[doc(no_inline)] pub use string::{String, ToString};
+#[stable] #[doc(no_inline)] pub use vec::Vec;
+
+// NB: remove when path reform lands
+#[doc(no_inline)] pub use path::{Path, GenericPath};
+// NB: remove when I/O reform lands
+#[doc(no_inline)] pub use io::{Buffer, Writer, Reader, Seek, BufferPrelude};
+// NB: remove when range syntax lands
+#[doc(no_inline)] pub use iter::range;
index f665d150f387831334793ce6b9bda8dcc586d912..86b8bfc73709d6998f722d098b85fb3cf36752cc 100644 (file)
@@ -419,7 +419,7 @@ pub fn sample<T, I: Iterator<T>, R: Rng>(rng: &mut R,
 
 #[cfg(test)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
     use super::{Rng, thread_rng, random, SeedableRng, StdRng, sample};
     use iter::order;
 
@@ -615,7 +615,7 @@ fn test_std_rng_reseed() {
 #[cfg(test)]
 mod bench {
     extern crate test;
-    use prelude::*;
+    use prelude::v1::*;
 
     use self::test::Bencher;
     use super::{XorShiftRng, StdRng, IsaacRng, Isaac64Rng, Rng, RAND_BENCH_N};
index ca36f2d8997b1df67dc3f00468a55753a1243132..6576f1b65261ef309468102aeab183bbf5bcf8a6 100644 (file)
@@ -338,10 +338,11 @@ fn drop(&mut self) {
 
 #[cfg(test)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
 
-    use super::OsRng;
+    use comm::channel;
     use rand::Rng;
+    use super::OsRng;
     use thread::Thread;
 
     #[test]
index 15e63aa19eabc43312ffeae6ed3074d2cebe11cc..48d7f2e7854da0421270185094414ab2a661fc87 100644 (file)
@@ -74,7 +74,7 @@ fn fill_bytes(&mut self, v: &mut [u8]) {
 
 #[cfg(test)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
 
     use super::ReaderRng;
     use io::MemReader;
index 98eff621ce0f3c95c3c28552ff007b2e5b29a7ae..4734a39c8354257a6fa21ed236160c8f42b964e5 100644 (file)
@@ -44,7 +44,7 @@ pub fn clone() -> Option<Vec<Vec<u8>>> { imp::clone() }
           target_os = "freebsd",
           target_os = "dragonfly"))]
 mod imp {
-    use prelude::*;
+    use prelude::v1::*;
 
     use mem;
     use slice;
@@ -107,7 +107,7 @@ unsafe fn load_argc_and_argv(argc: int, argv: *const *const u8) -> Vec<Vec<u8>>
 
     #[cfg(test)]
     mod tests {
-        use prelude::*;
+        use prelude::v1::*;
         use finally::Finally;
 
         use super::*;
index 3eeb0ad3968fe9b091e77cc9f4154d5466a98c4a..4abef6ee9104620ddd26c1d3d99ac1603d602e65 100644 (file)
@@ -12,7 +12,7 @@
 
 #![allow(non_camel_case_types)]
 
-use prelude::*;
+use prelude::v1::*;
 
 use os;
 use sync::atomic;
@@ -39,7 +39,7 @@ pub fn log_enabled() -> bool {
 
 #[cfg(test)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
     use sys_common;
     macro_rules! t { ($a:expr, $b:expr) => ({
         let mut m = Vec::new();
index 88bdb29caecadc94b7e386cd02979ed039fee701..eb6b36554445767def015a22d71dfaf61abdfece 100644 (file)
@@ -83,7 +83,7 @@ fn deref_mut(&mut self) -> &mut T { &mut *self._data }
 
 #[cfg(test)]
 mod tests {
-    use prelude::*;
+    use prelude::v1::*;
     use sync::Arc;
     use super::Exclusive;
     use task;
index e877dd5c6aab813ba5689070940299b667d5df1a..68aaa1b3ae55dc38e239853dfcb10ab5e93315c9 100644 (file)
 
 #![allow(dead_code)]
 
-use os;
-use thunk::Thunk;
 use kinds::Send;
-use thread::Thread;
 use ops::FnOnce;
 use sys;
-use sys_common;
-use sys_common::thread_info::{mod, NewThread};
+use thunk::Thunk;
 
 // Reexport some of our utilities which are expected by other crates.
 pub use self::util::{default_sched_threads, min_stack, running_on_valgrind};
 #[cfg(not(test))]
 #[lang = "start"]
 fn lang_start(main: *const u8, argc: int, argv: *const *const u8) -> int {
+    use prelude::v1::*;
+
     use mem;
-    use prelude::*;
+    use os;
     use rt;
+    use sys_common::thread_info::{mod, NewThread};
+    use sys_common;
+    use thread::Thread;
 
     let something_around_the_top_of_the_stack = 1;
     let addr = &something_around_the_top_of_the_stack as *const int;
index 41e91d1b6ef9be4fea4719e858efcf8a9aed1767..48cdfc20a351a8eacf10e57a7825172e072315dc 100644 (file)
@@ -496,7 +496,7 @@ pub fn new() -> Death {
 #[cfg(test)]
 mod test {
     use super::*;
-    use prelude::*;
+    use prelude::v1::*;
     use task;
     use rt::unwind;
 
index e0c512706e6a96b5fcdd5260748606cabd7ccecc..dcd967a774cf6c388fa4a0251fc5eec9dbd008fc 100644 (file)
@@ -57,7 +57,7 @@
 //!
 //! Currently Rust uses unwind runtime provided by libgcc.
 
-use prelude::*;
+use prelude::v1::*;
 
 use any::Any;
 use cell::Cell;
index fee86e33455d40c086e96c835bc0c675eca5537f..2a8deccb5dc930929b84852923edcaac69b7aea2 100644 (file)
 //
 // ignore-lexer-test FIXME #15677
 
-use prelude::*;
+use prelude::v1::*;
 
 use cmp;
 use fmt;
 use intrinsics;
-use libc::uintptr_t;
-use libc;
+use libc::{mod, uintptr_t};
 use os;
 use slice;
 use str;
index 18c917aca8a4aba2102adb4f7785fadee4f3786d..a88932f21cba30f412cfb6a7b1ef22074334bc03 100644 (file)
@@ -180,7 +180,7 @@ fn drop(&mut self) {
 
 #[cfg(test)]
 mod test {
-    use prelude::{Some, None};
+    use prelude::v1::*;
     use super::*;
 
     #[test]
index 4091f0df39597d2b7fc683f257baf197574e4877..1c73bf7cf35657ab9d72f560551a2232ff5638ca 100644 (file)
@@ -89,10 +89,11 @@ pub fn wait(&self) {
 
 #[cfg(test)]
 mod tests {
-    use prelude::*;
+    use prelude::v1::*;
 
     use sync::{Arc, Barrier};
-    use comm::Empty;
+    use comm::{channel, Empty};
+    use thread::Thread;
 
     #[test]
     fn test_barrier() {
@@ -102,10 +103,10 @@ fn test_barrier() {
         for _ in range(0u, 9) {
             let c = barrier.clone();
             let tx = tx.clone();
-            spawn(move|| {
+            Thread::spawn(move|| {
                 c.wait();
                 tx.send(true);
-            });
+            }).detach();
         }
 
         // At this point, all spawned tasks should be blocked,
index 15faf5be258f594816a289fda4d0e9f9fe8104a1..df3f2e5cf6279bf951e8d26ddab0cc6cbb140ba7 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use prelude::*;
+use prelude::v1::*;
 
 use sync::atomic::{mod, AtomicUint};
 use sync::poison::{mod, LockResult};
@@ -279,11 +279,13 @@ fn verify(&self, mutex: &sys_mutex::Mutex) {
 
 #[cfg(test)]
 mod tests {
-    use prelude::*;
+    use prelude::v1::*;
 
-    use time::Duration;
+    use comm::channel;
     use super::{StaticCondvar, CONDVAR_INIT};
     use sync::{StaticMutex, MUTEX_INIT, Condvar, Mutex, Arc};
+    use thread::Thread;
+    use time::Duration;
 
     #[test]
     fn smoke() {
@@ -305,8 +307,8 @@ fn notify_one() {
         static C: StaticCondvar = CONDVAR_INIT;
         static M: StaticMutex = MUTEX_INIT;
 
-        let g = M.lock().unwrap();
-        spawn(move|| {
+        let mut g = M.lock().unwrap();
+        let _t = Thread::spawn(move|| {
             let _g = M.lock().unwrap();
             C.notify_one();
         });
@@ -324,7 +326,7 @@ fn notify_all() {
         for _ in range(0, N) {
             let data = data.clone();
             let tx = tx.clone();
-            spawn(move|| {
+            Thread::spawn(move|| {
                 let &(ref lock, ref cond) = &*data;
                 let mut cnt = lock.lock().unwrap();
                 *cnt += 1;
@@ -335,7 +337,7 @@ fn notify_all() {
                     cnt = cond.wait(cnt).unwrap();
                 }
                 tx.send(());
-            });
+            }).detach();
         }
         drop(tx);
 
@@ -359,7 +361,7 @@ fn wait_timeout() {
         let g = M.lock().unwrap();
         let (g, success) = C.wait_timeout(g, Duration::nanoseconds(1000)).unwrap();
         assert!(!success);
-        spawn(move|| {
+        let _t = Thread::spawn(move || {
             let _g = M.lock().unwrap();
             C.notify_one();
         });
@@ -377,7 +379,7 @@ fn two_mutexes() {
         static C: StaticCondvar = CONDVAR_INIT;
 
         let mut g = M1.lock().unwrap();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let _g = M1.lock().unwrap();
             C.notify_one();
         });
@@ -385,6 +387,5 @@ fn two_mutexes() {
         drop(g);
 
         C.wait(M2.lock().unwrap()).unwrap();
-
     }
 }
index 51899a87a325d72d05aff960e81f20817b041aec..a0e7236b8d29a69ce3ec208c1b28d82f22f257a5 100644 (file)
@@ -150,9 +150,10 @@ pub fn spawn<F>(blk: F) -> Future<A>
 
 #[cfg(test)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
+    use comm::channel;
     use sync::Future;
-    use task;
+    use thread::Thread;
 
     #[test]
     fn test_from_value() {
@@ -210,7 +211,7 @@ fn test_sendable_future() {
         let expected = "schlorf";
         let (tx, rx) = channel();
         let f = Future::spawn(move|| { expected });
-        task::spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let mut f = f;
             tx.send(f.get());
         });
index 52004bb4a8f5f4a99f59658424c13ed59af0cb91..98425f26c1af4222ed2571ca4e769cdf290534c3 100644 (file)
@@ -8,10 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use prelude::*;
+use prelude::v1::*;
 
 use cell::UnsafeCell;
 use kinds::marker;
+use ops::{Deref, DerefMut};
 use sync::poison::{mod, TryLockError, TryLockResult, LockResult};
 use sys_common::mutex as sys;
 
@@ -47,6 +48,8 @@
 /// ```rust
 /// use std::sync::{Arc, Mutex};
 /// use std::thread::Thread;
+/// use std::comm::channel;
+///
 /// const N: uint = 10;
 ///
 /// // Spawn a few threads to increment a shared variable (non-atomically), and
@@ -320,10 +323,11 @@ pub fn guard_poison<'a, T>(guard: &MutexGuard<'a, T>) -> &'a poison::Flag {
 
 #[cfg(test)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
 
-    use thread::Thread;
+    use comm::channel;
     use sync::{Arc, Mutex, StaticMutex, MUTEX_INIT, Condvar};
+    use thread::Thread;
 
     struct Packet<T>(Arc<(Mutex<T>, Condvar)>);
 
@@ -366,9 +370,9 @@ fn inc() {
         let (tx, rx) = channel();
         for _ in range(0, K) {
             let tx2 = tx.clone();
-            spawn(move|| { inc(); tx2.send(()); });
+            Thread::spawn(move|| { inc(); tx2.send(()); }).detach();
             let tx2 = tx.clone();
-            spawn(move|| { inc(); tx2.send(()); });
+            Thread::spawn(move|| { inc(); tx2.send(()); }).detach();
         }
 
         drop(tx);
@@ -392,7 +396,7 @@ fn test_mutex_arc_condvar() {
         let packet = Packet(Arc::new((Mutex::new(false), Condvar::new())));
         let packet2 = Packet(packet.0.clone());
         let (tx, rx) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             // wait until parent gets in
             rx.recv();
             let &(ref lock, ref cvar) = &*packet2.0;
@@ -416,7 +420,7 @@ fn test_arc_condvar_poison() {
         let packet2 = Packet(packet.0.clone());
         let (tx, rx) = channel();
 
-        spawn(move|| {
+        let _t = Thread::spawn(move || -> () {
             rx.recv();
             let &(ref lock, ref cvar) = &*packet2.0;
             let _g = lock.lock().unwrap();
@@ -457,9 +461,9 @@ fn test_mutex_arc_nested() {
         let arc = Arc::new(Mutex::new(1i));
         let arc2 = Arc::new(Mutex::new(arc));
         let (tx, rx) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let lock = arc2.lock().unwrap();
-            let lock2 = lock.deref().lock().unwrap();
+            let lock2 = lock.lock().unwrap();
             assert_eq!(*lock2, 1);
             tx.send(());
         });
index 4d9fbb5990840af8ce3ab716a962b3e66c20912e..fe25eca03d7cf6cfa388eee60de31c5768f04363 100644 (file)
@@ -122,10 +122,11 @@ pub fn doit<F>(&'static self, f: F) where F: FnOnce() {
 
 #[cfg(test)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
 
     use thread::Thread;
     use super::{ONCE_INIT, Once};
+    use comm::channel;
 
     #[test]
     fn smoke_once() {
@@ -145,7 +146,7 @@ fn stampede_once() {
         let (tx, rx) = channel();
         for _ in range(0u, 10) {
             let tx = tx.clone();
-            spawn(move|| {
+            Thread::spawn(move|| {
                 for _ in range(0u, 4) { Thread::yield_now() }
                 unsafe {
                     O.doit(|| {
@@ -155,7 +156,7 @@ fn stampede_once() {
                     assert!(run);
                 }
                 tx.send(());
-            });
+            }).detach();
         }
 
         unsafe {
index edf16d99f4966d1e7e6a02462524fc5730f4aa4f..6e4df1182091febb789c66a67f2564719701c8fc 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use prelude::*;
+use prelude::v1::*;
 
 use cell::UnsafeCell;
 use error::FromError;
index 7f3c77c97adefdeb10c055ca31d74de7c5d9eaf7..efdd894a806de024abcc06cf5329185297d62bb7 100644 (file)
@@ -8,10 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use prelude::*;
+use prelude::v1::*;
 
 use cell::UnsafeCell;
 use kinds::marker;
+use ops::{Deref, DerefMut};
 use sync::poison::{mod, LockResult, TryLockError, TryLockResult};
 use sys_common::rwlock as sys;
 
@@ -355,9 +356,10 @@ fn drop(&mut self) {
 
 #[cfg(test)]
 mod tests {
-    use prelude::*;
+    use prelude::v1::*;
 
     use rand::{mod, Rng};
+    use comm::channel;
     use thread::Thread;
     use sync::{Arc, RWLock, StaticRWLock, RWLOCK_INIT};
 
@@ -389,7 +391,7 @@ fn frob() {
         let (tx, rx) = channel::<()>();
         for _ in range(0, N) {
             let tx = tx.clone();
-            spawn(move|| {
+            Thread::spawn(move|| {
                 let mut rng = rand::thread_rng();
                 for _ in range(0, M) {
                     if rng.gen_weighted_bool(N) {
@@ -399,7 +401,7 @@ fn frob() {
                     }
                 }
                 drop(tx);
-            });
+            }).detach();
         }
         drop(tx);
         let _ = rx.recv_opt();
index e3b683a6ccb380786588fd57930197e9e2efb3c5..a283626a408ba62f040e213cc07c428965f9f9ed 100644 (file)
@@ -104,10 +104,12 @@ fn drop(&mut self) {
 
 #[cfg(test)]
 mod tests {
-    use prelude::*;
+    use prelude::v1::*;
 
     use sync::Arc;
     use super::Semaphore;
+    use comm::channel;
+    use thread::Thread;
 
     #[test]
     fn test_sem_acquire_release() {
@@ -127,7 +129,7 @@ fn test_sem_basic() {
     fn test_sem_as_mutex() {
         let s = Arc::new(Semaphore::new(1));
         let s2 = s.clone();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let _g = s2.access();
         });
         let _g = s.access();
@@ -139,7 +141,7 @@ fn test_sem_as_cvar() {
         let (tx, rx) = channel();
         let s = Arc::new(Semaphore::new(0));
         let s2 = s.clone();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             s2.acquire();
             tx.send(());
         });
@@ -150,7 +152,7 @@ fn test_sem_as_cvar() {
         let (tx, rx) = channel();
         let s = Arc::new(Semaphore::new(0));
         let s2 = s.clone();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             s2.release();
             let _ = rx.recv();
         });
@@ -166,7 +168,7 @@ fn test_sem_multi_resource() {
         let s2 = s.clone();
         let (tx1, rx1) = channel();
         let (tx2, rx2) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             let _g = s2.access();
             let _ = rx2.recv();
             tx1.send(());
@@ -183,11 +185,11 @@ fn test_sem_runtime_friendly_blocking() {
         let (tx, rx) = channel();
         {
             let _g = s.access();
-            spawn(move|| {
+            Thread::spawn(move|| {
                 tx.send(());
                 drop(s2.access());
                 tx.send(());
-            });
+            }).detach();
             rx.recv(); // wait for child to come alive
         }
         rx.recv(); // wait for child to be done
index ee534f6cdde3ecf135ad0e2590d597448cd88f1d..63c10c1804659baa6c34a36767994eaa722a7765 100644 (file)
@@ -53,8 +53,9 @@ fn drop(&mut self) {
 /// # Example
 ///
 /// ```rust
-/// # use std::sync::TaskPool;
-/// # use std::iter::AdditiveIterator;
+/// use std::sync::TaskPool;
+/// use std::iter::AdditiveIterator;
+/// use std::comm::channel;
 ///
 /// let pool = TaskPool::new(4u);
 ///
@@ -131,8 +132,9 @@ fn spawn_in_pool(jobs: Arc<Mutex<Receiver<Thunk>>>) {
 
 #[cfg(test)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
     use super::*;
+    use comm::channel;
 
     const TEST_TASKS: uint = 4u;
 
index 866bf1d8a7d63ebc7812489a1c61cdf1e7886f2d..d4039fd96ff204c92ae087e0014e3c79cfb8b3fd 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use prelude::*;
+use prelude::v1::*;
 
 use io::IoResult;
 
index 9ef1c33312fc8b4ac6c5a6e354ce0caa12bcc0b2..c4c093dcb328f38739be42204a4e989ea35b5127 100644 (file)
 //! can be created in the future and there must be no active timers at that
 //! time.
 
-use prelude::*;
+use prelude::v1::*;
 
 use cell::UnsafeCell;
+use comm::{channel, Sender, Receiver};
 use mem;
-use sync::{StaticMutex, StaticCondvar};
 use rt;
+use sync::{StaticMutex, StaticCondvar};
 use sys::helper_signal;
 
 use thread::Thread;
index dc0ad08cdbef637100a7f8477897af5643ddcedf..97015f74a4a10bec8df2662fea0fbd77c0dc9b90 100644 (file)
@@ -12,7 +12,7 @@
 #![allow(dead_code)]
 
 use io::{mod, IoError, IoResult};
-use prelude::*;
+use prelude::v1::*;
 use sys::{last_error, retry};
 use c_str::CString;
 use num::Int;
index 259c15b5f06347cbb93792023ecfe4e10afc0b17..cb0c5581abd8b34f1238a2dda59aba79d7090ee8 100644 (file)
@@ -8,24 +8,24 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use prelude::v1::*;
 use self::SocketStatus::*;
 use self::InAddr::*;
 
-use alloc::arc::Arc;
+use c_str::ToCStr;
+use io::net::addrinfo;
+use io::net::ip::{SocketAddr, IpAddr, Ipv4Addr, Ipv6Addr};
+use io::{IoResult, IoError};
 use libc::{mod, c_char, c_int};
 use c_str::CString;
 use mem;
 use num::Int;
 use ptr::{mod, null, null_mut};
-use io::net::ip::{SocketAddr, IpAddr, Ipv4Addr, Ipv6Addr};
-use io::net::addrinfo;
-use io::{IoResult, IoError};
 use sys::{mod, retry, c, sock_t, last_error, last_net_error, last_gai_error, close_sock,
           wrlen, msglen_t, os, wouldblock, set_nonblocking, timer, ms_to_timeval,
           decode_error_detailed};
-use sync::{Mutex, MutexGuard};
+use sync::{Arc, Mutex, MutexGuard};
 use sys_common::{mod, keep_going, short_write, timeout};
-use prelude::*;
 use cmp;
 use io;
 
index fe7a7d8d0371688540bd19b327340f7a5b268afe..405dd4eacf3993a7f74da26d9b0f0490542941ec 100644 (file)
@@ -56,7 +56,7 @@
 
 #![allow(non_camel_case_types)]
 
-use prelude::*;
+use prelude::v1::*;
 
 use sync::atomic::{mod, AtomicUint};
 use sync::{Mutex, Once, ONCE_INIT};
@@ -246,7 +246,7 @@ fn drop(&mut self) {
 
 #[cfg(test)]
 mod tests {
-    use prelude::*;
+    use prelude::v1::*;
     use super::{Key, StaticKey, INIT_INNER};
 
     fn assert_sync<T: Sync>() {}
index 8de4ffa7022a92ece4d9e289b25a90f3668ccd7b..e3e0b279c12c705e6c438cc766a8cfbcc09e04be 100644 (file)
 
 //! Blocking posix-based file I/O
 
-use libc::{mod, c_int, c_void};
-use c_str::CString;
-use mem;
-use io;
-
-use prelude::*;
+use prelude::v1::*;
 
+use c_str::{CString, ToCStr};
 use io::{FilePermission, Write, UnstableFileStat, Open, FileAccess, FileMode};
 use io::{IoResult, FileStat, SeekStyle};
 use io::{Read, Truncate, SeekCur, SeekSet, ReadWrite, SeekEnd, Append};
+use io;
+use libc::{mod, c_int, c_void};
+use mem;
 use sys::retry;
 use sys_common::{keep_going, eof, mkerr_libc};
 
@@ -360,7 +359,7 @@ mod tests {
     use super::FileDesc;
     use libc;
     use os;
-    use prelude::*;
+    use prelude::v1::*;
 
     #[cfg_attr(target_os = "freebsd", ignore)] // hmm, maybe pipes have a tiny buffer
     #[test]
index c82dacf1e44e9e9b2487497c11f27ae73931b93e..4199cbc1bb9f52242e7fbccf1231e9d3e5a9796a 100644 (file)
@@ -19,7 +19,7 @@
 
 use num;
 use num::{Int, SignedInt};
-use prelude::*;
+use prelude::v1::*;
 use io::{mod, IoResult, IoError};
 use sys_common::mkerr_libc;
 
index 595191db3b2829b91910524ad23961896a79e4cf..6d145e47516c7a862ab783152d1ef3d780a881cf 100644 (file)
 
 //! Implementation of `std::os` functionality for unix systems
 
-use prelude::*;
+use prelude::v1::*;
 
+use c_str::ToCStr;
 use error::{FromError, Error};
 use fmt;
 use io::{IoError, IoResult};
 use libc::{mod, c_int, c_char, c_void};
-use path::BytesContainer;
+use os;
+use path::{BytesContainer};
 use ptr;
 use sync::atomic::{AtomicInt, INIT_ATOMIC_INT, SeqCst};
 use sys::fs::FileDesc;
-use os;
 
 use os::TMPBUF_SZ;
 
index 868b460aa5ed3897e807bc667aaf05babd764949..e46814ef4a27d03ca4e7921d16d89509ac0fa0f6 100644 (file)
@@ -8,13 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use alloc::arc::Arc;
+use prelude::v1::*;
+
 use libc;
 use c_str::CString;
 use mem;
-use sync::{atomic, Mutex};
+use sync::{atomic, Arc, Mutex};
 use io::{mod, IoResult, IoError};
-use prelude::*;
 
 use sys::{mod, timer, retry, c, set_nonblocking, wouldblock};
 use sys::fs::{fd_t, FileDesc};
index c1c28bd5fc4dfaf3154ac600c494e7e4bac5c037..13191961fb7b0c248d44498a0bbaab4c2f49342d 100644 (file)
@@ -7,22 +7,23 @@
 // <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.
+
+use prelude::v1::*;
 use self::Req::*;
 
-use libc::{mod, pid_t, c_void, c_int};
-use c_str::CString;
+use c_str::{CString, ToCStr};
+use collections;
+use comm::{channel, Sender, Receiver};
+use hash::Hash;
+use io::process::{ProcessExit, ExitStatus, ExitSignal};
 use io::{mod, IoResult, IoError, EndOfFile};
+use libc::{mod, pid_t, c_void, c_int};
 use mem;
 use os;
-use ptr;
-use prelude::*;
-use io::process::{ProcessExit, ExitStatus, ExitSignal};
-use collections;
 use path::BytesContainer;
-use hash::Hash;
-
-use sys::{mod, retry, c, wouldblock, set_nonblocking, ms_to_timeval};
+use ptr;
 use sys::fs::FileDesc;
+use sys::{mod, retry, c, wouldblock, set_nonblocking, ms_to_timeval};
 use sys_common::helper_thread::Helper;
 use sys_common::{AsInner, mkerr_libc, timeout};
 
index e2a78947e167ab015c9ea3950b3d5a0b1fda65d3..13ccf685fd7fc5b0a1e7c321406bce03ab539b10 100644 (file)
@@ -8,12 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use prelude::v1::*;
+
 use io::net::ip;
 use io::IoResult;
 use libc;
 use mem;
 use ptr;
-use prelude::*;
 use super::{last_error, last_net_error, retry, sock_t};
 use sync::{Arc, atomic};
 use sys::fs::FileDesc;
index b300e93eeb602b3aabcebb213547f95107326abd..e507377a8fcdd880a01c5b98ee53145a7463cfaa 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use prelude::*;
+use prelude::v1::*;
 use libc::c_int;
 
 pub type Key = pthread_key_t;
index c0ef89666c0f59b16885ee4a1ce6369ace8af752..c9160a032ecf7f2824f1f4d924d6482fd634ed5f 100644 (file)
 //!
 //! Note that all time units in this file are in *milliseconds*.
 
+use prelude::v1::*;
 use self::Req::*;
 
+use comm::{mod, channel, Sender, Receiver};
+use io::IoResult;
 use libc;
 use mem;
 use os;
 use ptr;
 use sync::atomic;
-use comm;
 use sys::c;
 use sys::fs::FileDesc;
 use sys_common::helper_thread::Helper;
-use prelude::*;
-use io::IoResult;
 
 helper_init! { static HELPER: Helper<Req> }
 
index 28c17fd4966c09468fe1df7f9570e67cd911ab6e..4ef687d41d8ee70a23c7fd51099885bcc7c58ffe 100644 (file)
@@ -8,8 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use prelude::v1::*;
+
 use sys::fs::FileDesc;
-use prelude::*;
 use libc::{mod, c_int};
 use io::{mod, IoResult, IoError};
 use sys_common;
index 6cccefbe89064dd20e0cf7133f88509c92541ca0..d28d0fe26b9431a0bb662159d391773cffa2cd13 100644 (file)
@@ -15,7 +15,7 @@
 #![allow(non_camel_case_types)]
 
 use libc;
-use prelude::*;
+use prelude::v1::*;
 
 pub const WSADESCRIPTION_LEN: uint = 256;
 pub const WSASYS_STATUS_LEN: uint = 128;
@@ -132,7 +132,9 @@ pub fn CancelIoEx(hFile: libc::HANDLE,
 pub mod compat {
     use intrinsics::{atomic_store_relaxed, transmute};
     use libc::types::os::arch::extra::{LPCWSTR, HMODULE, LPCSTR, LPVOID};
-    use prelude::*;
+    use prelude::v1::*;
+
+    use c_str::ToCStr;
 
     extern "system" {
         fn GetModuleHandleW(lpModuleName: LPCWSTR) -> HMODULE;
index 3ad439078b9a146767660b3469ca6d93586add35..523d60c71aa8b7a2e7c13328da1b91dc27e57a95 100644 (file)
@@ -21,7 +21,7 @@
 use str;
 use io;
 
-use prelude::*;
+use prelude::v1::*;
 use sys;
 use sys::os;
 use sys_common::{keep_going, eof, mkerr_libc};
index 57c284ed6a32699fc9ef11b1a09c196957e8337c..c354e7b3ece2927379b2fc5b3f774516fbb47d6d 100644 (file)
 
 extern crate libc;
 
+use prelude::v1::*;
+
 use num;
 use mem;
-use prelude::*;
 use io::{mod, IoResult, IoError};
 use sync::{Once, ONCE_INIT};
+use comm::Sender;
 
 macro_rules! helper_init { (static $name:ident: Helper<$m:ty>) => (
     static $name: Helper<$m> = Helper {
index 3ac7c09154e352e10d1514a618f7d3ccb4a784e3..c7b4a4cec09ecceafe8035b2d130cf1db2adb928 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use prelude::*;
+use prelude::v1::*;
 
 use sync::atomic;
 use alloc::{mod, heap};
index 09003f87ff0c143d655a7eb0da756caf170fc195..dfdee0e0385c5c121ee2db90ea5acc7b694cc909 100644 (file)
@@ -13,7 +13,7 @@
 // FIXME: move various extern bindings from here into liblibc or
 // something similar
 
-use prelude::*;
+use prelude::v1::*;
 
 use fmt;
 use io::{IoResult, IoError};
index fc3640f260437b8d1f72a1eb1f5ccb6cbbe2add7..f173d5fc6d4cb5843abce61eff584eba5c5df3b4 100644 (file)
 //! the test suite passing (the suite is in libstd), and that's good enough for
 //! me!
 
-use alloc::arc::Arc;
+use prelude::v1::*;
+
 use libc;
 use c_str::CString;
 use mem;
 use ptr;
-use sync::{atomic, Mutex};
+use sync::{atomic, Arc, Mutex};
 use io::{mod, IoError, IoResult};
-use prelude::*;
 
 use sys_common::{mod, eof};
 
index b03c62395d1a081807296f0941aef38ec04d2ec7..00c1ca7fe1a3513f7097224888ebd7a36553d64d 100644 (file)
@@ -8,14 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use prelude::v1::*;
+
 use libc::{pid_t, c_void, c_int};
 use libc;
-use c_str::CString;
+use c_str::{CString, ToCStr};
 use io;
 use mem;
 use os;
 use ptr;
-use prelude::*;
 use io::process::{ProcessExit, ExitStatus, ExitSignal};
 use collections;
 use path::BytesContainer;
@@ -469,7 +470,7 @@ mod tests {
 
     #[test]
     fn test_make_command_line() {
-        use prelude::*;
+        use prelude::v1::*;
         use str;
         use c_str::CString;
         use super::make_command_line;
index 513c1d38e363492bf5b4111675fafe2453780637..5a929f6b2b5ff27aafed24204c774ad654d638c0 100644 (file)
@@ -13,7 +13,7 @@
 use libc;
 use mem;
 use ptr;
-use prelude::*;
+use prelude::v1::*;
 use super::{last_error, last_net_error, retry, sock_t};
 use sync::{Arc, atomic};
 use sys::fs::FileDesc;
index 60b0d584db3a7a6936fa8c1f160c19109739d331..b96e26c7a86a6feef0d49e98297187d2beaa591d 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use prelude::*;
+use prelude::v1::*;
 
 use libc::types::os::arch::extra::{DWORD, LPVOID, BOOL};
 
index 874838950cd12bfcd59f0751d74d64b40de9cbfc..485dc251050145a4c644247230806b0b104bf70a 100644 (file)
 //! the other two implementations of timers with nothing *that* new showing up.
 
 use self::Req::*;
+use prelude::v1::*;
 
 use libc;
 use ptr;
 use comm;
 
+use comm::{channel, Sender, Receiver};
+use io::IoResult;
 use sys::c;
 use sys::fs::FileDesc;
 use sys_common::helper_thread::Helper;
-use prelude::*;
-use io::IoResult;
 
 helper_init! { static HELPER: Helper<Req> }
 
index a88d11eed22bd254645039b56629578c12489620..7591025d76d6f4305b4a2c67fee27cae32f83fb0 100644 (file)
 //! wrapper that performs encoding/decoding, this implementation should switch
 //! to working in raw UTF-16, with such a wrapper around it.
 
-use super::c::{ReadConsoleW, WriteConsoleW, GetConsoleMode, SetConsoleMode};
-use super::c::{ERROR_ILLEGAL_CHARACTER};
-use super::c::{ENABLE_ECHO_INPUT, ENABLE_EXTENDED_FLAGS};
-use super::c::{ENABLE_INSERT_MODE, ENABLE_LINE_INPUT};
-use super::c::{ENABLE_PROCESSED_INPUT, ENABLE_QUICK_EDIT_MODE};
-use libc::{c_int, HANDLE, LPDWORD, DWORD, LPVOID};
-use libc::{get_osfhandle, CloseHandle};
-use libc::types::os::arch::extra::LPCVOID;
+use prelude::v1::*;
+
 use io::{mod, IoError, IoResult, MemReader};
 use iter::repeat;
-use prelude::*;
+use libc::types::os::arch::extra::LPCVOID;
+use libc::{c_int, HANDLE, LPDWORD, DWORD, LPVOID};
+use libc::{get_osfhandle, CloseHandle};
 use ptr;
 use str::from_utf8;
+use super::c::{ENABLE_ECHO_INPUT, ENABLE_EXTENDED_FLAGS};
+use super::c::{ENABLE_INSERT_MODE, ENABLE_LINE_INPUT};
+use super::c::{ENABLE_PROCESSED_INPUT, ENABLE_QUICK_EDIT_MODE};
+use super::c::{ERROR_ILLEGAL_CHARACTER};
+use super::c::{ReadConsoleW, WriteConsoleW, GetConsoleMode, SetConsoleMode};
 
 fn invalid_encoding() -> IoError {
     IoError {
index a7b3ee996a34dc428bf77bb827feceb2ba5742ef..b6e16a8e6abf3ade81aa1f7b8ae554e5ac324726 100644 (file)
@@ -440,13 +440,15 @@ fn drop(&mut self) {
 
 #[cfg(test)]
 mod test {
-    use prelude::*;
+    use prelude::v1::*;
+
     use any::{Any, AnyRefExt};
     use boxed::BoxAny;
+    use comm::{channel, Sender};
     use result;
     use std::io::{ChanReader, ChanWriter};
-    use thunk::Thunk;
     use super::{Thread, Builder};
+    use thunk::Thunk;
 
     // !!! These tests are dangerous. If something is buggy, they will hang, !!!
     // !!! instead of exiting cleanly. This might wedge the buildbots.       !!!
index 14dd2a1ac9b587208c3426338331c8c498808f72..9d4e7936de21bb5c063ebcec1c9c35dbf040a797 100644 (file)
@@ -37,7 +37,7 @@
 #![macro_escape]
 #![experimental]
 
-use prelude::*;
+use prelude::v1::*;
 
 use cell::UnsafeCell;
 
@@ -248,7 +248,7 @@ pub fn destroyed(&'static self) -> bool {
 
 #[cfg(any(target_os = "macos", target_os = "linux"))]
 mod imp {
-    use prelude::*;
+    use prelude::v1::*;
 
     use cell::UnsafeCell;
     use intrinsics;
@@ -380,7 +380,7 @@ fn _tlv_atexit(dtor: unsafe extern fn(*mut u8),
 
 #[cfg(not(any(target_os = "macos", target_os = "linux")))]
 mod imp {
-    use prelude::*;
+    use prelude::v1::*;
 
     use cell::UnsafeCell;
     use mem;
@@ -453,8 +453,9 @@ unsafe fn ptr(&'static self) -> Option<*mut T> {
 
 #[cfg(test)]
 mod tests {
-    use prelude::*;
+    use prelude::v1::*;
 
+    use comm::{channel, Sender};
     use cell::UnsafeCell;
     use thread::Thread;
 
@@ -476,7 +477,7 @@ fn smoke_no_dtor() {
             *f.get() = 2;
         });
         let (tx, rx) = channel();
-        spawn(move|| {
+        let _t = Thread::spawn(move|| {
             FOO.with(|f| unsafe {
                 assert_eq!(*f.get(), 1);
             });
@@ -496,7 +497,7 @@ fn smoke_dtor() {
         });
 
         let (tx, rx) = channel();
-        spawn(move|| unsafe {
+        let _t = Thread::spawn(move|| unsafe {
             let mut tx = Some(tx);
             FOO.with(|f| {
                 *f.get() = Some(Foo(tx.take().unwrap()));
@@ -546,7 +547,7 @@ fn drop(&mut self) {
 
         Thread::spawn(move|| {
             drop(S1);
-        }).join();
+        }).join().ok().unwrap();
     }
 
     #[test]
@@ -564,7 +565,7 @@ fn drop(&mut self) {
 
         Thread::spawn(move|| unsafe {
             K1.with(|s| *s.get() = Some(S1));
-        }).join();
+        }).join().ok().unwrap();
     }
 
     #[test]
@@ -589,7 +590,7 @@ fn drop(&mut self) {
         }
 
         let (tx, rx) = channel();
-        spawn(move|| unsafe {
+        let _t = Thread::spawn(move|| unsafe {
             let mut tx = Some(tx);
             K1.with(|s| *s.get() = Some(S1(tx.take().unwrap())));
         });
@@ -599,7 +600,7 @@ fn drop(&mut self) {
 
 #[cfg(test)]
 mod dynamic_tests {
-    use prelude::*;
+    use prelude::v1::*;
 
     use cell::RefCell;
     use collections::HashMap;
index 5f96548c0530ac63badbeef3a827a5ddbc702b07..a2e2bd43849e223566da4c1420ecbd49d4851a8e 100644 (file)
@@ -40,7 +40,7 @@
 
 #![macro_escape]
 
-use prelude::*;
+use prelude::v1::*;
 
 // macro hygiene sure would be nice, wouldn't it?
 #[doc(hidden)] pub use self::imp::KeyInner;
@@ -238,7 +238,7 @@ pub unsafe fn get(&self) -> *mut T { self.inner.get() as *mut _ }
 #[cfg(test)]
 mod tests {
     use cell::Cell;
-    use prelude::*;
+    use prelude::v1::*;
 
     scoped_thread_local!(static FOO: uint);
 
index 5cd60d6e153ea0cf4bcd42f95b1d65bff8dc19a1..fc90bffa03c2f77975535bfa3a656baa62d1b687 100644 (file)
 //!
 //! # Examples
 //!
-//! Using methods:
+//! Using fields:
 //!
 //! ```
 //! #[allow(deprecated)]
 //! # fn main() {
 //! let pair = ("pi", 3.14f64);
-//! assert_eq!(pair.val0(), "pi");
-//! assert_eq!(pair.val1(), 3.14f64);
+//! assert_eq!(pair.0, "pi");
+//! assert_eq!(pair.1, 3.14f64);
 //! # }
 //! ```
 //!
index e61afb8b193af128f223c5568d539734c32a347c..5eac6546c6b82676270329955870fccf65a8ee84 100644 (file)
 //
 // ignore-lexer-test FIXME #15679
 
-//! The CodeMap tracks all the source code used within a single crate, mapping from integer byte
-//! positions to the original source code location. Each bit of source parsed during crate parsing
-//! (typically files, in-memory strings, or various bits of macro expansion) cover a continuous
-//! range of bytes in the CodeMap and are represented by FileMaps. Byte positions are stored in
-//! `spans` and used pervasively in the compiler. They are absolute positions within the CodeMap,
-//! which upon request can be converted to line and column information, source code snippets, etc.
+//! The CodeMap tracks all the source code used within a single crate, mapping
+//! from integer byte positions to the original source code location. Each bit
+//! of source parsed during crate parsing (typically files, in-memory strings,
+//! or various bits of macro expansion) cover a continuous range of bytes in the
+//! CodeMap and are represented by FileMaps. Byte positions are stored in
+//! `spans` and used pervasively in the compiler. They are absolute positions
+//! within the CodeMap, which upon request can be converted to line and column
+//! information, source code snippets, etc.
 
 pub use self::MacroFormat::*;
 
-use serialize::{Encodable, Decodable, Encoder, Decoder};
 use std::cell::RefCell;
+use std::num::ToPrimitive;
+use std::ops::{Add, Sub};
 use std::rc::Rc;
+
 use libc::c_uint;
+use serialize::{Encodable, Decodable, Encoder, Decoder};
 
 pub trait Pos {
     fn from_uint(n: uint) -> Self;
index 2844c0b523e5d63d54c11e7b16b2602ad5b5dc57..9f225d55b444fe787bf7d8f73ce40798f4f8fd9e 100644 (file)
@@ -17,7 +17,6 @@
 use ext::build::AstBuilder;
 use std::ascii::AsciiExt;
 
-
 pub fn expand_syntax_ext<'cx>(cx: &'cx mut ExtCtxt,
                               sp: Span,
                               tts: &[ast::TokenTree])
index d87960ebdb82af2d208268b9e4be8a50646309d2..e46bd7ac4bc73c07ab63472edc0a2dcd3a6a3988 100644 (file)
@@ -50,8 +50,7 @@ fn to_tokens(&self, _cx: &ExtCtxt) -> Vec<TokenTree> {
 
     impl<T: ToTokens> ToTokens for Vec<T> {
         fn to_tokens(&self, cx: &ExtCtxt) -> Vec<TokenTree> {
-            let a = self.iter().flat_map(|t| t.to_tokens(cx).into_iter());
-            FromIterator::from_iter(a)
+            self.iter().flat_map(|t| t.to_tokens(cx).into_iter()).collect()
         }
     }
 
index 3023c547fb05302e1eccc647a0c16577788085bc..f7d2331c9ec5850f0cf5740bbf7d0615295f766e 100644 (file)
@@ -8,8 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::fmt;
 use std::default::Default;
+use std::fmt;
+use std::iter::FromIterator;
+use std::ops::Deref;
 use std::vec;
 use serialize::{Encodable, Decodable, Encoder, Decoder};
 
index 13d020f6ae31b3cede3ef09e87d4daa58cfa152d..0f5ff33021cc94867a0f014b177896859ffd7c17 100644 (file)
@@ -16,6 +16,7 @@
 use parse::token;
 use parse::token::{str_to_ident};
 
+use std::borrow::IntoCow;
 use std::char;
 use std::fmt;
 use std::mem::replace;
@@ -358,7 +359,7 @@ pub fn nextch_is(&self, c: char) -> bool {
 
     pub fn nextnextch(&self) -> Option<char> {
         let offset = self.byte_offset(self.pos).to_uint();
-        let s = self.filemap.deref().src[];
+        let s = self.filemap.src.as_slice();
         if offset >= s.len() { return None }
         let str::CharRange { next, .. } = s.char_range_at(offset);
         if next < s.len() {
index 457085f5cc84878c61d935fe0ba8af1d5a83b6b4..832b112921e493829f4915b43b96c10ecaec9967 100644 (file)
 
 use std::collections::HashSet;
 use std::io::fs::PathExtensions;
+use std::iter;
 use std::mem;
 use std::num::Float;
 use std::rc::Rc;
-use std::iter;
 use std::slice;
+use std::str::from_str;
 
 bitflags! {
     flags Restrictions: u8 {
index f22a4b5c6ed10b30e09a85824afe5ad703e4f161..9c6644c520452548ab0bf18d744c6415d11a977d 100644 (file)
 use util::interner;
 
 use serialize::{Decodable, Decoder, Encodable, Encoder};
+use std::cmp::Equiv;
 use std::fmt;
 use std::mem;
+use std::ops::Deref;
 use std::path::BytesContainer;
 use std::rc::Rc;
 
index 1b3ebde2461e693fe47d1a1a93ec8798f08e952e..8b1aed483c34f76bc94d7d3698a95a880a475660 100644 (file)
 
 //! The AST pointer
 //!
-//! Provides `P<T>`, a frozen owned smart pointer, as a replacement for `@T` in the AST.
+//! Provides `P<T>`, a frozen owned smart pointer, as a replacement for `@T` in
+//! the AST.
 //!
 //! # Motivations and benefits
 //!
-//! * **Identity**: sharing AST nodes is problematic for the various analysis passes
-//!   (e.g. one may be able to bypass the borrow checker with a shared `ExprAddrOf`
-//!   node taking a mutable borrow). The only reason `@T` in the AST hasn't caused
-//!   issues is because of inefficient folding passes which would always deduplicate
-//!   any such shared nodes. Even if the AST were to switch to an arena, this would
-//!   still hold, i.e. it couldn't use `&'a T`, but rather a wrapper like `P<'a, T>`.
+//! * **Identity**: sharing AST nodes is problematic for the various analysis
+//!   passes (e.g. one may be able to bypass the borrow checker with a shared
+//!   `ExprAddrOf` node taking a mutable borrow). The only reason `@T` in the
+//!   AST hasn't caused issues is because of inefficient folding passes which
+//!   would always deduplicate any such shared nodes. Even if the AST were to
+//!   switch to an arena, this would still hold, i.e. it couldn't use `&'a T`,
+//!   but rather a wrapper like `P<'a, T>`.
 //!
 //! * **Immutability**: `P<T>` disallows mutating its inner `T`, unlike `Box<T>`
 //!   (unless it contains an `Unsafe` interior, but that may be denied later).
@@ -34,9 +36,9 @@
 //!   implementation changes (using a special thread-local heap, for example).
 //!   Moreover, a switch to, e.g. `P<'a, T>` would be easy and mostly automated.
 
-use std::fmt;
-use std::fmt::Show;
+use std::fmt::{mod, Show};
 use std::hash::Hash;
+use std::ops::Deref;
 use std::ptr;
 use serialize::{Encodable, Decodable, Encoder, Decoder};
 
index c1823231e24f75133f609268d2092d90273048b6..5a4d0cc3bd896cb69c58a07513bc5b2e4674b910 100644 (file)
@@ -152,7 +152,7 @@ fn fold_mod(&mut self, ast::Mod {inner, view_items, items}: ast::Mod) -> ast::Mo
         let prelude_path = ast::Path {
             span: DUMMY_SP,
             global: false,
-            segments: vec!(
+            segments: vec![
                 ast::PathSegment {
                     identifier: token::str_to_ident("std"),
                     parameters: ast::PathParameters::none(),
@@ -160,7 +160,12 @@ fn fold_mod(&mut self, ast::Mod {inner, view_items, items}: ast::Mod) -> ast::Mo
                 ast::PathSegment {
                     identifier: token::str_to_ident("prelude"),
                     parameters: ast::PathParameters::none(),
-                }),
+                },
+                ast::PathSegment {
+                    identifier: token::str_to_ident("v1"),
+                    parameters: ast::PathParameters::none(),
+                },
+            ],
         };
 
         let (crates, uses): (Vec<_>, _) = view_items.iter().cloned().partition(|x| {
index 97eb43165833abbfb36e5b7f9922f0b928ff1237..d25161a12a7419b774992d31e609c932473d1ea7 100644 (file)
 use ast::Name;
 
 use std::borrow::BorrowFrom;
-use std::collections::HashMap;
 use std::cell::RefCell;
+use std::cmp::Ordering;
+use std::collections::HashMap;
 use std::fmt;
 use std::hash::Hash;
+use std::ops::Deref;
 use std::rc::Rc;
 
 pub struct Interner<T> {
index 946181770c8e95d7437c88b21151046ba51aeaa6..953a7ae960e8c029d27721fbb9105ea7463bab8f 100644 (file)
@@ -7,9 +7,11 @@
 // <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.
+
 use self::SmallVectorRepr::*;
 use self::IntoIterRepr::*;
 
+use std::iter::FromIterator;
 use std::mem;
 use std::slice;
 use std::vec;
index 19821ecb7ca7a03b75effb31f911d7ed7b699eb3..87f791e6992337e25f12edc8356f64703334d274 100644 (file)
@@ -49,8 +49,6 @@
 use self::NamePadding::*;
 use self::OutputLocation::*;
 
-use std::any::{Any, AnyRefExt};
-use std::collections::BTreeMap;
 use stats::Stats;
 use getopts::{OptGroup, optflag, optopt};
 use regex::Regex;
 use term::Terminal;
 use term::color::{Color, RED, YELLOW, GREEN, CYAN};
 
+use std::any::{Any, AnyRefExt};
 use std::cmp;
+use std::collections::BTreeMap;
+use std::comm::{channel, Sender};
 use std::f64;
 use std::fmt::Show;
 use std::fmt;
 use std::iter::repeat;
 use std::num::{Float, FloatMath, Int};
 use std::os;
-use std::str::FromStr;
-use std::string::String;
+use std::str::{FromStr, from_str};
 use std::thread::{mod, Thread};
-use std::time::Duration;
 use std::thunk::{Thunk, Invoke};
+use std::time::Duration;
 
 // to be used by rustc to compile tests in libtest
 pub mod test {
@@ -1466,6 +1466,7 @@ mod tests {
                StaticTestName, DynTestName, DynTestFn, ShouldFail};
     use std::io::TempDir;
     use std::thunk::Thunk;
+    use std::comm::channel;
 
     #[test]
     pub fn do_not_run_ignored_tests() {
index 41146cded704c281779f9e925f66c0a76c6e7ddc..ed6a00a8e9115b9f3832fecb5d448643d9c3179f 100644 (file)
 
 #![allow(missing_docs)]
 
-use std::collections::hash_map;
+use std::cmp::Ordering::{mod, Less, Greater, Equal};
 use std::collections::hash_map::Entry::{Occupied, Vacant};
+use std::collections::hash_map;
 use std::fmt::Show;
 use std::hash::Hash;
 use std::io;
 use std::mem;
-use std::num::{Float, FloatMath};
+use std::num::{Float, FloatMath, FromPrimitive};
 
 fn local_cmp<T:Float>(x: T, y: T) -> Ordering {
     // arbitrarily decide that NaNs are larger than everything.
index 87a00334c478f914ecb668833ebd9ecafb1ba877..a6d9a542a49ede228684ab4181b9f739455080da 100644 (file)
 pub use self::ParseError::*;
 use self::Fmt::*;
 
-use std::fmt::Show;
-use std::fmt;
+use std::fmt::{mod, Show};
 use std::num::SignedInt;
-use std::string::String;
+use std::ops::{Add, Sub};
 use std::time::Duration;
 
 static NSEC_PER_SEC: i32 = 1_000_000_000_i32;
@@ -1274,6 +1273,7 @@ mod tests {
     #[cfg(windows)]
     fn set_time_zone() {
         use libc;
+        use std::c_str::ToCStr;
         // Windows crt doesn't see any environment variable set by
         // `SetEnvironmentVariable`, which `os::setenv` internally uses.
         // It is why we use `putenv` here.
index 1cccb0f7ccbe66b75a83c6c2ee2bd432fb5e54a3..e3dbe3c7e225abd829a7b6e8d3efa70d4f8e2892 100644 (file)
@@ -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();
index 811d8f116923980eb5cabe6f0fc7a536b609bfa4..ea4751bf4ed20b07c6b4871b7cfa8aafcbc50c72 100644 (file)
@@ -12,6 +12,7 @@
 #![crate_type = "lib"]
 
 use std::int;
+use std::str::from_str;
 
 pub trait read {
     fn readMaybe(s: String) -> Option<Self>;
index 61854aba2790de84b2fddf282aafc89bf35c84ab..7de34d52f513c235f426c0d53a46e4978f33d37b 100644 (file)
@@ -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 {
 }
index 9a6a2c7495b798b147b75f8244169046bfdcfc11..0b65fa913cb775a32ff44af546d08649f6c3b8ab 100644 (file)
@@ -10,6 +10,8 @@
 
 #![feature(unboxed_closures)]
 
+use std::ops::Add;
+
 #[inline]
 pub fn has_closures() -> uint {
     let x = 1u;
index 60331dfb5505a72cf8bb76f304fe9a2ad0fef066..0ada1cb991c6be80682edac8f8df45fb99825605 100644 (file)
@@ -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;
 
index 49f5c7751d9a0c5c1bb8ce85439ee0301074c6d2..52380001c6c0d4da69e9f38b729ac0ef376dfa09 100644 (file)
 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;
 
index 98113cb834767a61dc0d04403cbea148c95bff44..08637b4bf1c1c5777c291c2e45ed0e3ed64678e1 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 use std::os;
+use std::str::from_str;
 use std::uint;
 
 fn main() {
index 645c029f935a712a6023cc77dd0e17bdbf018d26..94b7e58a54c1c9d56736c975dff98932120302fd 100644 (file)
 // 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;
index ed96c6406d836d7b3cf264b240a095239bf581f7..4fb84c8610695e85d2c55d6a91371e9a4310f1b9 100644 (file)
@@ -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;
index 8ec44b2dd3c1405e896d54f95232083fd9389359..3ead5ef64fd9953b41ed1957f75a403207a32dc4 100644 (file)
@@ -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;
index 73d54372b274f0aa0330bf89f7e3a2e508360912..d3a340d488b57e084aa6cb9a3e2845685653ac80 100644 (file)
 // 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 run_pair(n: 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) {
index bdf22cd7395889aa8647f252189a6aeb8674f73c..0a513c32aafc827d9ad4ce1cb2733aebee20ef6c 100644 (file)
@@ -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);
 }
index e7a50382c9469a262dfbe09b373cb066831dcca0..f7810d5d740c0cb4adec5a0e3777047c4063e75f 100644 (file)
@@ -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 {
index 0b16e8011e8323975d96ef792b8070b18aff1610..2f25c37a911df3da6692bb1a76a074e26dd6fbb8 100644 (file)
@@ -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> {
index dcdb90a11c88ca89f48261efc52dc48d5c60a596..6bbf6cde4ea29f37b03bcc61a0a1357c9209c673 100644 (file)
 // 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();
 
index ef38f5ef74341a841d8ae2a7d4bef56617ae317a..ec1268c90803be7acb289fd229393d19feebe231 100644 (file)
@@ -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];
index 178d6777939d837ddf05cf878328ff51a8901ea9..09f7f236f19a79e4844deed1a7c159e4d1039d6c 100644 (file)
@@ -44,6 +44,7 @@
 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;
index 2de61cf3572c92c8cce0926f142df7ce48ff7e82..7009dd4c1a76fa8fde1700721ade27606a10536f 100644 (file)
 
 #![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;
index 10c0d0a8044cb62a0de70b5518ee9f9f34b0ca94..cbacf415f6f7fcef98d597fca54627bca86e6701 100644 (file)
@@ -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 {
index f49b648e21579ddc0729abefab817bab8f0295da..b59eef916dc095a93b800d8a7d9002f57d9a0225 100644 (file)
 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> >> >();
index a0ef392ed3af2d2310e78dfba1984b2b66cc2f66..3dc51805917127c9d0f75b8155c1d9a520f8718d 100644 (file)
@@ -43,7 +43,6 @@
 #![feature(slicing_syntax)]
 
 use std::ascii::OwnedAsciiExt;
-use std::string::String;
 use std::slice;
 use std::sync::{Arc, Future};
 
index bb0e09370d8e9e7b3492e6ea4906f20ef2acdddb..51ce4cbaa841d022adbdf447009cffb9fa67cc9e 100644 (file)
@@ -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;
index 9a3b6953062b4464e42effd44e77d84fa87ef300..2e229a50d16ef60574e98cd372158c9c8b62a263 100644 (file)
@@ -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
index dab67331120a9d6508477095c79c9891d30d2d13..6a325798f5805a71a62953c7fe71d9e7f12b75d9 100644 (file)
@@ -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;
index f7e8fc8fe1b7adb58199ff2bc45025d8b2141bf7..e58303a724adbd178903fb5de49291f648a11264 100644 (file)
 
 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;
 
index 909f8afc34a9fe68f5dd1fa1c92a1f7bbc4aebca..d9dfd65d5b34bd49fec61bf02444ec5b97ca2222 100644 (file)
 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() {
index df388fbdde54fd6a89866087186bbba5b279ebcc..a5af1227a165de5efdebda356b655310f16081b2 100644 (file)
 #![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<_>>();
 }
index 111a92b083aa38aa4d74cb2f4af9a9a183981f15..94d958ea8d5243f8e8f1086acb55c1ee339d4dac 100644 (file)
 // 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 (file)
index ca36d99..0000000
+++ /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|| {});
-}
index 576d96ba2a3559e52b44889da5250e3f447ad59a..035b222e6ce62073fc38e1194584f029c4236a88 100644 (file)
@@ -12,6 +12,7 @@
 
 use std::collections::VecMap;
 use std::os;
+use std::str::from_str;
 use std::time::Duration;
 use std::uint;
 
index 5fb7e2c3a84989b9095fece1f3675c352a09dc51..cccc9362a729ba6133a5f0ba0924bb72592cf024 100644 (file)
 
 #![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
 //
index 789ccb6142a118ee238c47b7e2ab1b2915e8106e..287b3fc6c460d5cea72c9da6660d802b2d11e994 100644 (file)
 
 // 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() {
index a6852d396d9cf2f3c7bb721e386eb548c9a11863..7e2c6fcf0ecd461c7e960a7690cb8722453da989 100644 (file)
@@ -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;
index 18534db0dd5a074450bc65b564b45f591d2d5980..90d5072f412e7827fe6fa4c7cbbd03882f64b8df 100644 (file)
@@ -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);
index 2bdd148b99bd0a528d9a9851aab96e62c47200fc..afa255be699e7bb701c07fdffda1e332964f0b09 100644 (file)
@@ -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`
index d9440e18375724196b3332e2ce9d24367bc0229f..e48c88a49f0bf25013f3eca312dfe7fb15ea9465 100644 (file)
@@ -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
     +
index 692303fc1e481f07849e3ee3ebee1ce75ffb572e..af9a18acbf2ad639d8ad7e9f0a858d5e74f453a4 100644 (file)
@@ -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>);
index b83e1544c96d39adfc5026873d41ecd8ba57547c..b571af2425a5c60a4799a665acc87f5e5fa172e0 100644 (file)
@@ -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,
index d9d7a43d46c41e60a275763c7ef16d943b6a6805..01afe405d5e12828589d383b9bdc252ed173f7bb 100644 (file)
@@ -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>,
 }
index 2253d7512c053c5615c45dbd5f702a5f789a28b0..e8949d4b30befd55320d2672a994b0d14d3343cc 100644 (file)
@@ -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,
index 0422f6381dc3d0fe61c2604d49f4d3d7eff977c0..933d0f15e4e7064219432bc368abcf2390750120 100644 (file)
@@ -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,
index 4c7ff60fbdd0f6440def7a3e0a5a39cad659b0af..6228b92472924fa582c24d1983ee7a2151d146b3 100644 (file)
@@ -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>) { }
 }
index 8cb4b6328c490dd5731b6cd598ea4a96c48ab704..83e329db0da2e48d61a2764d8bca9befea167343 100644 (file)
@@ -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() {
index 8c17895eb8a02e8dc5b309c61d46d7a19951eac9..296b4187a1f532ed2ce989dc15196794bd16379a 100644 (file)
@@ -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() {
index 1878b5f5dea8d670c561eeacdf4c1bb59200b66b..f42e1a1bc15edf22f5431c68dd704298453f20f4 100644 (file)
@@ -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`
index fc15801eb75b953ddd87dc3d9e558ba6211023a3..327f50ee059f961bdb917a0b2ecda6b8c259dccc 100644 (file)
@@ -11,6 +11,8 @@
 use std::ptr;
 use std::raw;
 
+trait Slice {}
+
 fn main() {
   unsafe {
     let nil: *const u8 = ptr::null();
index f64d8fee2d8b3948ab742cf2782ee6ca0d3e7628..c2e4629e14de0abcff762f8d46f599d88b25d688 100644 (file)
@@ -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 }
index 54100d543dda06084b5d933da974d81c45d1ee78..1e80fd7a7e91043ef10fce7e68e7156ce59002e8 100644 (file)
@@ -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;
index ccdc7b833e714401c32f84fd8b7d7a4f5aa06268..c458c539c0766f65875d26eefe748f33adf372a6 100644 (file)
@@ -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;
 
index cd5918e2f47ff5e5bb33527cf2171dbf4abf594b..312f26394b24d341abca24d7aaa96af11882c34e 100644 (file)
@@ -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
index b5e4cac75550f37e7e834bf68ea9e1cc540dc37e..bde5b853078f221d72224d8dcb9ae795a676aa26 100644 (file)
@@ -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
 }
index c2ebd764ad6b993c549e659b5d9c06a2c56d6967..35bd22880cef742dde2823838e252219c4497a6a 100644 (file)
@@ -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.
index 238d0ecdca7f8cc6b01b6081f45297df9b0071c4..45710408172d092a8a1c72e796de4500707f06ca 100644 (file)
@@ -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);
index 2abc58d8a4954f7b38f838fbc8128e1e8954e278..83c1696f7b2ab3fb367dff531b30c3075ce17c15 100644 (file)
@@ -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 { }
 
index c2b874c61a77fb1bcf364f32a546500ec92ad029..1f002ec79c61eb975ad5f4934ed68dbf6048fcf2 100644 (file)
@@ -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)]
index fb3e1b0272858c5e4e32a035a5e402949fb33fd6..46ad3f93b0bb79413ce84fdf424b663d4cecd0a0 100644 (file)
@@ -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 { }
index 1c156f6551c8d2264a07241aac146d5ad7c7c164..27a7cd909fefec1a7678878518317e339405b671 100644 (file)
@@ -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);
index 597e067b8b6ae22932dc63046b95403c5a39bfb6..c95cf0bfdee453d8c5a43bd9c20ecab323c39fb6 100644 (file)
@@ -12,6 +12,8 @@
 
 extern crate libc;
 
+use std::c_str::ToCStr;
+
 mod mlibc {
     use libc::{c_char, c_long, c_longlong};
 
index f2df5ef38c382025e99b05302095b45ed58259a3..4ed444f92ac92b34da999d80b34f29f91b1da658 100644 (file)
 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 @@ fn log(&mut self, record: &LogRecord) {
 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");
index cdcdad47ea49782a7c5ac98ef013c535409478fb..e1dc5802162eb8cd41d14f4bd3f08d20ee4978e0 100644 (file)
@@ -10,7 +10,7 @@
 
 #![feature(unboxed_closures)]
 
-use std::comm;
+use std::comm::channel;
 
 fn foo<F:FnOnce()+Send>(blk: F) {
     blk();
index cfba87c3f6994aef1b7795847f94bab737859796..fd040d109108fe173ceedc95a6bbe046babfe5b4 100644 (file)
@@ -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);
index edd4d5642b5bf9ac7e58d0fde35ad6c13f8ce593..119bdaff98ee812f13ce0b6325d4630625470cba 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 use std::task;
+use std::comm::{channel, Sender};
 
 pub fn main() {
     let (tx, rx) = channel();
index d6f0296619ab4e7ff62ab4ff97af53964390d71a..e0e8ca5618e50f0bdff3ed1143f395fb7d8333cf 100644 (file)
@@ -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;
index a0fa2d178b949641bbb26d0390f2710629bf20ef..198915fe02ed89e6ebc09e0e9618e9e3b5cfab89 100644 (file)
@@ -23,6 +23,8 @@
 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(()),
index dcf7c483b2cdc3b3bfc15de3ca4a790a50c85efa..5a98952c127d826264b827b3cfeeadb88289491d 100644 (file)
@@ -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;
 }
index 27e7d8f3ba2a42079dd419d8bb947b19a3675968..f245c11f0904b50156d0de983bd1ae8b4fe5bdfe 100644 (file)
@@ -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
 }
index b68d8058381d2322c67c3e97ee6787db203b4972..fb81dd558d2c4e2276fc52871a9b6d8c48ca7aac 100644 (file)
@@ -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") }
index 88f3e5775b78b8f09b10ac4786c7442f50566827..b8903d05cd89974681037a8ceb7794b38a7c4679 100644 (file)
@@ -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)]
index 24915d84e7eb1970d61a4b976b9cde878c9d4cdf..bca61ab1bd38718e2e2a1016565cf4fae3efe74d 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 use std::task;
+use std::comm::{channel, Sender};
 
 #[deriving(PartialEq, Show)]
 enum Message {
index c2707a1ae6e905e7c5ddba2325341432394f7a05..0cbcee3e253e1d54fa3f94517eda048cb315e790 100644 (file)
@@ -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]>
 }
index 43b7d116d30387803e98e21f598afc5221532c33..96a9c117dea46ee2aa18cae3f2122ab72e41af60 100644 (file)
@@ -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]>
 }
index d2812ce1d2ce9c19254d22782b0a5d52ed691c05..70d14ba3623237f967fb8e18d43c5957bdaedbe6 100644 (file)
@@ -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
index 750c0c8ed682ab63cf71643d6f35fc308f3c1541..8a75fdd685dd1055fb2515d5372182a30cb50cee 100644 (file)
 // 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"]
index a92b361dd3355cd95933f941f2aa5048d74e3194..6155ca6357237f00863164280d6fb25cfe073d94 100644 (file)
@@ -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;
 
index 06ab67f2f3e97f2efb3c2ae89504f5d5b1b017bc..33377d1f21726c92a3d1d95fbc733661d5cbea1e 100644 (file)
@@ -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
 }
index be851ddefc6451e0e8c4426b3d6555697def0fc9..e6da859c110e734cbeedb53735eb775e933bfd4e 100644 (file)
@@ -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);
index ea5bd550d53da5fa9027f6a4be67f1abd487f169..8aa7447ccd2e90f787ee74f6b7cae63938f1df48 100644 (file)
@@ -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> {
index f329e7eed0d5d5f823046b9db08efa3763118db3..b2b819a110305ec5265ebd396afab5ee8014b5f2 100644 (file)
@@ -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();
 }
index ebc879d82fbb1f197a074c512e5ba3819ed1ed99..0b9a85851c591a4bc3b0d0bb33f9779e97a79108 100644 (file)
@@ -10,6 +10,8 @@
 
 #![feature(unboxed_closures)]
 
+use std::ops::{Deref, DerefMut};
+
 struct X(Box<int>);
 
 static mut DESTRUCTOR_RAN: bool = false;
index f17f9411d15e803ab345fdd07b0dea36aad3f89f..df2a9e6bfa9094ab24da3f0cd54dcc8813329920 100644 (file)
@@ -11,6 +11,7 @@
 #![feature(default_type_params)]
 
 use std::task;
+use std::comm::Sender;
 use std::thunk::Invoke;
 
 type RingBuffer = Vec<f64> ;
index 80d3d29bc004d1b6d7a824a42efd7975f7c2139e..c88022f3eb706ce28541d2958bb0c0cac9393298 100644 (file)
@@ -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
index 86cdd6135ecf292f9fa8bf7d558dadd82efd2ba6..93c72e2e35091d493046d17dc7c9e2e3b15405e5 100644 (file)
@@ -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;
index daa80aec28c049ec2b668bea0ae90a3f6c04c4c6..871e52e3639541e263973e54216fa427a886098a 100644 (file)
@@ -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();
 }
index 3ea968c416f454f4643a586e51ecf560cc01e96d..6692988f6da29f5824f348dd58c7714845200f6b 100644 (file)
@@ -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>();
index b936eb322fc5ffc17506cde105d74a5e6dcf449a..43785edc2eb03782097add8a8c1c1ed79f64aaa3 100644 (file)
@@ -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)
 }
index 7397ad744950e5246e2402ea7576c61bef81b3df..4163ebf4573fcdb79b27db98ba448e2b59e75488 100644 (file)
@@ -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;
 }
 
index 588e0c1cf16cf28408369c965ff80e508303cba0..d3cbd556776401f93bef72cd1b7a155f6da7336a 100644 (file)
@@ -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(());
index 1f7edcf43b887f5f71cc3c679a4d2ccfb2c2ba5f..2e6127541a1a1bf02aaa2096f2aa3157cbc7c982 100644 (file)
@@ -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(
index 1e05c05cc0dd101b0f5afcfb7a00dbaad48220c0..509afff3d133bb204744467e0c64cadcbbf08675 100644 (file)
@@ -13,6 +13,7 @@
 
 use std::cell::Cell;
 use std::fmt;
+use std::thread::Thread;
 
 struct Foo(Cell<int>);
 
@@ -26,13 +27,10 @@ fn fmt(&self, _fmt: &mut fmt::Formatter) -> fmt::Result {
 }
 
 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();
 }
index 024dc4c03e1b706bbdf29accdfb8fdf95a725c5a..a6e579ddff3045091f33f64be39ef169ba2faa8a 100644 (file)
 
 #![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())
     }
 }
 
index 2109f7ef1eafc3f0fcd4b4c2cf9dc73291c91163..2cba1dec2dc99f587afc3026989cd5b031a52561 100644 (file)
@@ -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
index f8184d248ff0166bcd38f56180097ae7fff15e23..b4d079d79d650905b2cc8bd3e1c30f0de03cac4d 100644 (file)
@@ -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
index 674d0dc86da1cd35900a7e6ba06c0c6548a5551d..7aac2d705a854d293ec1ed4da203ea3df5bab79b 100644 (file)
@@ -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());
index 5c4befcd0c825563b3bcbacfdf168f8b2c1956eb..d1fb69b87a30e5b2ad76e2b5cb13d76d1051961b 100644 (file)
@@ -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]
 }
index f0daf371ca79e90d791b99ce4f25caa7ce6020c5..23a8285063ffb48a2c6c2888c27237e7eb051347 100644 (file)
@@ -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 @@ fn deref(&self) -> &Y {
 }
 
 mod priv_test {
+    use std::ops::Deref;
+
     pub struct DerefWrapperHideX<X, Y> {
         x: X,
         pub y: Y
index 2975b209d0690a20e550118a804134a87ad7fde8..222e2825c0404e0b17ddf0f40b775f7f2df235bd 100644 (file)
@@ -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")));
index 2e8ec3916bd89f5c5ace9e8513c9d9bf6e007e99..95df1ed0d837ed176e9536824f860a5a26eec7fe 100644 (file)
@@ -13,6 +13,7 @@
 #![feature(unboxed_closures)]
 
 use std::ops::Fn;
+use std::ops::Add;
 
 struct G;
 
index d51956da89409733dbb5e3edd7470ae1148f2801..dcb0c40c6088a95eecc651f32359efe8839ada78 100644 (file)
@@ -10,6 +10,8 @@
 
 // Test overloaded indexing combined with autoderef.
 
+use std::ops::{Index, IndexMut};
+
 struct Foo {
     x: int,
     y: int,
index e8b0408ca0dc00499fa53db06086c374e115de37..1c06ed64fc7b8a6112ad6d8e778869b857403d85 100644 (file)
@@ -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,
index 23bebfa35d7f305238ce801e1532c72aab545ef8..fdf7e7e2cbb13760197f4687aa5163aba340945a 100644 (file)
@@ -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,
index b5cee20232b632a301857a71c07eab59926b638b..c7aa405b513e465bb6404d80d57df928edb5e95b 100644 (file)
@@ -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;
index 4cf8c52f2bb44ab42d3b91c59cea9791905b2031..0aeade935dadba948ad8b765bc8879d291e50c9e 100644 (file)
 
 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
 }
index 88d30318f2a99c52ea473a860ac9db2b7a0b46aa..8e547527f7297700879b2fe4d58ca97fe1583ba6 100644 (file)
@@ -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 @@ fn log(&mut self, record: &log::LogRecord) {
 pub fn main() {
     let (logger, rx) = ChannelLogger::new();
 
-    spawn(move|| {
+    let _t = Thread::spawn(move|| {
         log::set_logger(logger);
 
         // our regex is "f.o"
index 6001c360ab99f64e86255bd881c64668dfc1c695..71620d05e014bb752e7c8b37731031b94eb99a14 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 use std::task;
+use std::comm::channel;
 
 struct test {
   f: int,
index 508bd99d77d7c962fef69e236f52464716274254..181874705da67770e867fc9d5a1bb03a732941d3 100644 (file)
@@ -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,
index 1b0f2ec0a327f72390f321ad9e116841a7e1113d..bfeff58b802df7150f2b5b4d37670a36bc2dfaed 100644 (file)
@@ -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();
index 24480d85272059a405ddeed726c2c8dcdd623c64..8c70738de48f19cc99a6a01469b5bd7d38172e91 100644 (file)
@@ -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();
index 007a83d2c88782dd921c27a93e1a3f2168d8cdb1..3d5f0af0e3f40001e82124d7f25f647660aba635 100644 (file)
@@ -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,
index 9b533c69f32091b1b16a2a72cfde8e3d9612fd5e..e3b2a2903bcbafa81b1f9c93031cc120ecc26fc5 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 use std::task;
+use std::comm::{channel, Sender};
 
 type ctx = Sender<int>;
 
index 873941395fead47c25e391e611694e91792b79bd..4465561f874eb737b64e1770d48cd6c04c54e083 100644 (file)
@@ -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;
index 9e3511ba6034f7ddc0592834b0f20074c56ad532..7c664b21fade574a201b8050c9d72485aa2729af 100644 (file)
@@ -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(); }
 
index dd3c90991f627a5ac9ef887c5da21f04cc0e4a24..c35e2f2f37a40dd8739462f9897db9f5558a03a6 100644 (file)
@@ -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();
index aefc91df4e780281c7bddad238a7a5d5f8d97406..10b4e51631176d1fc2fdb4014c3fb81477793345 100644 (file)
@@ -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>>) {
index c6c0691b74989874c75f73201a6bdc1b763d9d41..31da1168bf7eb75cb50081c23ef0caa468f58c7b 100644 (file)
@@ -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) {
index 0e48381366555fd626dd596be065f39e2e0211a9..8ec589d5db5fce8780012fceae016d405c50a1a2 100644 (file)
@@ -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() {
index 3095c2098ff339a1cb1760564c65aeb657906be0..b69644244ab4c49708eae69947a62d70d0c5f68d 100644 (file)
@@ -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) {
index 9143385254095bde1e0b850e62dc88fa79e0f452..5e71ed3ba06eb58871a236fafabf3d8847f26fa0 100644 (file)
@@ -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
index 73f6eb563c1ceb5b7da77e8d9ccc4bcc72bd29c4..c7a6da6a79417354e0240bd0bc537f911cf12e50 100644 (file)
@@ -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(); }
 
index 2e2b1fbff0ff7572e8b1a144c9e9fa8e9ec78660..0e75479046be665ba6650546574e46089d81f27b 100644 (file)
@@ -10,6 +10,8 @@
 
 #![allow(dead_assignment)]
 
+use std::comm::channel;
+
 pub fn main() { test00(); }
 
 fn test00() {
index e51e14f7fbe82eabefb6eacfa13dfd1296604246..d4edbf85cd833830a270a587cbf403ae2fb476ed 100644 (file)
@@ -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() {
index e783cd9b6beafbe7377984aa4b14291f2fed1411..4c18e5dc31357c8f8e9d45a0cf5bec4235b0bf26 100644 (file)
@@ -10,6 +10,8 @@
 
 #![allow(dead_assignment)]
 
+use std::comm::channel;
+
 pub fn main() { test00(); }
 
 fn test00() {
index 9d8caa426269b9248989cc0baf4493bff27012cf..e7e5c04e1954e80058854699803362a71f9e043e 100644 (file)
@@ -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(); }
index 69d70050437f18fcb87dd219af6c8eb3ddca09b2..5a271f9dc05fd70e4cf3942a8436f8b51f80c875 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 use std::thread::Thread;
+use std::comm::{channel, Sender};
 
 pub fn main() { test00(); }
 
index 3ea17898eada213886d38449085f3e9e7aa0602d..368cac1d27dfa130da10a930796d9e4401923290 100644 (file)
@@ -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.
index 8d6b6005a63bad6eb40f551d15a681e2a48469fa..1e10a4186fba9940030a0b521b31e9f95c97af20 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 use std::task;
+use std::comm::channel;
 
 pub fn main() {
     let (tx, rx) = channel::<uint>();
index ddeffcdf722048f2dd8405bfa19123988fa9e569..048d7b2be72253b7456730fecfc52bf2bca970fc 100644 (file)
@@ -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;
 
index 780cf23446639b414fb2550af3008825520e17e4..8f5a45cd1dd8c4f0e3940e9c76ffe3221b983e22 100644 (file)
 //              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));
 
index 2d087406fd6f77a2d31eed60be0227d4646f8c12..ea0141a0496942c3f4ea1ef9c99cc5243aa30956 100644 (file)
@@ -26,6 +26,7 @@
 use std::io::test::*;
 use std::io;
 use std::time::Duration;
+use std::comm::channel;
 
 #[cfg_attr(target_os = "freebsd", ignore)]
 fn eventual_timeout() {
index a866f497b8615ec0e523144bd005ce5b32b544d1..4fcdf49d971a164d3223fe247a2eca10b116f631 100644 (file)
@@ -23,6 +23,7 @@
 use std::io;
 use std::os;
 use std::task;
+use std::comm::channel;
 
 fn test_tempdir() {
     let path = {
index d2c1461d65d0b0b86a925af15e925366e66c5200..dd16514d83a61ad6a38224b4793b98105f982b96 100644 (file)
@@ -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 {
index 5f8e945cce8604d696c86ca9f2d37aecb1290e9d..1cd6e3ecebeb1c86957b2c90aa14eacfa2345b19 100644 (file)
@@ -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 { }
 
index 464ab1352281e566726107214a856a1322911046..1ff3ba3106b377235fb7a56a471106760c96438d 100644 (file)
@@ -13,6 +13,8 @@
   message.
  */
 
+use std::comm::channel;
+
 pub fn main() {
     let (tx, rx) = channel();
     tx.send(42i);
index 465c324122a44d5171213b317de7f0c06215dade..fdd85b71cd2702fabfe0fbf3ef83b50268c98496 100644 (file)
@@ -13,6 +13,8 @@
 
 #![feature(unboxed_closures)]
 
+use std::num::ToPrimitive;
+
 fn doit<T,F>(val: T, f: &F)
     where F : Fn(T)
 {
index 440292d202e486a2c011132288ed91e402db47d9..cce8cd64a14dba5e238019e2ba9714fc4314fefa 100644 (file)
@@ -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() {
index b279eb5fbba90284514ce96ae448a8d144586919..8497bf7f987a09ead3476071ea2bc061e6fc315c 100644 (file)
@@ -13,6 +13,8 @@
 
 #![feature(unboxed_closures)]
 
+use std::num::ToPrimitive;
+
 fn doit<T,F>(val: T, f: &F)
     where F : Fn(&T)
 {
index 672cd2d00e8bd4eb97fa3939174724ae3e62d90c..e66c8730898f8edfde855263b390d12c6369c823 100644 (file)
@@ -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);
index 22b5a8cdaa4bfdbd5a3c9586f067736dffd2d8de..0a661a51bf16cc98c4dba94bd815135fae5b0757 100644 (file)
@@ -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);
index 9789deef636490e9425ffe98689d8b856642640f..1284c938d55402dddae3c75b158786b67c87b9e7 100644 (file)
@@ -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 {
index f8eef98856114a9e1703ba5a044ac2a9b5971377..ec320c1f8a3092b2407ab68cb1a595ed9d111018 100644 (file)
@@ -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
index 577e114945c66ee33ed254b9a39c3ee681a07933..624b41767049cd8e9d0bd62b2090c2595fd841a4 100644 (file)
 
 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