librustc: Stop reexporting the standard modules from prelude.

This commit is contained in:
Patrick Walton 2013-05-24 19:35:29 -07:00
parent 4e3d4b36dc
commit 206ab89629
598 changed files with 1873 additions and 455 deletions

View File

@ -1840,6 +1840,7 @@ is bounds-checked at run-time. When the check fails, it will put the
task in a _failing state_.
~~~~
# use std::task;
# do task::spawn_unlinked {
([1, 2, 3, 4])[0];
@ -2168,7 +2169,7 @@ fn ten_times(f: &fn(int)) {
}
}
ten_times(|j| io::println(fmt!("hello, %d", j)));
ten_times(|j| println(fmt!("hello, %d", j)));
~~~~
@ -2189,7 +2190,7 @@ An example:
let mut i = 0;
while i < 10 {
io::println("hello\n");
println("hello\n");
i = i + 1;
}
~~~~
@ -2335,6 +2336,7 @@ for v.each |e| {
An example of a for loop over a series of integers:
~~~~
# use std::uint;
# fn bar(b:uint) { }
for uint::range(0, 256) |i| {
bar(i);
@ -2798,6 +2800,7 @@ the vtable pointer for the `T` implementation of `R`, and the pointer value of `
An example of an object type:
~~~~~~~~
# use std::int;
trait Printable {
fn to_str(&self) -> ~str;
}
@ -2807,7 +2810,7 @@ impl Printable for int {
}
fn print(a: @Printable) {
io::println(a.to_str());
println(a.to_str());
}
fn main() {

View File

@ -149,7 +149,9 @@ A type with the same functionality as owned boxes can be implemented by
wrapping `malloc` and `free`:
~~~~
use std::cast;
use std::libc::{c_void, size_t, malloc, free};
use std::ptr;
use std::unstable::intrinsics;
use std::util;

View File

@ -120,6 +120,7 @@ should interleave the output in vaguely random order.
~~~
# use std::io::print;
# use std::task::spawn;
# use std::int;
for int::range(0, 20) |child_task_number| {
do spawn {
@ -236,6 +237,7 @@ Instead we can use a `SharedChan`, a type that allows a single
~~~
# use std::task::spawn;
# use std::comm::{stream, SharedChan};
# use std::uint;
let (port, chan) = stream();
let chan = SharedChan::new(chan);
@ -269,6 +271,7 @@ might look like the example below.
~~~
# use std::task::spawn;
# use std::comm::stream;
# use std::vec;
// Create a vector of ports, one for each child task
let ports = do vec::from_fn(3) |init_val| {
@ -310,6 +313,8 @@ the future needs to be mutable so that it can save the result for next time `get
Here is another example showing how futures allow you to background computations. The workload will
be distributed on the available cores.
~~~
# use std::vec;
# use std::uint;
fn partial_sum(start: uint) -> f64 {
let mut local_sum = 0f64;
for uint::range(start*100000, (start+1)*100000) |num| {
@ -343,6 +348,9 @@ acts as a reference to the shared data and only this reference is shared and clo
Here is a small example showing how to use ARCs. We wish to run concurrently several computations on
a single large vector of floats. Each task needs the full vector to perform its duty.
~~~
# use std::vec;
# use std::uint;
# use std::rand;
use extra::arc::ARC;
fn pnorm(nums: &~[float], p: uint) -> float {
@ -350,7 +358,7 @@ fn pnorm(nums: &~[float], p: uint) -> float {
}
fn main() {
let numbers=vec::from_fn(1000000, |_| rand::random::<float>());
let numbers = vec::from_fn(1000000, |_| rand::random::<float>());
println(fmt!("Inf-norm = %?", numbers.max()));
let numbers_arc = ARC(numbers);
@ -373,12 +381,16 @@ at the power given as argument and takes the inverse power of this value). The A
created by the line
~~~
# use extra::arc::ARC;
# let numbers=vec::from_fn(1000000, |_| rand::random::<float>());
# use std::vec;
# use std::rand;
# let numbers = vec::from_fn(1000000, |_| rand::random::<float>());
let numbers_arc=ARC(numbers);
~~~
and a clone of it is sent to each task
~~~
# use extra::arc::ARC;
# use std::vec;
# use std::rand;
# let numbers=vec::from_fn(1000000, |_| rand::random::<float>());
# let numbers_arc = ARC(numbers);
# let (port, chan) = stream();
@ -389,6 +401,8 @@ copying only the wrapper and not its contents.
Each task recovers the underlying data by
~~~
# use extra::arc::ARC;
# use std::vec;
# use std::rand;
# let numbers=vec::from_fn(1000000, |_| rand::random::<float>());
# let numbers_arc=ARC(numbers);
# let (port, chan) = stream();
@ -416,6 +430,7 @@ of all tasks are intertwined: if one fails, so do all the others.
~~~
# use std::task::spawn;
# use std::task;
# fn do_some_work() { loop { task::yield() } }
# do task::try {
// Create a child task that fails
@ -437,6 +452,7 @@ field (representing a successful result) or an `Err` result (representing
termination with an error).
~~~
# use std::task;
# fn some_condition() -> bool { false }
# fn calculate_result() -> int { 0 }
let result: Result<int, ()> = do task::try {
@ -479,6 +495,7 @@ By default, task failure is _bidirectionally linked_, which means that if
either task fails, it kills the other one.
~~~
# use std::task;
# fn sleep_forever() { loop { task::yield() } }
# do task::try {
do spawn {
@ -501,6 +518,7 @@ before returning. Hence:
~~~
# use std::comm::{stream, Chan, Port};
# use std::task::{spawn, try};
# use std::task;
# fn sleep_forever() { loop { task::yield() } }
# do task::try {
let (receiver, sender): (Port<int>, Chan<int>) = stream();
@ -528,6 +546,7 @@ Supervised task failure propagates across multiple generations even if
an intermediate generation has already exited:
~~~
# use std::task;
# fn sleep_forever() { loop { task::yield() } }
# fn wait_for_a_while() { for 1000.times { task::yield() } }
# do task::try::<int> {
@ -546,6 +565,7 @@ Finally, tasks can be configured to not propagate failure to each
other at all, using `task::spawn_unlinked` for _isolated failure_.
~~~
# use std::task;
# fn random() -> uint { 100 }
# fn sleep_for(i: uint) { for i.times { task::yield() } }
# do task::try::<()> {
@ -574,6 +594,7 @@ Here is the function that implements the child task:
~~~~
# use extra::comm::DuplexStream;
# use std::uint;
fn stringifier(channel: &DuplexStream<~str, uint>) {
let mut value: uint;
loop {
@ -596,6 +617,7 @@ Here is the code for the parent task:
~~~~
# use std::task::spawn;
# use std::uint;
# use extra::comm::DuplexStream;
# fn stringifier(channel: &DuplexStream<~str, uint>) {
# let mut value: uint;

View File

@ -502,6 +502,7 @@ types.
> items.
~~~~
# use std::float;
fn angle(vector: (float, float)) -> float {
let pi = float::consts::pi;
match vector {
@ -556,6 +557,7 @@ while cake_amount > 0 {
`loop` denotes an infinite loop, and is the preferred way of writing `while true`:
~~~~
# use std::int;
let mut x = 5;
loop {
x += x - 3;
@ -699,6 +701,7 @@ get at their contents. All variant constructors can be used as
patterns, as in this definition of `area`:
~~~~
# use std::float;
# struct Point {x: float, y: float}
# enum Shape { Circle(Point, float), Rectangle(Point, Point) }
fn area(sh: Shape) -> float {
@ -1829,6 +1832,7 @@ vector consisting of the result of applying `function` to each element
of `vector`:
~~~~
# use std::vec;
fn map<T, U>(vector: &[T], function: &fn(v: &T) -> U) -> ~[U] {
let mut accumulator = ~[];
for vec::each(vector) |element| {
@ -2026,6 +2030,7 @@ themselves contain type parameters. A trait for generalized sequence
types might look like the following:
~~~~
# use std::vec;
trait Seq<T> {
fn len(&self) -> uint;
fn iter(&self, b: &fn(v: &T));

View File

@ -16,13 +16,13 @@
#[no_std];
extern mod core(name = "std", vers = "0.7-pre");
extern mod std(name = "extra", vers = "0.7-pre");
extern mod extra(name = "extra", vers = "0.7-pre");
use core::prelude::*;
use core::*;
use std::getopts;
use std::test;
use extra::getopts;
use extra::test;
use core::result::{Ok, Err};
@ -42,6 +42,13 @@ pub mod runtest;
pub mod common;
pub mod errors;
mod std {
pub use core::cmp;
pub use core::str;
pub use core::sys;
pub use core::unstable;
}
pub fn main() {
let args = os::args();
let config = parse_config(args);

View File

@ -10,6 +10,9 @@
use core::prelude::*;
use core::io;
use core::str;
pub struct ExpectedError { line: uint, kind: ~str, msg: ~str }
// Load any test directives embedded in the file

View File

@ -10,8 +10,12 @@
use core::prelude::*;
use common;
use common::config;
use common;
use core::io;
use core::os;
use core::str;
pub struct TestProps {
// Lines that should be expected, in order, on standard out

View File

@ -10,7 +10,13 @@
use core::prelude::*;
use core::comm;
use core::io;
use core::libc::c_int;
use core::os;
use core::run;
use core::str;
use core::task;
#[cfg(target_os = "win32")]
fn target_env(lib_path: &str, prog: &str) -> ~[(~str,~str)] {

View File

@ -22,6 +22,12 @@ use procsrv;
use util;
use util::logv;
use core::io;
use core::os;
use core::str;
use core::uint;
use core::vec;
pub fn run(config: config, testfile: ~str) {
if config.verbose {
// We're going to be dumping a lot of info. Start on a new line.

View File

@ -12,6 +12,7 @@ use core::prelude::*;
use common::config;
use core::io;
use core::os::getenv;
pub fn make_new_path(path: &str) -> ~str {

View File

@ -510,9 +510,13 @@ pub impl<'self, T:Const + Owned> RWReadMode<'self, T> {
#[cfg(test)]
mod tests {
use core::prelude::*;
use core::cell::Cell;
use arc::*;
use core::cell::Cell;
use core::comm;
use core::task;
#[test]
fn manually_share_arc() {
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
@ -541,59 +545,65 @@ mod tests {
#[test]
fn test_mutex_arc_condvar() {
let arc = ~MutexARC(false);
let arc2 = ~arc.clone();
let (p,c) = comm::oneshot();
let (c,p) = (Cell(c), Cell(p));
do task::spawn || {
// wait until parent gets in
comm::recv_one(p.take());
do arc2.access_cond |state, cond| {
*state = true;
cond.signal();
unsafe {
let arc = ~MutexARC(false);
let arc2 = ~arc.clone();
let (p,c) = comm::oneshot();
let (c,p) = (Cell(c), Cell(p));
do task::spawn || {
// wait until parent gets in
comm::recv_one(p.take());
do arc2.access_cond |state, cond| {
*state = true;
cond.signal();
}
}
}
do arc.access_cond |state, cond| {
comm::send_one(c.take(), ());
assert!(!*state);
while !*state {
cond.wait();
do arc.access_cond |state, cond| {
comm::send_one(c.take(), ());
assert!(!*state);
while !*state {
cond.wait();
}
}
}
}
#[test] #[should_fail] #[ignore(cfg(windows))]
fn test_arc_condvar_poison() {
let arc = ~MutexARC(1);
let arc2 = ~arc.clone();
let (p, c) = comm::stream();
unsafe {
let arc = ~MutexARC(1);
let arc2 = ~arc.clone();
let (p, c) = comm::stream();
do task::spawn_unlinked || {
let _ = p.recv();
do arc2.access_cond |one, cond| {
cond.signal();
// Parent should fail when it wakes up.
assert_eq!(*one, 0);
do task::spawn_unlinked || {
let _ = p.recv();
do arc2.access_cond |one, cond| {
cond.signal();
// Parent should fail when it wakes up.
assert_eq!(*one, 0);
}
}
}
do arc.access_cond |one, cond| {
c.send(());
while *one == 1 {
cond.wait();
do arc.access_cond |one, cond| {
c.send(());
while *one == 1 {
cond.wait();
}
}
}
}
#[test] #[should_fail] #[ignore(cfg(windows))]
fn test_mutex_arc_poison() {
let arc = ~MutexARC(1);
let arc2 = ~arc.clone();
do task::try || {
do arc2.access |one| {
assert_eq!(*one, 2);
unsafe {
let arc = ~MutexARC(1);
let arc2 = ~arc.clone();
do task::try || {
do arc2.access |one| {
assert_eq!(*one, 2);
}
};
do arc.access |one| {
assert_eq!(*one, 1);
}
};
do arc.access |one| {
assert_eq!(*one, 1);
}
}
#[test] #[should_fail] #[ignore(cfg(windows))]

View File

@ -12,6 +12,9 @@
use core::prelude::*;
use core::str;
use core::vec;
pub trait ToBase64 {
fn to_base64(&self) -> ~str;
}

View File

@ -10,6 +10,12 @@
use core::prelude::*;
use core::cmp;
use core::ops;
use core::uint;
use core::vec::from_elem;
use core::vec;
struct SmallBitv {
/// only the lowest nbits of this value are used. the rest is undefined.
bits: uint

View File

@ -38,6 +38,9 @@
use core::prelude::*;
use core::option;
use core::ptr;
/**
* The type representing a foreign chunk of memory
*

View File

@ -18,6 +18,7 @@ use core::prelude::*;
use core::comm::{GenericChan, GenericSmartChan, GenericPort};
use core::comm::{Chan, Port, Selectable, Peekable};
use core::comm;
use core::pipes;
/// An extension of `pipes::stream` that allows both sending and receiving.

View File

@ -12,7 +12,9 @@
use core::prelude::*;
use core::uint;
use core::util::replace;
use core::vec;
static initial_capacity: uint = 32u; // 2^5

View File

@ -21,6 +21,8 @@ Do not use ==, !=, <, etc on doubly-linked lists -- it may not terminate.
use core::prelude::*;
use core::managed;
use core::old_iter;
use core::vec;
pub type DListLink<T> = Option<@mut DListNode<T>>;
@ -538,6 +540,9 @@ mod tests {
use super::*;
use core::old_iter;
use core::vec;
#[test]
fn test_dlist_concat() {
let a = from_vec([1,2]);

View File

@ -96,6 +96,11 @@ total line count).
use core::prelude::*;
use core::io::ReaderUtil;
use core::io;
use core::os;
use core::vec;
/**
A summary of the internal state of a `FileInput` object. `line_num`
and `line_num_file` represent the number of lines read in total and in
@ -407,6 +412,11 @@ mod test {
use super::{FileInput, pathify, input_vec, input_vec_state};
use core::io;
use core::str;
use core::uint;
use core::vec;
fn make_file(path : &Path, contents: &[~str]) {
let file = io::file_writer(path, [io::Create, io::Truncate]).get();

View File

@ -16,8 +16,9 @@ Simple compression
use core::prelude::*;
use core::libc;
use core::libc::{c_void, size_t, c_int};
use core::libc;
use core::vec;
pub mod rustrt {
use core::libc::{c_int, c_void, size_t};

View File

@ -345,11 +345,11 @@ pub mod flatteners {
use core::cast;
use core::io::{Writer, Reader, ReaderUtil};
use core::io;
use core::ptr;
use core::sys::size_of;
use core::vec;
// FIXME #4074: Copy + Owned != POD
pub struct PodUnflattener<T> {
bogus: ()
@ -511,8 +511,10 @@ pub mod bytepipes {
use flatpipes::{ByteChan, BytePort};
use core::io::{Writer, Reader, ReaderUtil};
use core::comm::{Port, Chan};
use core::comm;
use core::io::{Writer, Reader, ReaderUtil};
use core::vec;
pub struct ReaderBytePort<R> {
reader: R
@ -646,7 +648,12 @@ mod test {
use flatpipes::{BytePort, FlatChan, FlatPort};
use net::tcp::TcpSocketBuf;
use core::comm;
use core::int;
use core::io::BytesWriter;
use core::result;
use core::sys;
use core::task;
#[test]
#[ignore(reason = "ebml failure")]
@ -873,6 +880,11 @@ mod test {
use flatpipes::pod;
use io_util::BufReader;
use core::comm;
use core::io;
use core::sys;
use core::task;
type PortLoader<P> =
~fn(~[u8]) -> FlatPort<int, PodUnflattener<int>, P>;

View File

@ -16,8 +16,14 @@
use core::prelude::*;
use core::io::{WriterUtil, ReaderUtil};
use core::char;
use core::float;
use core::hashmap::HashMap;
use core::io::{WriterUtil, ReaderUtil};
use core::io;
use core::str;
use core::to_str;
use core::vec;
use serialize::Encodable;
use serialize;
@ -1332,6 +1338,8 @@ mod tests {
use super::*;
use core::hashmap::HashMap;
use core::io;
use core::result;
use std::serialize::Decodable;

View File

@ -8,10 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! A standard linked list
//! A standard, garbage-collected linked list.
use core::prelude::*;
use core::vec;
#[deriving(Eq)]
pub enum List<T> {
Cons(T, @List<T>),

View File

@ -1451,6 +1451,10 @@ mod test {
use core::cell::Cell;
use core::comm::{stream, SharedChan};
use core::io;
use core::result;
use core::str;
use core::task;
// FIXME don't run on fbsd or linux 32 bit (#2064)
#[cfg(target_os="win32")]

View File

@ -19,7 +19,11 @@ A BigInt is a combination of BigUint and Sign.
use core::prelude::*;
use core::cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
use core::int;
use core::num::{IntConvertible, Zero, One, ToStrRadix, FromStrRadix, Orderable};
use core::str;
use core::uint;
use core::vec;
/**
A BigDigit is a BigUint's composing element.
@ -1148,8 +1152,13 @@ mod biguint_tests {
use core::prelude::*;
use super::*;
use core::num::{IntConvertible, Zero, One, FromStrRadix};
use core::cmp::{Less, Equal, Greater};
use core::int;
use core::num::{IntConvertible, Zero, One, FromStrRadix};
use core::str;
use core::uint;
use core::vec;
#[test]
fn test_from_slice() {
@ -1616,8 +1625,12 @@ mod bigint_tests {
use core::prelude::*;
use super::*;
use core::cmp::{Less, Equal, Greater};
use core::int;
use core::num::{IntConvertible, Zero, One, FromStrRadix};
use core::uint;
use core::vec;
#[test]
fn test_from_biguint() {

View File

@ -13,8 +13,11 @@
use core::prelude::*;
use core::num::{Zero,One,ToStrRadix,FromStrRadix,Round};
use core::cmp;
use core::from_str::FromStr;
use core::num::{Zero,One,ToStrRadix,FromStrRadix,Round};
use core::str;
use core::vec;
use super::bigint::BigInt;
/// Represents the ratio between 2 numbers.

View File

@ -10,6 +10,11 @@
use core::prelude::*;
use core::cast;
use core::ptr;
use core::sys;
use core::uint;
use core::vec;
use future_spawn = future::spawn;
/**

View File

@ -15,6 +15,7 @@ use core::prelude::*;
use core::old_iter::BaseIter;
use core::unstable::intrinsics::{move_val_init, init};
use core::util::{replace, swap};
use core::vec;
pub struct PriorityQueue<T> {
priv data: ~[T],

View File

@ -21,7 +21,10 @@ cycle cannot be created with `Rc<T>` because there is no way to modify it after
use core::prelude::*;
use core::cast;
use core::libc::{c_void, size_t, malloc, free};
use core::ptr;
use core::sys;
use core::unstable::intrinsics;
use core::util;

View File

@ -14,6 +14,8 @@
use core::prelude::*;
use core::libc::{c_char, c_int};
use core::local_data;
use core::str;
pub mod rustrt {
use core::libc::{c_char, c_int};

View File

@ -35,6 +35,10 @@
use core::prelude::*;
use core::str;
use core::uint;
use core::vec;
/// The type of ropes.
pub type Rope = node::Root;
@ -556,6 +560,11 @@ pub mod node {
use rope::node;
use core::cast;
use core::str;
use core::uint;
use core::vec;
/// Implementation of type `rope`
pub enum Root {
/// An empty rope
@ -1137,6 +1146,8 @@ pub mod node {
use rope::node::{Concat, Leaf, Node, height};
use core::vec;
pub struct T {
stack: ~[@Node],
stackpos: int,
@ -1176,6 +1187,8 @@ pub mod node {
pub mod char_iterator {
use core::prelude::*;
use core::str;
use rope::node::{Leaf, Node};
use rope::node::leaf_iterator;
@ -1258,9 +1271,14 @@ pub mod node {
#[cfg(test)]
mod tests {
use rope::*;
use core::prelude::*;
use rope::*;
use core::str;
use core::uint;
use core::vec;
//Utility function, used for sanity check
fn rope_to_string(r: Rope) -> ~str {
match (r) {

View File

@ -18,8 +18,11 @@ Core encoding and decoding interfaces.
use core::prelude::*;
use core::at_vec;
use core::hashmap::{HashMap, HashSet};
use core::trie::{TrieMap, TrieSet};
use core::uint;
use core::vec;
use deque::Deque;
use dlist::DList;
use treemap::{TreeMap, TreeSet};

View File

@ -15,11 +15,13 @@
use core::prelude::*;
use core::cmp;
use core::container::{Container, Mutable, Map, Set};
use core::old_iter::BaseIter;
use core::old_iter;
use core::option::{Some, None};
use core::uint;
use core::util::replace;
use core::vec;
pub struct SmallIntMap<T> {
priv v: ~[Option<T>],
@ -285,6 +287,11 @@ mod tests {
use super::SmallIntMap;
use core::local_data;
use core::rand;
use core::uint;
use core::vec;
#[test]
fn test_find_mut() {
let mut m = SmallIntMap::new();
@ -380,6 +387,8 @@ mod test_set {
use super::SmallIntSet;
use core::vec;
#[test]
fn test_disjoint() {
let mut xs = SmallIntSet::new();

View File

@ -13,9 +13,10 @@
use core::prelude::*;
use core::cmp::{Eq, Ord};
use core::uint;
use core::util::swap;
use core::vec::len;
use core::vec;
use core::util::swap;
type Le<'self, T> = &'self fn(v1: &T, v2: &T) -> bool;
@ -926,7 +927,12 @@ mod test_tim_sort {
use core::prelude::*;
use sort::tim_sort;
use core::local_data;
use core::rand::RngUtil;
use core::rand;
use core::uint;
use core::vec;
struct CVal {
val: float,
@ -1019,7 +1025,12 @@ mod big_tests {
use core::prelude::*;
use sort::*;
use core::local_data;
use core::rand::RngUtil;
use core::rand;
use core::uint;
use core::vec;
#[test]
fn test_unique() {

View File

@ -133,6 +133,9 @@ pub mod std {
pub use core::condition;
pub use core::cmp;
pub use core::sys;
pub use core::unstable;
pub use core::str;
pub use core::os;
}
#[doc(hidden)]
pub mod extra {

View File

@ -17,9 +17,10 @@
use core::prelude::*;
use core::unstable::sync::{Exclusive, exclusive};
use core::comm;
use core::ptr;
use core::task;
use core::unstable::sync::{Exclusive, exclusive};
use core::util;
/****************************************************************************
@ -728,6 +729,8 @@ mod tests {
use core::cast;
use core::cell::Cell;
use core::comm;
use core::ptr;
use core::result;
use core::task;
use core::vec;

View File

@ -14,6 +14,7 @@
use core::prelude::*;
use core::comm::Chan;
use core::comm;
use core::task::SchedMode;
use core::task;
use core::vec;
@ -101,6 +102,6 @@ fn test_task_pool() {
};
let mut pool = TaskPool::new(4, Some(SingleThreaded), f);
for 8.times {
pool.execute(|i| io::println(fmt!("Hello from thread %u!", *i)));
pool.execute(|i| println(fmt!("Hello from thread %u!", *i)));
}
}

View File

@ -12,7 +12,9 @@
use core::prelude::*;
use core::os;
use core::rand::RngUtil;
use core::rand;
pub fn mkdtemp(tmpdir: &Path, suffix: &str) -> Option<Path> {
let mut r = rand::rng();
@ -30,7 +32,10 @@ mod tests {
use core::prelude::*;
use tempfile::mkdtemp;
use tempfile;
use core::os;
use core::str;
#[test]
fn test_mkdtemp() {

View File

@ -21,8 +21,18 @@ use getopts;
use sort;
use term;
use core::to_str::ToStr;
use core::comm::{stream, SharedChan};
use core::either;
use core::io;
use core::num;
use core::option;
use core::result;
use core::str;
use core::task;
use core::to_str::ToStr;
use core::u64;
use core::uint;
use core::vec;
pub mod rustrt {
use core::libc::size_t;
@ -601,10 +611,14 @@ fn calc_result(desc: &TestDesc, task_succeeded: bool) -> TestResult {
pub mod bench {
use core::prelude::*;
use time::precise_time_ns;
use test::{BenchHarness, BenchSamples};
use stats::Stats;
use core::num;
use core::rand::RngUtil;
use core::rand;
use core::u64;
use core::vec;
use stats::Stats;
use test::{BenchHarness, BenchSamples};
use time::precise_time_ns;
pub impl BenchHarness {

View File

@ -10,6 +10,11 @@
use core::prelude::*;
use core::i32;
use core::int;
use core::io;
use core::str;
static NSEC_PER_SEC: i32 = 1_000_000_000_i32;
pub mod rustrt {

View File

@ -19,6 +19,7 @@ use uv::iotask::IoTask;
use core::cast::transmute;
use core::cast;
use core::comm::{stream, Chan, SharedChan, Port, select2i};
use core::either;
use core::libc::c_void;
use core::libc;
@ -179,9 +180,12 @@ mod test {
use timer::*;
use uv;
use core::cell::Cell;
use core::rand::RngUtil;
use core::pipes::{stream, SharedChan};
use core::rand::RngUtil;
use core::rand;
use core::task;
#[test]
fn test_gl_timer_simple_sleep_test() {

View File

@ -15,6 +15,7 @@
use core::prelude::*;
use core::iterator::*;
use core::uint;
use core::util::{swap, replace};
// This is implemented as an AA tree, which is a simplified variation of
@ -701,9 +702,13 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>,
mod test_treemap {
use core::prelude::*;
use core::iterator::*;
use super::*;
use core::iterator::*;
use core::rand::RngUtil;
use core::rand;
use core::str;
use core::vec;
#[test]
fn find_empty() {
@ -1021,8 +1026,11 @@ mod test_treemap {
mod test_set {
use core::prelude::*;
use core::iterator::*;
use super::*;
use core::vec;
#[test]
fn test_clear() {
let mut s = TreeSet::new();

View File

@ -16,7 +16,9 @@ use iotask = uv_iotask;
use uv_iotask::{IoTask, spawn_iotask};
use core::comm::Chan;
use core::libc;
use core::option::{Some, None};
use core::str;
use core::task::task;
use core::unstable::global::{global_data_clone_create, global_data_clone};
use core::unstable::weak_task::weaken_task;

View File

@ -22,6 +22,7 @@ use ll = uv_ll;
use core::comm::{stream, Port, Chan, SharedChan};
use core::libc::c_void;
use core::libc;
use core::task;
/// Used to abstract-away direct interaction with a libuv loop.
pub struct IoTask {
@ -223,6 +224,8 @@ struct AhData {
#[cfg(test)]
fn impl_uv_iotask_async(iotask: &IoTask) {
use core::ptr;
let async_handle = ll::async_t();
let ah_ptr: *ll::uv_async_t = &async_handle;
let (exit_po, exit_ch) = stream::<()>();

View File

@ -34,9 +34,12 @@
use core::prelude::*;
use core::libc::size_t;
use core::libc::c_void;
use core::libc::{c_void, size_t};
use core::libc;
use core::ptr::to_unsafe_ptr;
use core::ptr;
use core::str;
use core::vec;
pub type uv_handle_t = c_void;
pub type uv_loop_t = c_void;
@ -1225,9 +1228,17 @@ pub unsafe fn addrinfo_as_sockaddr_in6(input: *addrinfo) -> *sockaddr_in6 {
#[cfg(test)]
mod test {
use core::prelude::*;
use core::comm::{SharedChan, stream, GenericChan, GenericPort};
use super::*;
use core::comm::{SharedChan, stream, GenericChan, GenericPort};
use core::libc;
use core::result;
use core::str;
use core::sys;
use core::task;
use core::vec;
enum tcp_read_data {
tcp_read_eof,
tcp_read_more(~[u8]),

View File

@ -21,7 +21,9 @@ use core::comm::{PortOne, oneshot, send_one, recv_one};
use core::either::{Either, Left, Right};
use core::hashmap::HashMap;
use core::io;
use core::result;
use core::run;
use core::task;
use core::to_bytes;
use core::util::replace;

View File

@ -28,7 +28,16 @@ extern mod extra(name = "extra", vers = "0.7-pre");
extern mod syntax(vers = "0.7-pre");
use std::prelude::*;
use std::int;
use std::io;
use std::option;
use std::os;
use std::result;
use std::run;
use std::str;
use std::uint;
use std::vec;
use syntax::diagnostic;
use syntax::parse::token::ident_interner;

View File

@ -31,8 +31,18 @@ extern mod rustc;
use core::prelude::*;
use core::io;
use core::os;
use core::run;
use core::libc::exit;
use core::str;
// For bootstrapping.
mod std {
pub use core::os;
pub use core::str;
pub use core::unstable;
}
enum ValidUsage {
Valid(int), Invalid

View File

@ -22,12 +22,17 @@ use middle::trans::common::CrateContext;
use middle::ty;
use util::ppaux;
use core::char;
use core::hash::Streaming;
use core::hash;
use core::libc::{c_int, c_uint};
use core::os::consts::{macos, freebsd, linux, android, win32};
use core::os;
use core::ptr;
use core::rt::io::Writer;
use core::run;
use core::str;
use core::vec;
use syntax::ast;
use syntax::ast_map::{path, path_mod, path_name};
use syntax::attr;
@ -100,7 +105,12 @@ pub mod jit {
use lib::llvm::{ModuleRef, PassManagerRef};
use metadata::cstore;
use core::cast;
use core::char;
use core::libc::c_int;
use core::os;
use core::ptr;
use core::str;
pub mod rusti {
#[nolink]
@ -188,6 +198,7 @@ pub mod write {
use core::libc::{c_int, c_uint};
use core::path::Path;
use core::run;
use core::str;
pub fn is_object_or_assembly_or_exe(ot: output_type) -> bool {
if ot == output_type_assembly || ot == output_type_object ||

View File

@ -14,8 +14,11 @@ use driver::session;
use metadata::cstore;
use metadata::filesearch;
use core::util;
use core::hashmap::HashSet;
use core::os;
use core::uint;
use core::util;
use core::vec;
fn not_win32(os: session::os) -> bool {
match os {
@ -210,6 +213,13 @@ pub fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] {
mod test {
use core::prelude::*;
use core::os;
use core::str;
// FIXME(#2119): the outer attribute should be #[cfg(unix, test)], then
// these redundant #[cfg(test)] blocks can be removed
#[cfg(test)]
#[cfg(test)]
use back::rpath::{get_absolute_rpath, get_install_prefix_rpath};
use back::rpath::{get_relative_to, get_rpath_relative_to_output};
use back::rpath::{minimize_rpaths, rpaths_to_flags};

View File

@ -10,6 +10,8 @@
use core::prelude::*;
use core::option;
use core::vec;
use syntax::{ast, fold, attr};
type in_cfg_pred = @fn(attrs: ~[ast::attribute]) -> bool;

View File

@ -10,6 +10,7 @@
use core::prelude::*;
use core::vec;
use driver::session::Session;
use syntax::parse;
use syntax::ast;

View File

@ -12,10 +12,11 @@ use core::prelude::*;
use driver::session::Session;
use core::vec;
use syntax::ast;
use syntax::attr;
use syntax::codemap;
use syntax::codemap::dummy_sp;
use syntax::codemap;
use syntax::fold;
static STD_VERSION: &'static str = "0.7-pre";

View File

@ -15,6 +15,7 @@ use core::prelude::*;
use driver::session;
use front::config;
use core::vec;
use syntax::ast_util::*;
use syntax::attr;
use syntax::codemap::{dummy_sp, span, ExpandedFrom, CallInfo, NameAndSpan};
@ -309,7 +310,7 @@ fn mk_test_module(cx: &TestCtxt) -> @ast::item {
let mainfn = (quote_item!(
pub fn main() {
#[main];
extra::test::test_main_static(::os::args(), tests);
extra::test::test_main_static(::std::os::args(), tests);
}
)).get();

View File

@ -12,6 +12,10 @@ use core::prelude::*;
use core::hashmap::HashMap;
use core::libc::{c_uint, c_ushort};
use core::option;
use core::ptr;
use core::str;
use core::vec;
pub type Opcode = u32;
pub type Bool = c_uint;

View File

@ -18,6 +18,7 @@ use metadata::filesearch::FileSearch;
use metadata::loader;
use core::hashmap::HashMap;
use core::vec;
use syntax::attr;
use syntax::codemap::{span, dummy_sp};
use syntax::diagnostic::span_handler;

View File

@ -18,6 +18,7 @@ use metadata::decoder;
use metadata;
use middle::{ty, resolve};
use core::vec;
use reader = extra::ebml::reader;
use syntax::ast;
use syntax::ast_map;

View File

@ -18,6 +18,7 @@ use metadata::cstore;
use metadata::decoder;
use core::hashmap::HashMap;
use core::vec;
use extra;
use syntax::ast;
use syntax::parse::token::ident_interner;

View File

@ -22,9 +22,14 @@ use middle::ty;
use middle;
use util::ppaux::ty_to_str;
use extra::flate;
use core::hash::HashUtil;
use core::hashmap::HashMap;
use core::int;
use core::io;
use core::str;
use core::uint;
use core::vec;
use extra::flate;
use extra::serialize::Encodable;
use extra;
use syntax::abi::AbiSet;
@ -34,10 +39,10 @@ use syntax::ast_map;
use syntax::ast_util::*;
use syntax::attr;
use syntax::diagnostic::span_handler;
use syntax::parse::token::special_idents;
use syntax::{ast_util, visit};
use syntax::opt_vec::OptVec;
use syntax::opt_vec;
use syntax::parse::token::special_idents;
use syntax::{ast_util, visit};
use syntax;
use writer = extra::ebml::writer;

View File

@ -10,6 +10,11 @@
use core::prelude::*;
use core::option;
use core::os;
use core::result;
use core::str;
// A module for searching for libraries
// FIXME (#2658): I'm not happy how this module turned out. Should
// probably just be folded into cstore.

View File

@ -23,8 +23,15 @@ use syntax::parse::token::ident_interner;
use syntax::print::pprust;
use syntax::{ast, attr};
use extra::flate;
use core::cast;
use core::io;
use core::option;
use core::os::consts::{macos, freebsd, linux, android, win32};
use core::ptr;
use core::str;
use core::uint;
use core::vec;
use extra::flate;
pub enum os {
os_macos,

View File

@ -18,6 +18,9 @@ use core::prelude::*;
use middle::ty;
use core::str;
use core::uint;
use core::vec;
use syntax::abi::AbiSet;
use syntax::abi;
use syntax::ast;

View File

@ -25,6 +25,9 @@ use middle::{ty, typeck, moves};
use middle;
use util::ppaux::ty_to_str;
use core::at_vec;
use core::str;
use core::uint;
use extra::ebml::reader;
use extra::ebml;
use extra::serialize;

View File

@ -19,17 +19,18 @@
use core::prelude::*;
use middle::moves;
use middle::borrowck::*;
use mc = middle::mem_categorization;
use middle::ty;
use util::ppaux::Repr;
use core::hashmap::HashSet;
use core::uint;
use mc = middle::mem_categorization;
use middle::borrowck::*;
use middle::moves;
use middle::ty;
use syntax::ast::{m_mutbl, m_imm, m_const};
use syntax::ast;
use syntax::ast_util;
use syntax::visit;
use syntax::codemap::span;
use syntax::visit;
use util::ppaux::Repr;
struct CheckLoanCtxt<'self> {
bccx: @BorrowckCtxt,

View File

@ -12,6 +12,7 @@
use core::prelude::*;
use core::vec;
use middle::borrowck::*;
use mc = middle::mem_categorization;
use middle::ty;

View File

@ -23,8 +23,9 @@ use util::ppaux::{note_and_explain_region, Repr, UserString};
use core::hashmap::{HashSet, HashMap};
use core::io;
use core::result::{Result};
use core::ops::{BitOr, BitAnd};
use core::result::{Result};
use core::str;
use syntax::ast;
use syntax::ast_map;
use syntax::visit;

View File

@ -16,7 +16,9 @@ comments in the section "Moves and initialization" and in `doc.rs`.
*/
use core::prelude::*;
use core::hashmap::{HashMap, HashSet};
use core::uint;
use middle::borrowck::*;
use middle::dataflow::DataFlowContext;
use middle::dataflow::DataFlowOperator;

View File

@ -19,6 +19,8 @@ use middle::typeck::method_map;
use middle::moves;
use util::ppaux::ty_to_str;
use core::uint;
use core::vec;
use extra::sort;
use syntax::ast::*;
use syntax::ast_util::{unguarded_pat, walk_pat};

View File

@ -18,7 +18,9 @@ use middle;
use syntax::{ast, ast_map, ast_util, visit};
use syntax::ast::*;
use core::float;
use core::hashmap::{HashMap, HashSet};
use core::vec;
//
// This pass classifies expressions by their constant-ness.

View File

@ -19,7 +19,10 @@
use core::prelude::*;
use core::cast;
use core::io;
use core::str;
use core::uint;
use core::vec;
use syntax::ast;
use syntax::ast_util;
use syntax::ast_util::id_range;

View File

@ -73,15 +73,17 @@ pub fn check_crate(tcx: ty::ctxt,
let visitor = visit::mk_vt(@visit::Visitor {
visit_fn: |fn_kind, fn_decl, block, span, node_id, _, visitor| {
let is_unsafe_fn = match *fn_kind {
fk_item_fn(_, _, purity, _) => purity == unsafe_fn,
fk_method(_, _, method) => method.purity == unsafe_fn,
_ => false,
let (is_item_fn, is_unsafe_fn) = match *fn_kind {
fk_item_fn(_, _, purity, _) => (true, purity == unsafe_fn),
fk_method(_, _, method) => (true, method.purity == unsafe_fn),
_ => (false, false),
};
let old_unsafe_context = context.unsafe_context;
if is_unsafe_fn {
context.unsafe_context = UnsafeFn
} else if is_item_fn {
context.unsafe_context = SafeContext
}
visit::visit_fn(fn_kind,
@ -97,7 +99,8 @@ pub fn check_crate(tcx: ty::ctxt,
visit_block: |block, _, visitor| {
let old_unsafe_context = context.unsafe_context;
if block.node.rules == unsafe_blk {
if block.node.rules == unsafe_blk &&
context.unsafe_context == SafeContext {
context.unsafe_context = UnsafeBlock(block.node.id)
}

View File

@ -17,6 +17,7 @@ use middle::resolve;
use middle::ty;
use core::hashmap::HashMap;
use core::vec;
use syntax::codemap::span;
use syntax::{ast, ast_util, visit};

View File

@ -18,6 +18,7 @@ use middle::typeck;
use util::ppaux::{Repr, ty_to_str};
use util::ppaux::UserString;
use core::vec;
use syntax::ast::*;
use syntax::attr::attrs_contains_name;
use syntax::codemap::span;

View File

@ -15,7 +15,19 @@ use middle::ty;
use middle::pat_util;
use util::ppaux::{ty_to_str};
use core::char;
use core::cmp;
use core::hashmap::HashMap;
use core::i16;
use core::i32;
use core::i64;
use core::i8;
use core::str;
use core::u16;
use core::u32;
use core::u64;
use core::u8;
use core::vec;
use extra::smallintmap::SmallIntMap;
use syntax::attr;
use syntax::codemap::span;

View File

@ -112,6 +112,11 @@ use middle::moves;
use core::cast::transmute;
use core::hashmap::HashMap;
use core::io;
use core::old_iter;
use core::to_str;
use core::uint;
use core::vec;
use syntax::ast::*;
use syntax::codemap::span;
use syntax::parse::token::special_idents;

View File

@ -53,6 +53,7 @@ use middle::typeck;
use util::ppaux::{ty_to_str, region_to_str, Repr};
use util::common::indenter;
use core::uint;
use syntax::ast::{m_imm, m_const, m_mutbl};
use syntax::ast;
use syntax::codemap::span;

View File

@ -136,6 +136,7 @@ use util::ppaux;
use util::ppaux::Repr;
use util::common::indenter;
use core::at_vec;
use core::hashmap::{HashSet, HashMap};
use syntax::ast::*;
use syntax::ast_util;

View File

@ -39,8 +39,10 @@ use syntax::visit::{visit_foreign_item, visit_item};
use syntax::visit::{visit_mod, visit_ty, vt};
use syntax::opt_vec::OptVec;
use core::option::Some;
use core::str::each_split_str;
use core::str;
use core::uint;
use core::vec;
use core::hashmap::{HashMap, HashSet};
use core::util;

View File

@ -168,6 +168,7 @@ use middle::ty;
use util::common::indenter;
use core::hashmap::HashMap;
use core::vec;
use syntax::ast;
use syntax::ast::ident;
use syntax::ast_util::path_to_ident;

View File

@ -20,6 +20,7 @@ use middle::trans::callee;
use middle::trans::common::*;
use middle::ty;
use core::str;
use syntax::ast;
// Take an inline assembly expression and splat it out via LLVM

View File

@ -66,7 +66,12 @@ use util::ppaux::{Repr, ty_to_str};
use core::hash;
use core::hashmap::{HashMap, HashSet};
use core::int;
use core::io;
use core::libc::c_uint;
use core::str;
use core::uint;
use core::vec;
use extra::time;
use syntax::ast::ident;
use syntax::ast_map::{path, path_elt_to_str, path_name};

View File

@ -19,8 +19,11 @@ use middle::trans::common::*;
use middle::trans::machine::llalign_of_min;
use syntax::codemap::span;
use core::cast;
use core::hashmap::HashMap;
use core::libc::{c_uint, c_ulonglong, c_char};
use core::str;
use core::vec;
pub fn terminate(cx: block, _: &str) {
cx.terminated = true;

View File

@ -11,6 +11,9 @@
use core::prelude::*;
use core::libc::c_uint;
use core::ptr;
use core::uint;
use core::vec;
use lib::llvm::{llvm, TypeRef, Integer, Pointer, Float, Double};
use lib::llvm::{Struct, Array, Attribute};
use lib::llvm::{StructRetAttribute};

View File

@ -43,6 +43,7 @@ use middle::ty;
use middle::typeck;
use util::ppaux::Repr;
use core::vec;
use syntax::ast;
use syntax::ast_map;
use syntax::visit;

View File

@ -26,6 +26,8 @@ use middle::trans::type_of::*;
use middle::ty;
use util::ppaux::ty_to_str;
use core::str;
use core::vec;
use syntax::ast;
use syntax::ast_map::path_name;
use syntax::ast_util;

View File

@ -40,11 +40,15 @@ use middle::borrowck::root_map_key;
use util::ppaux::{Repr};
use core::cast::transmute;
use core::cast;
use core::hash;
use core::hashmap::{HashMap, HashSet};
use core::libc::{c_uint, c_longlong, c_ulonglong};
use core::ptr;
use core::str;
use core::to_bytes;
use core::vec::raw::to_ptr;
use core::vec;
use syntax::ast::ident;
use syntax::ast_map::{path, path_elt};
use syntax::codemap::span;

View File

@ -31,6 +31,7 @@ use middle::ty;
use util::ppaux::{Repr, ty_to_str};
use core::libc::c_uint;
use core::str;
use syntax::{ast, ast_util, ast_map};
pub fn const_lit(cx: @CrateContext, e: @ast::expr, lit: ast::lit)

View File

@ -24,6 +24,8 @@ use middle::ty;
use util::common::indenter;
use util::ppaux;
use core::str;
use core::vec;
use syntax::ast;
use syntax::ast::ident;
use syntax::ast_map::path_mod;

View File

@ -104,6 +104,7 @@ use util::common::indenter;
use util::ppaux::ty_to_str;
use core::to_bytes;
use core::uint;
use syntax::ast;
use syntax::codemap::span;
use syntax::parse::token::special_idents;

View File

@ -20,8 +20,14 @@ use middle::trans;
use middle::ty;
use util::ppaux::ty_to_str;
use core::cast;
use core::hashmap::HashMap;
use core::libc;
use core::option;
use core::ptr;
use core::str;
use core::sys;
use core::vec;
use syntax::codemap::span;
use syntax::parse::token::ident_interner;
use syntax::{ast, codemap, ast_util, ast_map};

View File

@ -154,6 +154,7 @@ use util::ppaux::Repr;
use core::cast::transmute;
use core::hashmap::HashMap;
use core::vec;
use syntax::print::pprust::{expr_to_str};
use syntax::ast;
use syntax::codemap;

View File

@ -34,6 +34,9 @@ use middle::ty;
use middle::ty::FnSig;
use util::ppaux::ty_to_str;
use core::str;
use core::uint;
use core::vec;
use syntax::codemap::span;
use syntax::{ast, ast_util};
use syntax::{attr, ast_map};

View File

@ -36,7 +36,10 @@ use middle::ty;
use util::ppaux;
use util::ppaux::ty_to_short_str;
use core::io;
use core::libc::c_uint;
use core::str;
use core::vec;
use extra::time;
use syntax::ast;

View File

@ -19,6 +19,7 @@ use middle::trans::common::*;
use middle::ty;
use util::ppaux::ty_to_str;
use core::vec;
use syntax::ast;
use syntax::ast_map::path_name;
use syntax::ast_util::local_def;

View File

@ -31,6 +31,8 @@ use middle::typeck;
use util::common::indenter;
use util::ppaux::Repr;
use core::str;
use core::vec;
use syntax::ast_map::{path, path_mod, path_name};
use syntax::ast_util;
use syntax::{ast, ast_map};

View File

@ -32,6 +32,7 @@ use middle::ty::{FnSig};
use middle::typeck;
use util::ppaux::Repr;
use core::vec;
use syntax::ast;
use syntax::ast_map;
use syntax::ast_map::path_name;

View File

@ -27,9 +27,17 @@ use util::ppaux::{Repr, UserString};
use util::common::{indenter};
use util::enum_set::{EnumSet, CLike};
use core::cast;
use core::cmp;
use core::hashmap::{HashMap, HashSet};
use core::iter;
use core::ops;
use core::ptr::to_unsafe_ptr;
use core::to_bytes;
use core::hashmap::{HashMap, HashSet};
use core::u32;
use core::uint;
use core::vec;
use extra::smallintmap::SmallIntMap;
use syntax::ast::*;
use syntax::ast_util::is_local;
use syntax::ast_util;

View File

@ -63,6 +63,8 @@ use middle::typeck::rscope::{region_scope, RegionError};
use middle::typeck::rscope::RegionParamNames;
use middle::typeck::lookup_def_tcx;
use core::result;
use core::vec;
use syntax::abi::AbiSet;
use syntax::{ast, ast_util};
use syntax::codemap::span;

View File

@ -19,6 +19,7 @@ use middle::typeck::check::{structure_of, valid_range_bounds};
use middle::typeck::require_same_types;
use core::hashmap::{HashMap, HashSet};
use core::vec;
use syntax::ast;
use syntax::ast_util;
use syntax::codemap::span;

View File

@ -96,6 +96,9 @@ use middle::typeck::check::regionmanip::replace_bound_regions_in_fn_sig;
use util::common::indenter;
use core::hashmap::HashSet;
use core::result;
use core::uint;
use core::vec;
use extra::list::Nil;
use syntax::ast::{def_id, sty_value, sty_region, sty_box};
use syntax::ast::{sty_uniq, sty_static, node_id};

View File

@ -111,7 +111,10 @@ use util::ppaux;
use core::cast::transmute;
use core::hashmap::HashMap;
use core::result;
use core::str;
use core::util::replace;
use core::vec;
use extra::list::Nil;
use syntax::abi::AbiSet;
use syntax::ast::{provided, required};

Some files were not shown because too many files have changed in this diff Show More