From a3f728238bb49759a3b3b64599808c3265f2caca Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 1 Mar 2013 10:44:43 -0800 Subject: [PATCH] librustc: Forbid chained imports and fix the logic for one-level renaming imports --- doc/rust.md | 2 +- doc/tutorial-ffi.md | 4 +- doc/tutorial-tasks.md | 45 +- doc/tutorial.md | 36 +- src/compiletest/compiletest.rc | 14 +- src/compiletest/errors.rs | 7 +- src/compiletest/header.rs | 9 +- src/compiletest/procsrv.rs | 22 +- src/compiletest/runtest.rs | 14 +- src/compiletest/util.rs | 8 +- src/etc/combine-tests.py | 2 +- src/libcore/core.rc | 9 +- src/libcore/num/num.rs | 2 +- src/libcore/task/local_data.rs | 2 +- src/libfuzzer/fuzzer.rc | 3 +- src/librust/rust.rc | 2 +- src/librustc/back/arm.rs | 2 +- src/librustc/back/link.rs | 7 +- src/librustc/back/x86.rs | 2 +- src/librustc/back/x86_64.rs | 2 +- src/librustc/driver/driver.rs | 5 +- src/librustc/driver/session.rs | 4 +- src/librustc/front/intrinsic.rs | 2 +- src/librustc/front/test.rs | 9 +- src/librustc/metadata/creader.rs | 2 +- src/librustc/metadata/decoder.rs | 6 +- src/librustc/middle/lang_items.rs | 2 +- src/librustc/middle/resolve.rs | 397 ++++++------------ src/librustc/middle/trans/build.rs | 7 +- src/librustc/middle/ty.rs | 2 +- src/librustc/middle/typeck/check/vtable.rs | 2 +- .../middle/typeck/infer/region_inference.rs | 5 +- src/librustc/rustc.rc | 26 +- src/librustdoc/config.rs | 2 +- src/librustdoc/markdown_writer.rs | 4 +- src/librustdoc/rustdoc.rc | 60 +-- src/librustpkg/rustpkg.rc | 12 +- src/librustpkg/util.rs | 20 +- src/libstd/bigint.rs | 2 +- src/libstd/flatpipes.rs | 4 +- src/libstd/semver.rs | 14 +- src/libstd/std.rc | 2 +- src/libstd/test.rs | 11 +- src/libstd/timer.rs | 2 +- src/libstd/uv_global_loop.rs | 15 +- src/libstd/workcache.rs | 2 +- src/libsyntax/ext/fmt.rs | 3 +- src/libsyntax/parse/parser.rs | 2 +- src/libsyntax/util/interner.rs | 5 +- src/test/auxiliary/cci_nested_lib.rs | 2 +- .../trait_inheritance_overloading_xc.rs | 2 +- src/test/compile-fail/import2.rs | 5 +- src/test/compile-fail/issue-1697.rs | 3 +- src/test/compile-fail/issue-2590.rs | 8 +- src/test/compile-fail/issue-2611-3.rs | 2 +- src/test/compile-fail/issue-2611-4.rs | 2 +- src/test/compile-fail/issue-2611-5.rs | 2 +- src/test/compile-fail/issue-3953.rs | 2 +- src/test/compile-fail/issue-511.rs | 2 +- src/test/compile-fail/pattern-tyvar-2.rs | 1 - src/test/compile-fail/pattern-tyvar.rs | 1 - .../compile-fail/regions-glb-free-free.rs | 2 +- src/test/run-fail/issue-2156.rs | 2 +- src/test/run-fail/zip-different-lengths.rs | 2 +- src/test/run-pass/auto-encode.rs | 8 +- src/test/run-pass/import-in-block.rs | 6 +- src/test/run-pass/import3.rs | 2 +- src/test/run-pass/import6.rs | 2 +- src/test/run-pass/import7.rs | 2 +- src/test/run-pass/issue-2611.rs | 2 +- src/test/run-pass/issue-2804.rs | 5 +- src/test/run-pass/issue-2904.rs | 2 +- src/test/run-pass/issue-3176.rs | 2 +- src/test/run-pass/issue-3424.rs | 2 +- src/test/run-pass/issue-3563-3.rs | 2 +- src/test/run-pass/issue-3609.rs | 2 +- src/test/run-pass/new-import-syntax.rs | 2 +- src/test/run-pass/reflect-visit-data.rs | 4 +- src/test/run-pass/regions-mock-trans-impls.rs | 4 +- src/test/run-pass/ret-break-cont-in-block.rs | 2 +- src/test/run-pass/stat.rs | 2 +- src/test/run-pass/task-comm-0.rs | 4 +- src/test/run-pass/trait-inheritance-num.rs | 4 +- src/test/run-pass/trait-inheritance-num0.rs | 2 +- src/test/run-pass/trait-inheritance-num1.rs | 4 +- src/test/run-pass/trait-inheritance-num2.rs | 4 +- src/test/run-pass/trait-inheritance-num3.rs | 4 +- src/test/run-pass/trait-inheritance-num5.rs | 4 +- .../trait-inheritance-overloading-simple.rs | 2 +- .../run-pass/trait-inheritance-overloading.rs | 2 +- src/test/run-pass/unique-kinds.rs | 2 +- src/test/run-pass/zip-same-length.rs | 2 +- 92 files changed, 402 insertions(+), 544 deletions(-) diff --git a/doc/rust.md b/doc/rust.md index 80f8b8f49c1a..b45a6a3dd450 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -1360,7 +1360,7 @@ Functions within foreign modules are declared in the same way as other Rust func with the exception that they may not have a body and are instead terminated by a semicolon. ~~~ -# use libc::{c_char, FILE}; +# use core::libc::{c_char, FILE}; # #[nolink] extern mod c { diff --git a/doc/tutorial-ffi.md b/doc/tutorial-ffi.md index b7659376ed65..add3718ea7fb 100644 --- a/doc/tutorial-ffi.md +++ b/doc/tutorial-ffi.md @@ -14,7 +14,7 @@ should compile and run without any extra effort. ~~~~ {.xfail-test} extern mod std; -use libc::c_uint; +use core::libc::c_uint; extern mod crypto { fn SHA1(src: *u8, sz: c_uint, out: *u8) -> *u8; @@ -217,7 +217,7 @@ microsecond-resolution timer. ~~~~ extern mod std; -use libc::c_ulonglong; +use core::libc::c_ulonglong; struct timeval { tv_sec: c_ulonglong, diff --git a/doc/tutorial-tasks.md b/doc/tutorial-tasks.md index 22d0ff8bf78a..52f63be984a3 100644 --- a/doc/tutorial-tasks.md +++ b/doc/tutorial-tasks.md @@ -80,8 +80,8 @@ calling the `spawn` function with a closure argument. `spawn` executes the closure in the new task. ~~~~ -# use io::println; -use task::spawn; +# use core::io::println; +use core::task::spawn; // Print something profound in a different task using a named function fn print_message() { println("I am running in a different task!"); } @@ -110,8 +110,8 @@ execution. Like any closure, the function passed to `spawn` may capture an environment that it carries across tasks. ~~~ -# use io::println; -# use task::spawn; +# use core::io::println; +# use core::task::spawn; # fn generate_task_number() -> int { 0 } // Generate some state locally let child_task_number = generate_task_number(); @@ -127,8 +127,8 @@ in parallel. Thus, on a multicore machine, running the following code should interleave the output in vaguely random order. ~~~ -# use io::print; -# use task::spawn; +# use core::io::print; +# use core::task::spawn; for int::range(0, 20) |child_task_number| { do spawn { @@ -156,8 +156,8 @@ endpoint. Consider the following example of calculating two results concurrently: ~~~~ -use task::spawn; -use comm::{stream, Port, Chan}; +use core::task::spawn; +use core::comm::{stream, Port, Chan}; let (port, chan): (Port, Chan) = stream(); @@ -178,7 +178,7 @@ stream for sending and receiving integers (the left-hand side of the `let`, a tuple into its component parts). ~~~~ -# use comm::{stream, Chan, Port}; +# use core::comm::{stream, Chan, Port}; let (port, chan): (Port, Chan) = stream(); ~~~~ @@ -187,9 +187,8 @@ which will wait to receive the data on the port. The next statement spawns the child task. ~~~~ -# use task::{spawn}; -# use task::spawn; -# use comm::{stream, Port, Chan}; +# use core::task::spawn; +# use core::comm::{stream, Port, Chan}; # fn some_expensive_computation() -> int { 42 } # let (port, chan) = stream(); do spawn || { @@ -209,7 +208,7 @@ computation, then waits for the child's result to arrive on the port: ~~~~ -# use comm::{stream, Port, Chan}; +# use core::comm::{stream, Port, Chan}; # fn some_other_expensive_computation() {} # let (port, chan) = stream::(); # chan.send(0); @@ -224,8 +223,8 @@ example needed to compute multiple results across a number of tasks? The following program is ill-typed: ~~~ {.xfail-test} -# use task::{spawn}; -# use comm::{stream, Port, Chan}; +# use core::task::{spawn}; +# use core::comm::{stream, Port, Chan}; # fn some_expensive_computation() -> int { 42 } let (port, chan) = stream(); @@ -244,8 +243,8 @@ Instead we can use a `SharedChan`, a type that allows a single `Chan` to be shared by multiple senders. ~~~ -# use task::spawn; -use comm::{stream, SharedChan}; +# use core::task::spawn; +use core::comm::{stream, SharedChan}; let (port, chan) = stream(); let chan = SharedChan(chan); @@ -277,8 +276,8 @@ illustrate the point. For reference, written with multiple streams, it might look like the example below. ~~~ -# use task::spawn; -# use comm::{stream, Port, Chan}; +# use core::task::spawn; +# use core::comm::{stream, Port, Chan}; // Create a vector of ports, one for each child task let ports = do vec::from_fn(3) |init_val| { @@ -309,7 +308,7 @@ All tasks are, by default, _linked_ to each other. That means that the fates of all tasks are intertwined: if one fails, so do all the others. ~~~ -# use task::spawn; +# use core::task::spawn; # fn do_some_work() { loop { task::yield() } } # do task::try { // Create a child task that fails @@ -393,8 +392,8 @@ internally, with additional logic to wait for the child task to finish before returning. Hence: ~~~ -# use comm::{stream, Chan, Port}; -# use task::{spawn, try}; +# use core::comm::{stream, Chan, Port}; +# use core::task::{spawn, try}; # fn sleep_forever() { loop { task::yield() } } # do task::try { let (receiver, sender): (Port, Chan) = stream(); @@ -489,8 +488,8 @@ response itself is simply the stringified version of the received value, Here is the code for the parent task: ~~~~ +# use core::task::spawn; # use std::comm::DuplexStream; -# use task::spawn; # fn stringifier(channel: &DuplexStream<~str, uint>) { # let mut value: uint; # loop { diff --git a/doc/tutorial.md b/doc/tutorial.md index d31fbbb0c07a..5dc5ef99916e 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -1313,7 +1313,7 @@ and [`core::str`]. Here are some examples. [`core::str`]: core/str.html ~~~ -# use io::println; +# use core::io::println; # enum Crayon { # Almond, AntiqueBrass, Apricot, # Aquamarine, Asparagus, AtomicTangerine, @@ -1368,7 +1368,7 @@ Rust also supports _closures_, functions that can access variables in the enclosing scope. ~~~~ -# use println = io::println; +# use println = core::io::println; fn call_closure_with_ten(b: fn(int)) { b(10); } let captured_var = 20; @@ -1525,7 +1525,7 @@ words, it is a function that takes an owned closure that takes no arguments. ~~~~ -use task::spawn; +use core::task::spawn; do spawn() || { debug!("I'm a task, whatever"); @@ -1537,7 +1537,7 @@ lists back to back. Since that is so unsightly, empty argument lists may be omitted from `do` expressions. ~~~~ -# use task::spawn; +# use core::task::spawn; do spawn { debug!("Kablam!"); } @@ -1568,8 +1568,8 @@ fn each(v: &[int], op: fn(v: &int) -> bool) { And using this function to iterate over a vector: ~~~~ -# use each = vec::each; -# use println = io::println; +# use each = core::vec::each; +# use println = core::io::println; each([2, 4, 8, 5, 16], |n| { if *n % 2 != 0 { println("found odd number!"); @@ -1585,8 +1585,8 @@ out of the loop, you just write `break`. To skip ahead to the next iteration, write `loop`. ~~~~ -# use each = vec::each; -# use println = io::println; +# use each = core::vec::each; +# use println = core::io::println; for each([2, 4, 8, 5, 16]) |n| { if *n % 2 != 0 { println("found odd number!"); @@ -1601,7 +1601,7 @@ normally allowed in closures, in a block that appears as the body of a the enclosing function, not just the loop body. ~~~~ -# use each = vec::each; +# use each = core::vec::each; fn contains(v: &[int], elt: int) -> bool { for each(v) |x| { if (*x == elt) { return true; } @@ -1616,7 +1616,7 @@ In these situations it can be convenient to lean on Rust's argument patterns to bind `x` to the actual value, not the pointer. ~~~~ -# use each = vec::each; +# use each = core::vec::each; # fn contains(v: &[int], elt: int) -> bool { for each(v) |&x| { if (x == elt) { return true; } @@ -1758,8 +1758,8 @@ Constructors are one common application for static methods, as in `new` above. To call a static method, you have to prefix it with the type name and a double colon: ~~~~ -# use float::consts::pi; -# use float::sqrt; +# use core::float::consts::pi; +# use core::float::sqrt; struct Circle { radius: float } impl Circle { static fn new(area: float) -> Circle { Circle { radius: sqrt(area / pi) } } @@ -2030,8 +2030,8 @@ The compiler will use type inference to decide which implementation to call. ~~~~ trait Shape { static fn new(area: float) -> Self; } -# use float::consts::pi; -# use float::sqrt; +# use core::float::consts::pi; +# use core::float::sqrt; struct Circle { radius: float } struct Square { length: float } @@ -2189,8 +2189,8 @@ Now, we can implement `Circle` on a type only if we also implement `Shape`. # trait Shape { fn area(&self) -> float; } # trait Circle : Shape { fn radius(&self) -> float; } # struct Point { x: float, y: float } -# use float::consts::pi; -# use float::sqrt; +# use core::float::consts::pi; +# use core::float::sqrt; # fn square(x: float) -> float { x * x } struct CircleStruct { center: Point, radius: float } impl Circle for CircleStruct { @@ -2224,8 +2224,8 @@ Likewise, supertrait methods may also be called on trait objects. ~~~ {.xfail-test} # trait Shape { fn area(&self) -> float; } # trait Circle : Shape { fn radius(&self) -> float; } -# use float::consts::pi; -# use float::sqrt; +# use core::float::consts::pi; +# use core::float::sqrt; # struct Point { x: float, y: float } # struct CircleStruct { center: Point, radius: float } # impl Circle for CircleStruct { fn radius(&self) -> float { sqrt(self.area() / pi) } } diff --git a/src/compiletest/compiletest.rc b/src/compiletest/compiletest.rc index 6748edb9dbdf..ae5cb1e6f113 100644 --- a/src/compiletest/compiletest.rc +++ b/src/compiletest/compiletest.rc @@ -22,18 +22,18 @@ extern mod std(vers = "0.6"); use core::*; -mod procsrv; -mod util; -mod header; -mod runtest; -mod common; -mod errors; +pub mod procsrv; +pub mod util; +pub mod header; +pub mod runtest; +pub mod common; +pub mod errors; use std::getopts; use std::test; use core::{result, either}; -use result::{Ok, Err}; +use core::result::{Ok, Err}; use common::config; use common::mode_run_pass; diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs index d41a4b7360c7..39b70299ba5b 100644 --- a/src/compiletest/errors.rs +++ b/src/compiletest/errors.rs @@ -11,9 +11,10 @@ use core::prelude::*; use common::config; -use io; -use io::ReaderUtil; -use str; + +use core::io; +use core::io::ReaderUtil; +use core::str; pub struct ExpectedError { line: uint, kind: ~str, msg: ~str } diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index 6db55853f9ce..64d1aae5ff5e 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -12,10 +12,11 @@ use core::prelude::*; use common; use common::config; -use io; -use io::ReaderUtil; -use os; -use str; + +use core::io::ReaderUtil; +use core::io; +use core::os; +use core::str; pub struct TestProps { // Lines that should be expected, in order, on standard out diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index 6c8bd7ea4426..8d8cdb3c719c 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -10,17 +10,17 @@ use core::prelude::*; -use io; -use io::{ReaderUtil, WriterUtil}; -use libc; -use libc::{c_int, pid_t}; -use os; -use run; -use run::spawn_process; -use pipes; -use str; -use task; -use vec; +use core::io::{ReaderUtil, WriterUtil}; +use core::io; +use core::libc::{c_int, pid_t}; +use core::libc; +use core::os; +use core::pipes; +use core::run::spawn_process; +use core::run; +use core::str; +use core::task; +use core::vec; #[cfg(target_os = "win32")] fn target_env(lib_path: ~str, prog: ~str) -> ~[(~str,~str)] { diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 3213a11cbb51..b5def15fc509 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -10,13 +10,6 @@ use core::prelude::*; -use io; -use io::WriterUtil; -use os; -use str; -use uint; -use vec; - use common; use common::mode_run_pass; use common::mode_run_fail; @@ -31,6 +24,13 @@ use procsrv; use util; use util::logv; +use core::io::WriterUtil; +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. diff --git a/src/compiletest/util.rs b/src/compiletest/util.rs index e4028549f28a..ad60e532f3cb 100644 --- a/src/compiletest/util.rs +++ b/src/compiletest/util.rs @@ -10,13 +10,13 @@ use core::prelude::*; -use io; -use os; -use os::getenv; - use common; use common::config; +use core::io; +use core::os::getenv; +use core::os; + pub fn make_new_path(path: ~str) -> ~str { // Windows just uses PATH as the library search path, so we have to diff --git a/src/etc/combine-tests.py b/src/etc/combine-tests.py index 8e1a916e2f19..93989f8e4a90 100755 --- a/src/etc/combine-tests.py +++ b/src/etc/combine-tests.py @@ -52,7 +52,7 @@ d.write("// AUTO-GENERATED FILE: DO NOT EDIT\n") d.write("extern mod std;\n") d.write("extern mod run_pass_stage2;\n") d.write("use run_pass_stage2::*;\n") -d.write("use io::WriterUtil;\n"); +d.write("use core::io::WriterUtil;\n"); d.write("fn main() {\n"); d.write(" let out = io::stdout();\n"); i = 0 diff --git a/src/libcore/core.rc b/src/libcore/core.rc index c8d2da28255f..56a18024ac92 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -235,10 +235,10 @@ pub mod private { /* For internal use, not exported */ -mod unicode; +pub mod unicode; #[path = "num/cmath.rs"] -mod cmath; -mod stackwalk; +pub mod cmath; +pub mod stackwalk; // A curious inner-module that's not exported that contains the binding @@ -253,8 +253,9 @@ pub mod core { pub use cmp; pub use condition; - pub use option; pub use kinds; + pub use ops; + pub use option; pub use sys; pub use pipes; } diff --git a/src/libcore/num/num.rs b/src/libcore/num/num.rs index 7038ba07c0de..4d97df621da3 100644 --- a/src/libcore/num/num.rs +++ b/src/libcore/num/num.rs @@ -9,7 +9,7 @@ // except according to those terms. //! An interface for numeric types -use core::cmp::{Ord, Eq}; +use cmp::{Ord, Eq}; use ops::{Add, Div, Modulo, Mul, Neg, Sub}; use option::{None, Option, Some}; use char; diff --git a/src/libcore/task/local_data.rs b/src/libcore/task/local_data.rs index ae101faaf026..185d8caae01f 100644 --- a/src/libcore/task/local_data.rs +++ b/src/libcore/task/local_data.rs @@ -27,8 +27,8 @@ magic. */ use prelude::*; -use rt; use task::local_data_priv::{local_get, local_pop, local_modify, local_set}; +use task::rt; use task; /** diff --git a/src/libfuzzer/fuzzer.rc b/src/libfuzzer/fuzzer.rc index c16a7cf8d3eb..3714b6763c64 100644 --- a/src/libfuzzer/fuzzer.rc +++ b/src/libfuzzer/fuzzer.rc @@ -31,8 +31,7 @@ extern mod std(vers = "0.6"); extern mod syntax(vers = "0.6"); use core::*; - -use io::WriterUtil; +use core::io::WriterUtil; use syntax::{ast, ast_util, fold, visit, codemap}; use syntax::parse; diff --git a/src/librust/rust.rc b/src/librust/rust.rc index e60f2bfaa501..37e0f874b40d 100644 --- a/src/librust/rust.rc +++ b/src/librust/rust.rc @@ -220,7 +220,7 @@ fn usage() { } -fn main() { +pub fn main() { let args = os::args().tail(); if !args.is_empty() { diff --git a/src/librustc/back/arm.rs b/src/librustc/back/arm.rs index faaddfed1e8b..95337b4150c2 100644 --- a/src/librustc/back/arm.rs +++ b/src/librustc/back/arm.rs @@ -9,8 +9,8 @@ // except according to those terms. use back::target_strs; +use driver::session::sess_os_to_meta_os; use driver::session; -use session::sess_os_to_meta_os; use metadata::loader::meta_section_name; pub fn get_target_strs(target_os: session::os) -> target_strs::t { diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index 8db27bd675d6..446b83af425a 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -11,6 +11,7 @@ use core::prelude::*; use back::rpath; +use driver::session::Session; use driver::session; use lib::llvm::llvm; use lib::llvm::{ModuleRef, mk_pass_manager, mk_target_data, True, False}; @@ -21,8 +22,6 @@ use metadata::filesearch; use metadata::{encoder, cstore}; use middle::trans::common::CrateContext; use middle::ty; -use session::Session; -use session; use util::ppaux; use core::char; @@ -89,10 +88,10 @@ pub fn WriteOutputFile(sess: Session, pub mod jit { use back::link::llvm_err; + use driver::session::Session; use lib::llvm::llvm; use lib::llvm::{ModuleRef, PassManagerRef, mk_target_data}; use metadata::cstore; - use session::Session; use core::cast; use core::libc::c_int; @@ -170,11 +169,11 @@ pub mod write { use back::link::{output_type_assembly, output_type_bitcode}; use back::link::{output_type_exe, output_type_llvm_assembly}; use back::link::{output_type_object}; + use driver::session::Session; use driver::session; use lib::llvm::llvm; use lib::llvm::{False, True, ModuleRef, mk_pass_manager, mk_target_data}; use lib; - use session::Session; use core::char; use core::libc::{c_char, c_int, c_uint}; diff --git a/src/librustc/back/x86.rs b/src/librustc/back/x86.rs index a768edcc00bb..2cc812c3d410 100644 --- a/src/librustc/back/x86.rs +++ b/src/librustc/back/x86.rs @@ -10,9 +10,9 @@ use back::target_strs; +use driver::session::sess_os_to_meta_os; use driver::session; use metadata::loader::meta_section_name; -use session::sess_os_to_meta_os; pub fn get_target_strs(target_os: session::os) -> target_strs::t { return target_strs::t { diff --git a/src/librustc/back/x86_64.rs b/src/librustc/back/x86_64.rs index dc4883137596..b68073974dcf 100644 --- a/src/librustc/back/x86_64.rs +++ b/src/librustc/back/x86_64.rs @@ -10,9 +10,9 @@ use back::target_strs; +use driver::session::sess_os_to_meta_os; use driver::session; use metadata::loader::meta_section_name; -use session::sess_os_to_meta_os; pub fn get_target_strs(target_os: session::os) -> target_strs::t { return target_strs::t { diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index 61bb03dd7f90..6e6213d4427d 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -12,14 +12,15 @@ use core::prelude::*; use back::link; use back::{arm, x86, x86_64}; +use driver::session::{Aggressive}; +use driver::session::{Session, Session_, OptLevel, No, Less, Default}; +use driver::session; use front; use lib::llvm::llvm; use metadata::{creader, cstore, filesearch}; use metadata; use middle::{trans, freevars, kind, ty, typeck, lint, astencode}; use middle; -use session::{Session, Session_, OptLevel, No, Less, Default, Aggressive}; -use session; use util::ppaux; use core::cmp; diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index 94dbfb51eb82..5da16dd53420 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -13,7 +13,7 @@ use core::prelude::*; use back::link; use back::target_strs; use back; -use driver; +use driver::driver::host_triple; use driver::session; use metadata::filesearch; use metadata; @@ -293,7 +293,7 @@ pub fn basic_options() -> @options { output_type: link::output_type_exe, addl_lib_search_paths: ~[], maybe_sysroot: None, - target_triple: driver::host_triple(), + target_triple: host_triple(), cfg: ~[], binary: ~"rustc", test: false, diff --git a/src/librustc/front/intrinsic.rs b/src/librustc/front/intrinsic.rs index 02e964ac3d35..059cd9723e76 100644 --- a/src/librustc/front/intrinsic.rs +++ b/src/librustc/front/intrinsic.rs @@ -11,7 +11,7 @@ // NB: this file is include_str!'ed into the compiler, re-parsed // and injected into each crate the compiler builds. Keep it small. -mod intrinsic { +pub mod intrinsic { pub use intrinsic::rusti::visit_tydesc; // FIXME (#3727): remove this when the interface has settled and the diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs index 94b49e9d266e..c17a861165a3 100644 --- a/src/librustc/front/test.rs +++ b/src/librustc/front/test.rs @@ -12,23 +12,22 @@ use core::prelude::*; +use driver::session::Session; use driver::session; use front::config; -use session::Session; use core::dvec::DVec; use core::option; use core::vec; use syntax::ast_util::*; +use syntax::attr::attrs_contains_name; use syntax::attr; use syntax::codemap::{dummy_sp, span, ExpandedFrom, CallInfo, NameAndSpan}; use syntax::codemap; +use syntax::ext::base::{mk_ctxt, ext_ctxt}; use syntax::fold; use syntax::print::pprust; use syntax::{ast, ast_util}; -use syntax::attr::attrs_contains_name; - -use syntax::ext::base::{mk_ctxt, ext_ctxt}; type node_id_gen = fn@() -> ast::node_id; @@ -286,7 +285,7 @@ fn mk_std(cx: &TestCtxt) -> @ast::view_item { let vi = ast::view_item { node: vi, attrs: ~[], - vis: ast::private, + vis: ast::public, span: dummy_sp() }; return @vi; diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs index 79dec35e4abb..307a58135e13 100644 --- a/src/librustc/metadata/creader.rs +++ b/src/librustc/metadata/creader.rs @@ -80,7 +80,7 @@ fn dump_crates(+crate_cache: @mut ~[cache_entry]) { fn warn_if_multiple_versions(e: @mut Env, diag: span_handler, crate_cache: @mut ~[cache_entry]) { - use either::*; + use core::either::*; if crate_cache.len() != 0u { let name = loader::crate_name_from_metas( diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index cbe2217c9fc9..f660c796fa3b 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -14,9 +14,6 @@ use core::prelude::*; use metadata::cstore::crate_metadata; -use dvec::DVec; -use hash::{Hash, HashUtil}; -use io::WriterUtil; use metadata::common::*; use metadata::csearch::{ProvidedTraitMethodInfo, StaticMethodInfo}; use metadata::csearch; @@ -28,8 +25,11 @@ use middle::{ty, resolve}; use util::ppaux::ty_to_str; use core::cmp; +use core::dvec::DVec; use core::dvec; +use core::hash::{Hash, HashUtil}; use core::int; +use core::io::WriterUtil; use core::io; use core::option; use core::str; diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index d399f0e6886e..c0ce6ee515fa 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -34,7 +34,7 @@ use syntax::visit::{visit_crate, visit_item}; use core::ptr; use std::oldmap::HashMap; -use str_eq = str::eq; +use str_eq = core::str::eq; pub enum LangItem { ConstTraitLangItem, // 0 diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 1c4928fd3745..648b7e49204c 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -77,15 +77,14 @@ use syntax::visit::{visit_mod, visit_ty, vt}; use syntax::opt_vec; use syntax::opt_vec::OptVec; -use managed::ptr_eq; -use dvec::DVec; -use option::{Some, get, is_some, is_none}; -use str::{connect, split_str}; -use vec::pop; - +use core::dvec::DVec; +use core::managed::ptr_eq; +use core::option::{Some, get, is_some, is_none}; +use core::str::{connect, split_str}; +use core::vec::pop; use std::list::{Cons, List, Nil}; use std::oldmap::HashMap; -use str_eq = str::eq; +use str_eq = core::str::eq; // Definition mapping pub type DefMap = HashMap; @@ -305,6 +304,12 @@ pub enum AllowCapturingSelfFlag { DontAllowCapturingSelf, //< The "self" definition cannot be captured. } +#[deriving_eq] +enum NameSearchType { + SearchItemsAndPublicImports, //< Search items and public imports. + SearchItemsAndAllImports, //< Search items and all imports. +} + pub enum BareIdentifierPatternResolution { FoundStructOrEnumVariant(def), FoundConst(def), @@ -1488,7 +1493,7 @@ pub impl Resolver { let parent_link = ModuleParentLink (self.get_module_from_parent(new_parent), name); - child_name_bindings.define_module(privacy, + child_name_bindings.define_module(Public, parent_link, Some(def_id), NormalModuleKind, @@ -1948,10 +1953,8 @@ pub impl Resolver { } } - /** - * Attempts to resolve imports for the given module and all of its - * submodules. - */ + /// Attempts to resolve imports for the given module and all of its + /// submodules. fn resolve_imports_for_module_subtree(@mut self, module_: @mut Module) { debug!("(resolving imports for module subtree) resolving %s", self.module_to_str(module_)); @@ -1974,19 +1977,19 @@ pub impl Resolver { } /// Attempts to resolve imports for the given module only. - fn resolve_imports_for_module(@mut self, module_: @mut Module) { - if (*module_).all_imports_resolved() { + fn resolve_imports_for_module(@mut self, module: @mut Module) { + if module.all_imports_resolved() { debug!("(resolving imports for module) all imports resolved for \ %s", - self.module_to_str(module_)); + self.module_to_str(module)); return; } - let import_count = module_.imports.len(); - while module_.resolved_import_count < import_count { - let import_index = module_.resolved_import_count; - let import_directive = module_.imports.get_elt(import_index); - match self.resolve_import_for_module(module_, import_directive) { + let import_count = module.imports.len(); + while module.resolved_import_count < import_count { + let import_index = module.resolved_import_count; + let import_directive = module.imports.get_elt(import_index); + match self.resolve_import_for_module(module, import_directive) { Failed => { // We presumably emitted an error. Continue. let idents = import_directive.module_path.get(); @@ -2004,7 +2007,7 @@ pub impl Resolver { } } - module_.resolved_import_count += 1; + module.resolved_import_count += 1; } } @@ -2037,72 +2040,71 @@ pub impl Resolver { } } - /** - * Attempts to resolve the given import. The return value indicates - * failure if we're certain the name does not exist, indeterminate if we - * don't know whether the name exists at the moment due to other - * currently-unresolved imports, or success if we know the name exists. - * If successful, the resolved bindings are written into the module. - */ - fn resolve_import_for_module(@mut self, - module_: @mut Module, + /// Attempts to resolve the given import. The return value indicates + /// failure if we're certain the name does not exist, indeterminate if we + /// don't know whether the name exists at the moment due to other + /// currently-unresolved imports, or success if we know the name exists. + /// If successful, the resolved bindings are written into the module. + fn resolve_import_for_module(@mut self, module_: @mut Module, import_directive: @ImportDirective) -> ResolveResult<()> { - let mut resolution_result; + let mut resolution_result = Failed; let module_path = import_directive.module_path; debug!("(resolving import for module) resolving import `%s::...` in \ `%s`", - self.idents_to_str((*module_path).get()), + self.idents_to_str(module_path.get()), self.module_to_str(module_)); - // One-level renaming imports of the form `import foo = bar;` are - // handled specially. - - if (*module_path).len() == 0 { - resolution_result = - self.resolve_one_level_renaming_import(module_, - import_directive); + // First, resolve the module path for the directive, if necessary. + let containing_module = if module_path.len() == 0 { + // Use the crate root. + Some(self.graph_root.get_module()) } else { - // First, resolve the module path for the directive, if necessary. match self.resolve_module_path_for_import(module_, module_path, DontUseLexicalScope, import_directive.span) { - Failed => { - resolution_result = Failed; - } + Failed => None, Indeterminate => { resolution_result = Indeterminate; + None } - Success(containing_module) => { - // We found the module that the target is contained - // within. Attempt to resolve the import within it. + Success(containing_module) => Some(containing_module), + } + }; - match *import_directive.subclass { - SingleImport(target, source, AnyNS) => { - resolution_result = - self.resolve_single_import(module_, - containing_module, - target, - source); - } - SingleImport(target, source, TypeNSOnly) => { - resolution_result = - self.resolve_single_module_import - (module_, containing_module, target, - source); - } - GlobImport => { - let span = import_directive.span; - let p = import_directive.privacy; - resolution_result = - self.resolve_glob_import(p, - module_, - containing_module, - span); - } + match containing_module { + None => {} + Some(containing_module) => { + // We found the module that the target is contained + // within. Attempt to resolve the import within it. + + match *import_directive.subclass { + SingleImport(target, source, AnyNS) => { + resolution_result = + self.resolve_single_import(module_, + containing_module, + target, + source); + } + SingleImport(target, source, TypeNSOnly) => { + resolution_result = + self.resolve_single_module_import( + module_, + containing_module, + target, + source); + } + GlobImport => { + let span = import_directive.span; + let privacy = import_directive.privacy; + resolution_result = + self.resolve_glob_import(privacy, + module_, + containing_module, + span); } } } @@ -2575,11 +2577,13 @@ pub impl Resolver { return Success(()); } + /// Resolves the given module path from the given root `module_`. fn resolve_module_path_from_root(@mut self, module_: @mut Module, module_path: @DVec, index: uint, - span: span) + span: span, + mut name_search_type: NameSearchType) -> ResolveResult<@mut Module> { let mut search_module = module_; let mut index = index; @@ -2594,7 +2598,7 @@ pub impl Resolver { match self.resolve_name_in_module(search_module, name, TypeNS, - false) { + name_search_type) { Failed => { self.session.span_err(span, ~"unresolved name"); return Failed; @@ -2639,22 +2643,33 @@ pub impl Resolver { } index += 1; + + // After the first element of the path, allow searching through + // items and imports unconditionally. This allows things like: + // + // pub mod core { + // pub use vec; + // } + // + // pub mod something_else { + // use core::vec; + // } + + name_search_type = SearchItemsAndPublicImports; } return Success(search_module); } - /** - * Attempts to resolve the module part of an import directive or path - * rooted at the given module. - */ + /// Attempts to resolve the module part of an import directive or path + /// rooted at the given module. fn resolve_module_path_for_import(@mut self, module_: @mut Module, module_path: @DVec, use_lexical_scope: UseLexicalScopeFlag, span: span) -> ResolveResult<@mut Module> { - let module_path_len = (*module_path).len(); + let module_path_len = module_path.len(); assert module_path_len > 0; debug!("(resolving module path for import) processing `%s` rooted at \ @@ -2721,12 +2736,15 @@ pub impl Resolver { } } - return self.resolve_module_path_from_root(search_module, - module_path, - start_index, - span); + self.resolve_module_path_from_root(search_module, + module_path, + start_index, + span, + SearchItemsAndPublicImports) } + /// Invariant: This must only be called during main resolution, not during + /// import resolution. fn resolve_item_in_lexical_scope(@mut self, module_: @mut Module, name: ident, @@ -2822,7 +2840,7 @@ pub impl Resolver { match self.resolve_name_in_module(search_module, name, namespace, - false) { + SearchItemsAndAllImports) { Failed => { // Continue up the search chain. } @@ -2973,16 +2991,14 @@ pub impl Resolver { return Success(PrefixFound(containing_module, i)); } - /** - * Attempts to resolve the supplied name in the given module for the - * given namespace. If successful, returns the target corresponding to - * the name. - */ + /// Attempts to resolve the supplied name in the given module for the + /// given namespace. If successful, returns the target corresponding to + /// the name. fn resolve_name_in_module(@mut self, module_: @mut Module, name: ident, namespace: Namespace, - allow_globs: bool) + +name_search_type: NameSearchType) -> ResolveResult { debug!("(resolving name in module) resolving `%s` in `%s`", *self.session.str_of(name), @@ -3001,35 +3017,42 @@ pub impl Resolver { } } - // Next, check the module's imports. If the module has a glob and - // globs were not allowed, then we bail out; we don't know its imports - // yet. - if !allow_globs && module_.glob_count > 0 { - debug!("(resolving name in module) module has glob; bailing out"); - return Indeterminate; + // Next, check the module's imports if necessary. + + // If this is a search of all imports, we should be done with glob + // resolution at this point. + if name_search_type == SearchItemsAndAllImports { + assert module_.glob_count == 0; } - // Otherwise, we check the list of resolved imports. + // Check the list of resolved imports. match module_.import_resolutions.find(&name) { Some(import_resolution) => { if import_resolution.outstanding_references != 0 { - debug!("(resolving name in module) import unresolved; \ - bailing out"); + debug!("(resolving name in module) import \ + unresolved; bailing out"); return Indeterminate; } - match (*import_resolution).target_for_namespace(namespace) { + match import_resolution.target_for_namespace(namespace) { None => { - debug!("(resolving name in module) name found, but \ - not in namespace %?", + debug!("(resolving name in module) name found, \ + but not in namespace %?", namespace); } - Some(target) => { + Some(target) + if name_search_type == + SearchItemsAndAllImports || + import_resolution.privacy == Public => { debug!("(resolving name in module) resolved to \ import"); import_resolution.state.used = true; return Success(copy target); } + Some(_) => { + debug!("(resolving name in module) name found, \ + but not public"); + } } } None => { @@ -3043,168 +3066,6 @@ pub impl Resolver { return Failed; } - /** - * Resolves a one-level renaming import of the kind `import foo = bar;` - * This needs special handling, as, unlike all of the other imports, it - * needs to look in the scope chain for modules and non-modules alike. - */ - fn resolve_one_level_renaming_import(@mut self, - module_: @mut Module, - import_directive: @ImportDirective) - -> ResolveResult<()> { - let mut target_name; - let mut source_name; - let allowable_namespaces; - match *import_directive.subclass { - SingleImport(target, source, namespaces) => { - target_name = target; - source_name = source; - allowable_namespaces = namespaces; - } - GlobImport => { - fail!(~"found `import *`, which is invalid"); - } - } - - debug!("(resolving one-level naming result) resolving import `%s` = \ - `%s` in `%s`", - *self.session.str_of(target_name), - *self.session.str_of(source_name), - self.module_to_str(module_)); - - // Find the matching items in the lexical scope chain for every - // namespace. If any of them come back indeterminate, this entire - // import is indeterminate. - - let mut module_result; - debug!("(resolving one-level naming result) searching for module"); - match self.resolve_item_in_lexical_scope(module_, - source_name, - TypeNS, - SearchThroughModules) { - Failed => { - debug!("(resolving one-level renaming import) didn't find \ - module result"); - module_result = None; - } - Indeterminate => { - debug!("(resolving one-level renaming import) module result \ - is indeterminate; bailing"); - return Indeterminate; - } - Success(name_bindings) => { - debug!("(resolving one-level renaming import) module result \ - found"); - module_result = Some(copy name_bindings); - } - } - - let mut value_result; - let mut type_result; - if allowable_namespaces == TypeNSOnly { - value_result = None; - type_result = None; - } else { - debug!("(resolving one-level naming result) searching for value"); - match self.resolve_item_in_lexical_scope(module_, - source_name, - ValueNS, - SearchThroughModules) { - - Failed => { - debug!("(resolving one-level renaming import) didn't \ - find value result"); - value_result = None; - } - Indeterminate => { - debug!("(resolving one-level renaming import) value \ - result is indeterminate; bailing"); - return Indeterminate; - } - Success(name_bindings) => { - debug!("(resolving one-level renaming import) value \ - result found"); - value_result = Some(copy name_bindings); - } - } - - debug!("(resolving one-level naming result) searching for type"); - match self.resolve_item_in_lexical_scope(module_, - source_name, - TypeNS, - SearchThroughModules) { - - Failed => { - debug!("(resolving one-level renaming import) didn't \ - find type result"); - type_result = None; - } - Indeterminate => { - debug!("(resolving one-level renaming import) type \ - result is indeterminate; bailing"); - return Indeterminate; - } - Success(name_bindings) => { - debug!("(resolving one-level renaming import) type \ - result found"); - type_result = Some(copy name_bindings); - } - } - } - - // - // NB: This one results in effects that may be somewhat surprising. It - // means that this: - // - // mod A { - // impl foo for ... { ... } - // mod B { - // impl foo for ... { ... } - // import bar = foo; - // ... - // } - // } - // - // results in only A::B::foo being aliased to A::B::bar, not A::foo - // *and* A::B::foo being aliased to A::B::bar. - // - - // If nothing at all was found, that's an error. - if is_none(&module_result) && - is_none(&value_result) && - is_none(&type_result) { - - self.session.span_err(import_directive.span, - ~"unresolved import"); - return Failed; - } - - // Otherwise, proceed and write in the bindings. - match module_.import_resolutions.find(&target_name) { - None => { - fail!(~"(resolving one-level renaming import) reduced graph \ - construction or glob importing should have created the \ - import resolution name by now"); - } - Some(import_resolution) => { - debug!("(resolving one-level renaming import) writing module \ - result %? for `%s` into `%s`", - is_none(&module_result), - *self.session.str_of(target_name), - self.module_to_str(module_)); - - import_resolution.value_target = value_result; - import_resolution.type_target = type_result; - - assert import_resolution.outstanding_references >= 1; - import_resolution.outstanding_references -= 1; - } - } - - debug!("(resolving one-level renaming import) successfully resolved"); - return Success(()); - } - fn report_unresolved_imports(@mut self, module_: @mut Module) { let index = module_.resolved_import_count; let import_count = module_.imports.len(); @@ -4538,10 +4399,8 @@ pub impl Resolver { } } - /** - * If `check_ribs` is true, checks the local definitions first; i.e. - * doesn't skip straight to the containing module. - */ + /// If `check_ribs` is true, checks the local definitions first; i.e. + /// doesn't skip straight to the containing module. fn resolve_path(@mut self, path: @path, namespace: Namespace, @@ -4714,6 +4573,8 @@ pub impl Resolver { } } + /// Invariant: This must be called only during main resolution, not during + /// import resolution. fn resolve_crate_relative_path(@mut self, path: @path, +xray: XrayFlag, @@ -4727,8 +4588,8 @@ pub impl Resolver { match self.resolve_module_path_from_root(root_module, module_path_idents, 0, - path.span) { - + path.span, + SearchItemsAndAllImports) { Failed => { self.session.span_err(path.span, fmt!("use of undeclared module `::%s`", diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs index 7ac54518d374..8db48e1de605 100644 --- a/src/librustc/middle/trans/build.rs +++ b/src/librustc/middle/trans/build.rs @@ -8,26 +8,25 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -use codemap::span; -use lib; use lib::llvm::llvm; use lib::llvm::{CallConv, TypeKind, AtomicBinOp, AtomicOrdering}; use lib::llvm::{Opcode, IntPredicate, RealPredicate, True, False}; use lib::llvm::{ValueRef, TypeRef, BasicBlockRef, BuilderRef, ModuleRef}; -use libc::{c_uint, c_int, c_ulonglong}; +use lib; use middle::trans::common::*; use middle::trans::machine::llsize_of_real; use core::prelude::*; use core::cast::transmute; use core::cast; +use core::libc::{c_uint, c_int, c_ulonglong}; use core::libc; use core::option::Some; use core::ptr; use core::str; use core::vec; use std::oldmap::HashMap; +use syntax::codemap::span; use syntax::codemap; pub fn terminate(cx: block, _: &str) { diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 3c25f2bfc595..a18bba7f3f26 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -10,6 +10,7 @@ use core::prelude::*; +use driver::session::Session; use driver::session; use metadata::csearch; use metadata; @@ -22,7 +23,6 @@ use middle::resolve; use middle::ty; use middle::typeck; use middle; -use session::Session; use util::ppaux::{note_and_explain_region, bound_region_to_str}; use util::ppaux::{region_to_str, explain_region, vstore_to_str}; use util::ppaux::{ty_to_str, tys_to_str}; diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs index 2dbf74e1666b..b2d399ac8da4 100644 --- a/src/librustc/middle/typeck/check/vtable.rs +++ b/src/librustc/middle/typeck/check/vtable.rs @@ -24,10 +24,10 @@ use util::common::indenter; use util::ppaux::tys_to_str; use util::ppaux; +use core::result::{Result, Ok, Err}; use core::result; use core::uint; use core::vec; -use result::{Result, Ok, Err}; use std::oldmap::HashMap; use syntax::ast; use syntax::ast_util; diff --git a/src/librustc/middle/typeck/infer/region_inference.rs b/src/librustc/middle/typeck/infer/region_inference.rs index d016a6f790a6..1ad89fe6f1e5 100644 --- a/src/librustc/middle/typeck/infer/region_inference.rs +++ b/src/librustc/middle/typeck/infer/region_inference.rs @@ -552,13 +552,12 @@ use util::ppaux::note_and_explain_region; use core::cell::{Cell, empty_cell}; use core::cmp; use core::dvec::DVec; +use core::result::{Err, Ok, Result}; use core::to_bytes; use core::uint; use core::vec; -use result::Result; -use result::{Ok, Err}; -use std::oldmap::HashMap; use std::list::{List, Nil, Cons}; +use std::oldmap::HashMap; use syntax::codemap::span; use syntax::codemap; diff --git a/src/librustc/rustc.rc b/src/librustc/rustc.rc index 140b52f03aaf..ed6b84b098ed 100644 --- a/src/librustc/rustc.rc +++ b/src/librustc/rustc.rc @@ -134,22 +134,22 @@ pub mod lib { pub mod llvm; } -use result::{Ok, Err}; -use io::ReaderUtil; -use std::getopts; -use std::oldmap::HashMap; -use getopts::{opt_present}; -use getopts::groups; -use syntax::codemap; -use syntax::diagnostic; -use driver::driver::{host_triple, optgroups, early_error, - str_input, file_input, build_session_options, - build_session, build_configuration, parse_pretty, - pp_mode, pretty_print_input, list_metadata, - compile_input}; +use driver::driver::{host_triple, optgroups, early_error}; +use driver::driver::{str_input, file_input, build_session_options}; +use driver::driver::{build_session, build_configuration, parse_pretty}; +use driver::driver::{pp_mode, pretty_print_input, list_metadata}; +use driver::driver::{compile_input}; use driver::session; use middle::lint; +use core::io::ReaderUtil; +use core::result::{Ok, Err}; +use std::getopts::{groups, opt_present}; +use std::getopts; +use std::oldmap::HashMap; +use syntax::codemap; +use syntax::diagnostic; + pub fn version(argv0: &str) { let mut vers = ~"unknown version"; let env_vers = env!("CFG_VERSION"); diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 0add79266302..50c7b94078bb 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -85,7 +85,7 @@ fn opts() -> ~[(getopts::Opt, ~str)] { } pub fn usage() { - use io::println; + use core::io::println; println(~"Usage: rustdoc [options] \n"); println(~"Options:\n"); diff --git a/src/librustdoc/markdown_writer.rs b/src/librustdoc/markdown_writer.rs index 45a8aa9fd292..b57d8416aaba 100644 --- a/src/librustdoc/markdown_writer.rs +++ b/src/librustdoc/markdown_writer.rs @@ -108,7 +108,7 @@ fn pandoc_writer( ]; do generic_writer |markdown| { - use io::WriterUtil; + use core::io::WriterUtil; debug!("pandoc cmd: %s", pandoc_cmd); debug!("pandoc args: %s", str::connect(pandoc_args, ~" ")); @@ -281,7 +281,7 @@ mod test { } fn write_file(path: &Path, s: ~str) { - use io::WriterUtil; + use core::io::WriterUtil; match io::file_writer(path, ~[io::Create, io::Truncate]) { result::Ok(writer) => { diff --git a/src/librustdoc/rustdoc.rc b/src/librustdoc/rustdoc.rc index fc0ea4ce3960..54f1a779bcc6 100644 --- a/src/librustdoc/rustdoc.rc +++ b/src/librustdoc/rustdoc.rc @@ -31,41 +31,41 @@ extern mod syntax(vers = "0.6"); use core::*; use std::par; -mod pass; -mod config; -mod parse; -mod extract; -mod attr_parser; -mod doc; -mod markdown_index_pass; -mod markdown_pass; -mod markdown_writer; -mod fold; -mod path_pass; -mod attr_pass; -mod tystr_pass; -mod prune_hidden_pass; -mod desc_to_brief_pass; -mod text_pass; -mod unindent_pass; -mod trim_pass; -mod astsrv; -mod demo; -mod sort_pass; -mod sort_item_name_pass; -mod sort_item_type_pass; -mod page_pass; -mod sectionalize_pass; -mod escape_pass; -mod prune_private_pass; -mod util; +pub mod pass; +pub mod config; +pub mod parse; +pub mod extract; +pub mod attr_parser; +pub mod doc; +pub mod markdown_index_pass; +pub mod markdown_pass; +pub mod markdown_writer; +pub mod fold; +pub mod path_pass; +pub mod attr_pass; +pub mod tystr_pass; +pub mod prune_hidden_pass; +pub mod desc_to_brief_pass; +pub mod text_pass; +pub mod unindent_pass; +pub mod trim_pass; +pub mod astsrv; +pub mod demo; +pub mod sort_pass; +pub mod sort_item_name_pass; +pub mod sort_item_type_pass; +pub mod page_pass; +pub mod sectionalize_pass; +pub mod escape_pass; +pub mod prune_private_pass; +pub mod util; use doc::ItemUtils; use doc::Item; use pass::Pass; use config::Config; -fn main() { +pub fn main() { let args = os::args(); if args.contains(&~"-h") || args.contains(&~"--help") { @@ -144,7 +144,7 @@ fn run(config: Config) { } } -fn time(what: ~str, f: fn() -> T) -> T { +pub fn time(what: ~str, f: fn() -> T) -> T { let start = std::time::precise_time_s(); let rv = f(); let end = std::time::precise_time_s(); diff --git a/src/librustpkg/rustpkg.rc b/src/librustpkg/rustpkg.rc index b58b5977f97e..cc0458515394 100644 --- a/src/librustpkg/rustpkg.rc +++ b/src/librustpkg/rustpkg.rc @@ -27,14 +27,14 @@ extern mod rustc(vers = "0.6"); extern mod syntax(vers = "0.6"); use core::*; -use io::{ReaderUtil, WriterUtil}; -use std::{json, semver, getopts}; -use std::net::url; -use hashmap::linear::LinearMap; -use rustc::metadata::filesearch; +use core::hashmap::linear::LinearMap; +use core::io::{ReaderUtil, WriterUtil}; use rustc::driver::{driver, session}; -use syntax::{ast, attr, codemap, diagnostic, parse, visit}; +use rustc::metadata::filesearch; +use std::net::url; +use std::{json, semver, getopts}; use syntax::codemap::spanned; +use syntax::{ast, attr, codemap, diagnostic, parse, visit}; mod usage; mod util; diff --git a/src/librustpkg/util.rs b/src/librustpkg/util.rs index fdabe86359a6..bd2dd102e45c 100644 --- a/src/librustpkg/util.rs +++ b/src/librustpkg/util.rs @@ -8,20 +8,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::*; -use hashmap::linear::LinearMap; -use rustc::metadata::filesearch; -use rustc::driver::{driver, session}; -use syntax::ast_util::*; -use syntax::{ast, attr, codemap, diagnostic, fold, parse, visit}; -use codemap::{span, dummy_sp, spanned}; -use std::semver; -use std::{json, term, sort, getopts}; -use getopts::groups::getopts; use Listener; +use core::*; +use core::hashmap::linear::LinearMap; +use rustc::driver::{driver, session}; +use rustc::metadata::filesearch; +use std::getopts::groups::getopts; +use std::semver; +use std::{json, term, sort, getopts}; +use syntax::ast_util::*; +use syntax::codemap::{span, dummy_sp, spanned}; use syntax::ext::base::{mk_ctxt, ext_ctxt}; use syntax::ext::build; +use syntax::{ast, attr, codemap, diagnostic, fold, parse, visit}; pub struct Package { id: ~str, diff --git a/src/libstd/bigint.rs b/src/libstd/bigint.rs index 23a4769775c0..5212a17f3737 100644 --- a/src/libstd/bigint.rs +++ b/src/libstd/bigint.rs @@ -865,7 +865,7 @@ pub impl BigInt { mod biguint_tests { use core::*; - use num::{IntConvertible, Zero, One}; + use core::num::{IntConvertible, Zero, One}; use super::{BigInt, BigUint, BigDigit}; #[test] diff --git a/src/libstd/flatpipes.rs b/src/libstd/flatpipes.rs index 73dbe4bea574..42f954f7c390 100644 --- a/src/libstd/flatpipes.rs +++ b/src/libstd/flatpipes.rs @@ -771,10 +771,10 @@ mod test { writer_chan: WriterChanFactory, port: uint) { - use net::tcp; + use core::cell::Cell; use net::ip; - use cell::Cell; use net::tcp::TcpSocket; + use net::tcp; use uv; // Indicate to the client task that the server is listening diff --git a/src/libstd/semver.rs b/src/libstd/semver.rs index 5f96687127ca..7c7f3390f2e9 100644 --- a/src/libstd/semver.rs +++ b/src/libstd/semver.rs @@ -10,14 +10,14 @@ //! Semver parsing and logic -use io; -use io::{ReaderUtil}; -use option::{Option, Some, None}; -use uint; -use str; -use to_str::ToStr; -use char; +use core::char; use core::cmp; +use core::io::{ReaderUtil}; +use core::io; +use core::option::{Option, Some, None}; +use core::str; +use core::to_str::ToStr; +use core::uint; #[deriving_eq] pub enum Identifier { diff --git a/src/libstd/std.rc b/src/libstd/std.rc index 2f6c4e3f1904..f29872bf3871 100644 --- a/src/libstd/std.rc +++ b/src/libstd/std.rc @@ -113,7 +113,7 @@ pub mod serialize; // 'std' so that macro-expanded references to std::serialize and such // can be resolved within libcore. #[doc(hidden)] // FIXME #3538 -mod std { +pub mod std { pub use serialize; pub use test; } diff --git a/src/libstd/test.rs b/src/libstd/test.rs index 49a8dff4a962..3ebebe59d946 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -594,15 +594,14 @@ fn calc_result(desc: &TestDesc, task_succeeded: bool) -> TestResult { } pub mod bench { - - use rand; - use u64; - use vec; use time::precise_time_ns; use test::{BenchHarness, BenchSamples}; use stats::Stats; - use num; - use rand; + + use core::num; + use core::rand; + use core::u64; + use core::vec; pub impl BenchHarness { diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index b711825aecf7..7bd411315b22 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -221,7 +221,7 @@ mod test { let ch = ch.clone(); let hl_loop_clone = hl_loop.clone(); do task::spawn { - use rand::*; + use core::rand::*; let rng = Rng(); for iter::repeat(times) { sleep(&hl_loop_clone, rng.next() as uint % maxms); diff --git a/src/libstd/uv_global_loop.rs b/src/libstd/uv_global_loop.rs index 52cfc078bace..1898ef77320b 100644 --- a/src/libstd/uv_global_loop.rs +++ b/src/libstd/uv_global_loop.rs @@ -12,21 +12,20 @@ use ll = uv_ll; use iotask = uv_iotask; -use get_gl = get; +use get_gl = self::get; use uv_iotask::{IoTask, spawn_iotask}; +use core::clone::Clone; +use core::comm::{Port, Chan, SharedChan, select2i}; use core::either::{Left, Right}; use core::libc; -use core::comm::{Port, Chan, SharedChan, select2i}; -use core::unstable::global::{global_data_clone_create, - global_data_clone}; -use core::unstable::weak_task::weaken_task; +use core::option::{Some, None}; use core::str; use core::task::{task, SingleThreaded, spawn}; use core::task; +use core::unstable::global::{global_data_clone_create, global_data_clone}; +use core::unstable::weak_task::weaken_task; use core::vec; -use core::clone::Clone; -use core::option::{Some, None}; /** * Race-free helper to get access to a global task where a libuv @@ -123,7 +122,7 @@ fn spawn_loop() -> IoTask { mod test { use core::prelude::*; - use get_gl = get; + use get_gl = uv_global_loop::get; use uv::iotask; use uv::ll; use uv_global_loop::*; diff --git a/src/libstd/workcache.rs b/src/libstd/workcache.rs index 592ac40e0824..7f47db375041 100644 --- a/src/libstd/workcache.rs +++ b/src/libstd/workcache.rs @@ -396,7 +396,7 @@ fn unwrap + Decodable>( //#[test] fn test() { - use io::WriterUtil; + use core::io::WriterUtil; let db = @Mut(Database { db_filename: Path("db.json"), db_cache: LinearMap::new(), diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index e06e43f6287c..c414f7a0b9cb 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -24,7 +24,8 @@ use ext::base::*; use ext::base; use ext::build; use ext::build::*; -use unstable::extfmt::ct::*; + +use core::unstable::extfmt::ct::*; pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: &[ast::token_tree]) -> base::MacResult { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 4c48b49b5d61..b4a74d52fb6f 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -61,10 +61,10 @@ use ast::{vstore_uniq}; use ast; use ast_util::{ident_to_path, operator_prec}; use ast_util; -use classify; use codemap::{span,FssNone, BytePos, spanned, respan, mk_sp}; use codemap; use parse::attr::parser_attr; +use parse::classify; use parse::common::{seq_sep_none, token_to_str}; use parse::common::{seq_sep_trailing_disallowed, seq_sep_trailing_allowed}; use parse::lexer::reader; diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index 41500d6a409a..5fc93412c501 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -13,9 +13,8 @@ // type, and vice versa. use core::prelude::*; - -use hashmap::linear::LinearMap; -use dvec::DVec; +use core::dvec::DVec; +use core::hashmap::linear::LinearMap; pub struct Interner { priv map: @mut LinearMap, diff --git a/src/test/auxiliary/cci_nested_lib.rs b/src/test/auxiliary/cci_nested_lib.rs index 1be18459e407..05244ad096a3 100644 --- a/src/test/auxiliary/cci_nested_lib.rs +++ b/src/test/auxiliary/cci_nested_lib.rs @@ -10,7 +10,7 @@ #[legacy_modes]; -use dvec::DVec; +use core::dvec::DVec; pub struct Entry {key: A, value: B} diff --git a/src/test/auxiliary/trait_inheritance_overloading_xc.rs b/src/test/auxiliary/trait_inheritance_overloading_xc.rs index 67da2541ca21..10a7238a3f7d 100644 --- a/src/test/auxiliary/trait_inheritance_overloading_xc.rs +++ b/src/test/auxiliary/trait_inheritance_overloading_xc.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use cmp::Eq; +use core::cmp::Eq; pub trait MyNum : Add Sub Mul Eq { } diff --git a/src/test/compile-fail/import2.rs b/src/test/compile-fail/import2.rs index c04bce49d4ad..5ee4a01f2b9c 100644 --- a/src/test/compile-fail/import2.rs +++ b/src/test/compile-fail/import2.rs @@ -8,8 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: unresolved -use baz::zed::bar; +use baz::zed::bar; //~ ERROR unresolved name +//~^ ERROR failed to resolve import + mod baz {} mod zed { pub fn bar() { debug!("bar3"); } diff --git a/src/test/compile-fail/issue-1697.rs b/src/test/compile-fail/issue-1697.rs index 2a64666d94ca..a0d2536d85f0 100644 --- a/src/test/compile-fail/issue-1697.rs +++ b/src/test/compile-fail/issue-1697.rs @@ -10,7 +10,8 @@ // Testing that we don't fail abnormally after hitting the errors -use unresolved::*; //~ ERROR unresolved import +use unresolved::*; //~ ERROR unresolved name +//~^ ERROR failed to resolve import fn main() { } diff --git a/src/test/compile-fail/issue-2590.rs b/src/test/compile-fail/issue-2590.rs index 22ae941350b4..1de311f4de54 100644 --- a/src/test/compile-fail/issue-2590.rs +++ b/src/test/compile-fail/issue-2590.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use dvec::DVec; +use core::dvec::DVec; -type parser = { +struct parser { tokens: DVec, -}; +} trait parse { fn parse() -> ~[int]; @@ -20,7 +20,7 @@ trait parse { impl parse for parser { fn parse() -> ~[int] { - dvec::unwrap(self.tokens) //~ ERROR moving out of immutable field + ::core::dvec::unwrap(self.tokens) //~ ERROR moving out of immutable field } } diff --git a/src/test/compile-fail/issue-2611-3.rs b/src/test/compile-fail/issue-2611-3.rs index c9aeaae0ff93..1f425b092233 100644 --- a/src/test/compile-fail/issue-2611-3.rs +++ b/src/test/compile-fail/issue-2611-3.rs @@ -13,7 +13,7 @@ // we let an impl method can have more permissive bounds than the trait // method it's implementing, the return type might be less specific than // needed. Just punt and make it invariant. -use iter::BaseIter; +use core::iter::BaseIter; trait A { fn b(x: C) -> C; diff --git a/src/test/compile-fail/issue-2611-4.rs b/src/test/compile-fail/issue-2611-4.rs index fb7c5bd6cb87..ae7869d4a689 100644 --- a/src/test/compile-fail/issue-2611-4.rs +++ b/src/test/compile-fail/issue-2611-4.rs @@ -10,7 +10,7 @@ // Tests that an impl method's bounds aren't *more* restrictive // than the trait method it's implementing -use iter::BaseIter; +use core::iter::BaseIter; trait A { fn b(x: C) -> C; diff --git a/src/test/compile-fail/issue-2611-5.rs b/src/test/compile-fail/issue-2611-5.rs index 35015a260f5a..c28fd462b410 100644 --- a/src/test/compile-fail/issue-2611-5.rs +++ b/src/test/compile-fail/issue-2611-5.rs @@ -10,7 +10,7 @@ // Tests that ty params get matched correctly when comparing // an impl against a trait -use iter::BaseIter; +use core::iter::BaseIter; trait A { fn b(x: C) -> C; diff --git a/src/test/compile-fail/issue-3953.rs b/src/test/compile-fail/issue-3953.rs index 90ca7c1797c3..c88a94ef6296 100644 --- a/src/test/compile-fail/issue-3953.rs +++ b/src/test/compile-fail/issue-3953.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use cmp::Eq; +use core::cmp::Eq; trait Hahaha: Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq //~ ERROR Duplicate supertrait in trait declaration Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq diff --git a/src/test/compile-fail/issue-511.rs b/src/test/compile-fail/issue-511.rs index ba219f7b5fd2..f337914da6dc 100644 --- a/src/test/compile-fail/issue-511.rs +++ b/src/test/compile-fail/issue-511.rs @@ -9,7 +9,7 @@ // except according to those terms. extern mod std; -use cmp::Eq; +use core::cmp::Eq; fn f(o: &mut Option) { assert *o == option::None; diff --git a/src/test/compile-fail/pattern-tyvar-2.rs b/src/test/compile-fail/pattern-tyvar-2.rs index 29eb1ec8d0a3..7e65d1908c4d 100644 --- a/src/test/compile-fail/pattern-tyvar-2.rs +++ b/src/test/compile-fail/pattern-tyvar-2.rs @@ -11,7 +11,6 @@ extern mod std; -use option::Some; // error-pattern: mismatched types diff --git a/src/test/compile-fail/pattern-tyvar.rs b/src/test/compile-fail/pattern-tyvar.rs index bb4e97f9101b..6b3b6f1463f5 100644 --- a/src/test/compile-fail/pattern-tyvar.rs +++ b/src/test/compile-fail/pattern-tyvar.rs @@ -10,7 +10,6 @@ // except according to those terms. extern mod std; -use option::Some; // error-pattern: mismatched types diff --git a/src/test/compile-fail/regions-glb-free-free.rs b/src/test/compile-fail/regions-glb-free-free.rs index f9ea3c6f933a..c25205c58d19 100644 --- a/src/test/compile-fail/regions-glb-free-free.rs +++ b/src/test/compile-fail/regions-glb-free-free.rs @@ -11,7 +11,7 @@ mod argparse { extern mod std; - use either::{Either, Left, Right}; + use core::either::{Either, Left, Right}; pub struct Flag { name: &str, diff --git a/src/test/run-fail/issue-2156.rs b/src/test/run-fail/issue-2156.rs index a518816533e4..9ca343e3866b 100644 --- a/src/test/run-fail/issue-2156.rs +++ b/src/test/run-fail/issue-2156.rs @@ -11,7 +11,7 @@ // error-pattern:explicit failure // Don't double free the string extern mod std; -use io::ReaderUtil; +use core::io::ReaderUtil; fn main() { do io::with_str_reader(~"") |rdr| { diff --git a/src/test/run-fail/zip-different-lengths.rs b/src/test/run-fail/zip-different-lengths.rs index b50836beaa2e..6f7276af798d 100644 --- a/src/test/run-fail/zip-different-lengths.rs +++ b/src/test/run-fail/zip-different-lengths.rs @@ -12,7 +12,7 @@ // the assert should fail at runtime // error-pattern:Assertion same_length(chars, ints) failed extern mod std; -use vec::{same_length, zip}; +use core::vec::{same_length, zip}; fn enum_chars(start: u8, end: u8) -> ~[char] { assert start < end; diff --git a/src/test/run-pass/auto-encode.rs b/src/test/run-pass/auto-encode.rs index e4004c6dc221..171e7a836bee 100644 --- a/src/test/run-pass/auto-encode.rs +++ b/src/test/run-pass/auto-encode.rs @@ -17,13 +17,13 @@ extern mod std; // These tests used to be separate files, but I wanted to refactor all // the common code. -use cmp::Eq; -use std::ebml; use EBReader = std::ebml::reader; use EBWriter = std::ebml::writer; -use io::Writer; -use std::serialize::{Encodable, Decodable}; +use core::cmp::Eq; +use core::io::Writer; +use std::ebml; use std::prettyprint; +use std::serialize::{Encodable, Decodable}; use std::time; fn test_prettyprint>( diff --git a/src/test/run-pass/import-in-block.rs b/src/test/run-pass/import-in-block.rs index 72f6d23cacce..a6d8eac3bd16 100644 --- a/src/test/run-pass/import-in-block.rs +++ b/src/test/run-pass/import-in-block.rs @@ -9,10 +9,10 @@ // except according to those terms. pub fn main() { - use vec::from_fn; - log(debug, vec::len(from_fn(2, |i| i))); + use core::vec::from_fn; + log(debug, ::core::vec::len(from_fn(2, |i| i))); { - use vec::*; + use core::vec::*; log(debug, len(~[2])); } } diff --git a/src/test/run-pass/import3.rs b/src/test/run-pass/import3.rs index dedb2f2a99d5..972a36697317 100644 --- a/src/test/run-pass/import3.rs +++ b/src/test/run-pass/import3.rs @@ -12,7 +12,7 @@ use baz::zed; -use zed::bar; +use baz::zed::bar; mod baz { pub mod zed { diff --git a/src/test/run-pass/import6.rs b/src/test/run-pass/import6.rs index 88b839c0c08a..bbdbdd54f91f 100644 --- a/src/test/run-pass/import6.rs +++ b/src/test/run-pass/import6.rs @@ -18,6 +18,6 @@ mod foo { } } mod bar { - pub use zed::baz; + pub use foo::zed::baz; } pub fn main() { baz(); } diff --git a/src/test/run-pass/import7.rs b/src/test/run-pass/import7.rs index d5e15ea48e95..4c6cc3458c43 100644 --- a/src/test/run-pass/import7.rs +++ b/src/test/run-pass/import7.rs @@ -18,7 +18,7 @@ mod foo { } } mod bar { - pub use zed::baz; + pub use foo::zed::baz; pub mod foo { pub mod zed {} } diff --git a/src/test/run-pass/issue-2611.rs b/src/test/run-pass/issue-2611.rs index b70a9670df19..7b3247fafc7d 100644 --- a/src/test/run-pass/issue-2611.rs +++ b/src/test/run-pass/issue-2611.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use iter::BaseIter; +use core::iter::BaseIter; trait FlatMapToVec { fn flat_map_to_vec>(op: fn(&A) -> IB) -> ~[B]; diff --git a/src/test/run-pass/issue-2804.rs b/src/test/run-pass/issue-2804.rs index 613652ec8524..2b4acc34f465 100644 --- a/src/test/run-pass/issue-2804.rs +++ b/src/test/run-pass/issue-2804.rs @@ -11,12 +11,11 @@ // except according to those terms. extern mod std; -use io::WriterUtil; +use core::io::WriterUtil; use std::oldmap::HashMap; use std::json; -enum object -{ +enum object { bool_value(bool), int_value(i64), } diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index 3ed7d2f842d1..3340a387a128 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -12,7 +12,7 @@ /// Map representation -use io::ReaderUtil; +use core::io::ReaderUtil; extern mod std; diff --git a/src/test/run-pass/issue-3176.rs b/src/test/run-pass/issue-3176.rs index e441fa22b315..e0c074c968f3 100644 --- a/src/test/run-pass/issue-3176.rs +++ b/src/test/run-pass/issue-3176.rs @@ -10,7 +10,7 @@ // xfail-fast -use comm::{Select2, Selectable}; +use core::comm::{Select2, Selectable}; pub fn main() { let (p,c) = comm::stream(); diff --git a/src/test/run-pass/issue-3424.rs b/src/test/run-pass/issue-3424.rs index 5d6367df3b6a..e4649ed04703 100644 --- a/src/test/run-pass/issue-3424.rs +++ b/src/test/run-pass/issue-3424.rs @@ -12,7 +12,7 @@ // rustc --test ignores2.rs && ./ignores2 extern mod std; -use path::{Path}; +use core::path::{Path}; type rsrc_loader = fn~ (path: &Path) -> result::Result<~str, ~str>; diff --git a/src/test/run-pass/issue-3563-3.rs b/src/test/run-pass/issue-3563-3.rs index f66a3cc474c2..4671b25ce22d 100644 --- a/src/test/run-pass/issue-3563-3.rs +++ b/src/test/run-pass/issue-3563-3.rs @@ -20,7 +20,7 @@ extern mod std; // Extern mod controls linkage. Use controls the visibility of names to modules that are // already linked in. Using WriterUtil allows us to use the write_line method. -use io::WriterUtil; +use core::io::WriterUtil; // Represents a position on a canvas. struct Point { diff --git a/src/test/run-pass/issue-3609.rs b/src/test/run-pass/issue-3609.rs index 83703dacc36e..cc774e213760 100644 --- a/src/test/run-pass/issue-3609.rs +++ b/src/test/run-pass/issue-3609.rs @@ -1,6 +1,6 @@ extern mod std; -use comm::Chan; +use core::comm::Chan; type RingBuffer = ~[float]; type SamplesFn = fn~ (samples: &RingBuffer); diff --git a/src/test/run-pass/new-import-syntax.rs b/src/test/run-pass/new-import-syntax.rs index 3bc1b6c1eba9..267f365c7134 100644 --- a/src/test/run-pass/new-import-syntax.rs +++ b/src/test/run-pass/new-import-syntax.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use io::println; +use core::io::println; pub fn main() { println("Hello world!"); diff --git a/src/test/run-pass/reflect-visit-data.rs b/src/test/run-pass/reflect-visit-data.rs index c472e5305840..541d898c1ff2 100644 --- a/src/test/run-pass/reflect-visit-data.rs +++ b/src/test/run-pass/reflect-visit-data.rs @@ -11,9 +11,9 @@ // xfail-fast use core::bool; +use core::libc::c_void; +use core::vec::UnboxedVecRepr; use intrinsic::{TyDesc, get_tydesc, visit_tydesc, TyVisitor}; -use libc::c_void; -use vec::UnboxedVecRepr; #[doc = "High-level interfaces to `intrinsic::visit_ty` reflection system."] diff --git a/src/test/run-pass/regions-mock-trans-impls.rs b/src/test/run-pass/regions-mock-trans-impls.rs index 5c1255f2aa2d..12e8ab1384fc 100644 --- a/src/test/run-pass/regions-mock-trans-impls.rs +++ b/src/test/run-pass/regions-mock-trans-impls.rs @@ -11,7 +11,9 @@ // except according to those terms. extern mod std; -use libc, sys, cast; +use core::libc; +use core::sys; +use core::cast; use std::arena::Arena; struct Bcx { diff --git a/src/test/run-pass/ret-break-cont-in-block.rs b/src/test/run-pass/ret-break-cont-in-block.rs index 2f0f9e5ae6ad..3f11a9bdce3c 100644 --- a/src/test/run-pass/ret-break-cont-in-block.rs +++ b/src/test/run-pass/ret-break-cont-in-block.rs @@ -10,7 +10,7 @@ // xfail-fast -use cmp::Eq; +use core::cmp::Eq; fn iter(v: ~[T], it: fn(&T) -> bool) { let mut i = 0u, l = v.len(); diff --git a/src/test/run-pass/stat.rs b/src/test/run-pass/stat.rs index 21d494e00886..c39a0f36d580 100644 --- a/src/test/run-pass/stat.rs +++ b/src/test/run-pass/stat.rs @@ -11,7 +11,7 @@ // xfail-fast extern mod std; -use io::WriterUtil; +use core::io::WriterUtil; use std::tempfile; pub fn main() { diff --git a/src/test/run-pass/task-comm-0.rs b/src/test/run-pass/task-comm-0.rs index f260e571b42a..3e71875c4b5c 100644 --- a/src/test/run-pass/task-comm-0.rs +++ b/src/test/run-pass/task-comm-0.rs @@ -13,8 +13,8 @@ extern mod std; -use comm::Chan; -use comm::Port; +use core::comm::Chan; +use core::comm::Port; pub fn main() { test05(); } diff --git a/src/test/run-pass/trait-inheritance-num.rs b/src/test/run-pass/trait-inheritance-num.rs index 4e46d6b2b18b..36b1e6cd4de4 100644 --- a/src/test/run-pass/trait-inheritance-num.rs +++ b/src/test/run-pass/trait-inheritance-num.rs @@ -10,8 +10,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use cmp::{Eq, Ord}; -use num::NumCast::from; +use core::cmp::{Eq, Ord}; +use core::num::NumCast::from; extern mod std; use std::cmp::FuzzyEq; diff --git a/src/test/run-pass/trait-inheritance-num0.rs b/src/test/run-pass/trait-inheritance-num0.rs index 1996e05618a0..70eed496db3f 100644 --- a/src/test/run-pass/trait-inheritance-num0.rs +++ b/src/test/run-pass/trait-inheritance-num0.rs @@ -12,7 +12,7 @@ // Extending Num and using inherited static methods -use num::NumCast::from; +use core::num::NumCast::from; trait Num { static fn from_int(i: int) -> Self; diff --git a/src/test/run-pass/trait-inheritance-num1.rs b/src/test/run-pass/trait-inheritance-num1.rs index 03230dc39af3..44b4bd60f1de 100644 --- a/src/test/run-pass/trait-inheritance-num1.rs +++ b/src/test/run-pass/trait-inheritance-num1.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use cmp::Ord; -use num::NumCast::from; +use core::cmp::Ord; +use core::num::NumCast::from; pub trait NumExt: NumCast Ord { } diff --git a/src/test/run-pass/trait-inheritance-num2.rs b/src/test/run-pass/trait-inheritance-num2.rs index f20181d22d34..5c9d9e6a13b5 100644 --- a/src/test/run-pass/trait-inheritance-num2.rs +++ b/src/test/run-pass/trait-inheritance-num2.rs @@ -12,8 +12,8 @@ // A more complex example of numeric extensions -use cmp::{Eq, Ord}; -use num::NumCast::from; +use core::cmp::{Eq, Ord}; +use core::num::NumCast::from; extern mod std; use std::cmp::FuzzyEq; diff --git a/src/test/run-pass/trait-inheritance-num3.rs b/src/test/run-pass/trait-inheritance-num3.rs index adb9f01fff8a..c2cd56ad1078 100644 --- a/src/test/run-pass/trait-inheritance-num3.rs +++ b/src/test/run-pass/trait-inheritance-num3.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use cmp::{Eq, Ord}; -use num::NumCast::from; +use core::cmp::{Eq, Ord}; +use core::num::NumCast::from; pub trait NumExt: Eq Ord NumCast {} diff --git a/src/test/run-pass/trait-inheritance-num5.rs b/src/test/run-pass/trait-inheritance-num5.rs index d10126dddb6c..ac8d80359d87 100644 --- a/src/test/run-pass/trait-inheritance-num5.rs +++ b/src/test/run-pass/trait-inheritance-num5.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use cmp::{Eq, Ord}; -use num::NumCast::from; +use core::cmp::{Eq, Ord}; +use core::num::NumCast::from; pub trait NumExt: Eq NumCast {} diff --git a/src/test/run-pass/trait-inheritance-overloading-simple.rs b/src/test/run-pass/trait-inheritance-overloading-simple.rs index b068d109ccfd..7ecc15a0d812 100644 --- a/src/test/run-pass/trait-inheritance-overloading-simple.rs +++ b/src/test/run-pass/trait-inheritance-overloading-simple.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use cmp::Eq; +use core::cmp::Eq; trait MyNum : Eq { } diff --git a/src/test/run-pass/trait-inheritance-overloading.rs b/src/test/run-pass/trait-inheritance-overloading.rs index 08f3d41ddad9..54a9ea9ad1e3 100644 --- a/src/test/run-pass/trait-inheritance-overloading.rs +++ b/src/test/run-pass/trait-inheritance-overloading.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use cmp::Eq; +use core::cmp::Eq; trait MyNum : Add Sub Mul Eq { } diff --git a/src/test/run-pass/unique-kinds.rs b/src/test/run-pass/unique-kinds.rs index 180ce716dcc9..3cc184572865 100644 --- a/src/test/run-pass/unique-kinds.rs +++ b/src/test/run-pass/unique-kinds.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use cmp::Eq; +use core::cmp::Eq; fn sendable() { diff --git a/src/test/run-pass/zip-same-length.rs b/src/test/run-pass/zip-same-length.rs index 167448cfe25b..1ade9e8246fd 100644 --- a/src/test/run-pass/zip-same-length.rs +++ b/src/test/run-pass/zip-same-length.rs @@ -10,7 +10,7 @@ // In this case, the code should compile and should // succeed at runtime -use vec::{head, last, same_length, zip}; +use core::vec::{head, last, same_length, zip}; fn enum_chars(start: u8, end: u8) -> ~[char] { assert start < end;