From a8d37af2473da79be704c9ce2374f278c47177b6 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 8 Jan 2013 11:12:16 -0800 Subject: [PATCH] librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc --- doc/tutorial.md | 10 +- src/compiletest/common.rs | 2 + src/compiletest/errors.rs | 2 + src/compiletest/header.rs | 2 + src/compiletest/procsrv.rs | 2 + src/compiletest/runtest.rs | 2 + src/compiletest/util.rs | 2 + src/libcargo/pgp.rs | 1 + src/libcore/at_vec.rs | 10 +- src/libcore/bool.rs | 1 + src/libcore/cast.rs | 2 + src/libcore/char.rs | 1 + src/libcore/condition.rs | 1 + src/libcore/core.rc | 5 + src/libcore/dlist.rs | 10 +- src/libcore/dvec.rs | 1 + src/libcore/either.rs | 5 +- src/libcore/extfmt.rs | 2 + src/libcore/float.rs | 1 + src/libcore/gc.rs | 1 + src/libcore/int-template.rs | 1 + src/libcore/int-template/int.rs | 6 +- src/libcore/io.rs | 17 ++- src/libcore/iter-trait.rs | 3 + src/libcore/iter-trait/dlist.rs | 1 + src/libcore/iter-trait/dvec.rs | 1 + src/libcore/iter-trait/option.rs | 4 +- src/libcore/iter.rs | 2 + src/libcore/libc.rs | 115 +++++++++++++----- src/libcore/managed.rs | 4 +- src/libcore/oldcomm.rs | 2 + src/libcore/option.rs | 1 + src/libcore/os.rs | 19 ++- src/libcore/path.rs | 7 +- src/libcore/pipes.rs | 7 +- src/libcore/prelude.rs | 93 ++++++++++++++ src/libcore/private.rs | 4 + src/libcore/rand.rs | 4 +- src/libcore/result.rs | 3 + src/libcore/run.rs | 8 +- src/libcore/send_map.rs | 7 ++ src/libcore/str.rs | 8 +- src/libcore/sys.rs | 1 + src/libcore/task/local_data.rs | 1 + src/libcore/task/local_data_priv.rs | 2 + src/libcore/task/mod.rs | 1 + src/libcore/task/spawn.rs | 8 +- src/libcore/to_bytes.rs | 3 + src/libcore/to_str.rs | 1 + src/libcore/tuple.rs | 1 + src/libcore/uint-template.rs | 1 + src/libcore/util.rs | 5 + src/libcore/vec.rs | 20 ++- src/librustc/back/link.rs | 22 +++- src/librustc/back/rpath.rs | 12 ++ src/librustc/driver/driver.rs | 7 ++ src/librustc/driver/session.rs | 7 ++ src/librustc/front/config.rs | 1 + src/librustc/front/core_inject.rs | 17 ++- src/librustc/front/intrinsic_inject.rs | 1 + src/librustc/front/test.rs | 1 + src/librustc/lib/llvm.rs | 1 + src/librustc/metadata/creader.rs | 2 + src/librustc/metadata/csearch.rs | 2 + src/librustc/metadata/cstore.rs | 2 + src/librustc/metadata/decoder.rs | 2 + src/librustc/metadata/encoder.rs | 2 + src/librustc/metadata/filesearch.rs | 2 + src/librustc/metadata/loader.rs | 5 +- src/librustc/metadata/tydecode.rs | 2 + src/librustc/metadata/tyencode.rs | 2 + src/librustc/middle/astencode.rs | 1 + src/librustc/middle/borrowck/check_loans.rs | 13 +- src/librustc/middle/borrowck/gather_loans.rs | 11 +- src/librustc/middle/borrowck/loan.rs | 11 +- src/librustc/middle/borrowck/mod.rs | 9 +- src/librustc/middle/borrowck/preserve.rs | 10 ++ src/librustc/middle/capture.rs | 1 + src/librustc/middle/check_const.rs | 1 + src/librustc/middle/check_match.rs | 1 + src/librustc/middle/const_eval.rs | 1 + src/librustc/middle/kind.rs | 1 + src/librustc/middle/lang_items.rs | 2 + src/librustc/middle/lint.rs | 1 + src/librustc/middle/liveness.rs | 2 + src/librustc/middle/mem_categorization.rs | 8 +- src/librustc/middle/mode.rs | 1 + src/librustc/middle/pat_util.rs | 1 + src/librustc/middle/privacy.rs | 2 + src/librustc/middle/region.rs | 1 + src/librustc/middle/resolve.rs | 77 +----------- src/librustc/middle/trans/_match.rs | 1 + src/librustc/middle/trans/base.rs | 1 + src/librustc/middle/trans/callee.rs | 1 + src/librustc/middle/trans/closure.rs | 1 + src/librustc/middle/trans/common.rs | 2 + src/librustc/middle/trans/consts.rs | 1 + src/librustc/middle/trans/controlflow.rs | 1 + src/librustc/middle/trans/datum.rs | 1 + src/librustc/middle/trans/debuginfo.rs | 1 + src/librustc/middle/trans/expr.rs | 1 + src/librustc/middle/trans/foreign.rs | 1 + src/librustc/middle/trans/glue.rs | 1 + src/librustc/middle/trans/inline.rs | 1 + src/librustc/middle/trans/meth.rs | 2 + src/librustc/middle/trans/monomorphize.rs | 1 + src/librustc/middle/ty.rs | 2 + src/librustc/middle/typeck/astconv.rs | 8 +- src/librustc/middle/typeck/check/_match.rs | 8 +- src/librustc/middle/typeck/check/demand.rs | 2 + src/librustc/middle/typeck/check/method.rs | 12 +- src/librustc/middle/typeck/check/mod.rs | 28 ++++- src/librustc/middle/typeck/check/regionck.rs | 7 +- .../middle/typeck/check/regionmanip.rs | 7 ++ src/librustc/middle/typeck/check/vtable.rs | 7 ++ src/librustc/middle/typeck/check/writeback.rs | 8 +- src/librustc/middle/typeck/coherence.rs | 11 +- src/librustc/middle/typeck/collect.rs | 11 +- .../middle/typeck/infer/assignment.rs | 6 + src/librustc/middle/typeck/infer/combine.rs | 12 +- src/librustc/middle/typeck/infer/floating.rs | 3 +- src/librustc/middle/typeck/infer/glb.rs | 8 +- src/librustc/middle/typeck/infer/integral.rs | 3 + src/librustc/middle/typeck/infer/lattice.rs | 5 + src/librustc/middle/typeck/infer/lub.rs | 8 +- src/librustc/middle/typeck/infer/mod.rs | 19 ++- .../middle/typeck/infer/region_inference.rs | 11 +- src/librustc/middle/typeck/infer/resolve.rs | 8 ++ src/librustc/middle/typeck/infer/sub.rs | 9 ++ src/librustc/middle/typeck/infer/test.rs | 28 +++-- src/librustc/middle/typeck/infer/to_str.rs | 7 +- src/librustc/middle/typeck/infer/unify.rs | 5 + src/librustc/middle/typeck/mod.rs | 10 +- src/librustc/middle/typeck/rscope.rs | 2 + src/librustc/util/common.rs | 1 + src/librustc/util/ppaux.rs | 1 + src/librustdoc/astsrv.rs | 2 + src/librustdoc/attr_parser.rs | 8 +- src/librustdoc/attr_pass.rs | 10 +- src/librustdoc/config.rs | 15 ++- src/librustdoc/demo.rs | 2 + src/librustdoc/desc_to_brief_pass.rs | 12 +- src/librustdoc/doc.rs | 3 + src/librustdoc/escape_pass.rs | 1 + src/librustdoc/extract.rs | 3 + src/librustdoc/fold.rs | 3 + src/librustdoc/markdown_index_pass.rs | 13 +- src/librustdoc/markdown_pass.rs | 7 +- src/librustdoc/markdown_writer.rs | 3 + src/librustdoc/page_pass.rs | 12 +- src/librustdoc/parse.rs | 2 + src/librustdoc/pass.rs | 3 + src/librustdoc/path_pass.rs | 3 + src/librustdoc/prune_hidden_pass.rs | 10 +- src/librustdoc/prune_private_pass.rs | 9 +- src/librustdoc/sectionalize_pass.rs | 12 +- src/librustdoc/sort_item_name_pass.rs | 1 + src/librustdoc/sort_item_type_pass.rs | 3 + src/librustdoc/sort_pass.rs | 3 + src/librustdoc/text_pass.rs | 8 +- src/librustdoc/trim_pass.rs | 7 +- src/librustdoc/tystr_pass.rs | 12 +- src/librustdoc/unindent_pass.rs | 3 + src/librustdoc/util.rs | 2 + src/libstd/arc.rs | 4 + src/libstd/arena.rs | 1 + src/libstd/bitv.rs | 4 + src/libstd/c_vec.rs | 5 + src/libstd/cell.rs | 1 + src/libstd/comm.rs | 3 + src/libstd/deque.rs | 4 + src/libstd/ebml.rs | 18 ++- src/libstd/flatpipes.rs | 23 +++- src/libstd/fun_treemap.rs | 1 + src/libstd/future.rs | 5 + src/libstd/getopts.rs | 17 ++- src/libstd/json.rs | 5 + src/libstd/list.rs | 2 + src/libstd/map.rs | 5 +- src/libstd/net_ip.rs | 15 ++- src/libstd/net_tcp.rs | 11 +- src/libstd/net_url.rs | 5 + src/libstd/par.rs | 1 + src/libstd/priority_queue.rs | 1 + src/libstd/rl.rs | 1 + src/libstd/rope.rs | 18 ++- src/libstd/serialize.rs | 1 + src/libstd/smallintmap.rs | 3 + src/libstd/sort.rs | 21 ++++ src/libstd/sync.rs | 5 + src/libstd/task_pool.rs | 1 + src/libstd/tempfile.rs | 1 + src/libstd/test.rs | 16 ++- src/libstd/time.rs | 3 + src/libstd/timer.rs | 4 + src/libstd/treemap.rs | 7 +- src/libstd/uv_global_loop.rs | 3 + src/libstd/uv_iotask.rs | 4 + src/libstd/uv_ll.rs | 8 ++ src/libstd/workcache.rs | 1 + src/libsyntax/ast.rs | 15 +-- src/libsyntax/ast_map.rs | 2 + src/libsyntax/ast_util.rs | 3 + src/libsyntax/attr.rs | 2 + src/libsyntax/codemap.rs | 2 + src/libsyntax/diagnostic.rs | 2 + src/libsyntax/ext/auto_encode.rs | 6 +- src/libsyntax/ext/base.rs | 2 + src/libsyntax/ext/build.rs | 2 + src/libsyntax/ext/concat_idents.rs | 2 + src/libsyntax/ext/deriving.rs | 2 + src/libsyntax/ext/expand.rs | 2 + src/libsyntax/ext/fmt.rs | 2 + src/libsyntax/ext/pipes/ast_builder.rs | 41 ++++++- src/libsyntax/ext/pipes/check.rs | 3 + src/libsyntax/ext/pipes/liveness.rs | 5 + src/libsyntax/ext/pipes/mod.rs | 2 + src/libsyntax/ext/pipes/parse_proto.rs | 3 +- src/libsyntax/ext/pipes/pipec.rs | 4 +- src/libsyntax/ext/pipes/proto.rs | 4 + src/libsyntax/ext/quote.rs | 2 + src/libsyntax/ext/source_util.rs | 1 + src/libsyntax/ext/trace_macros.rs | 9 +- src/libsyntax/ext/tt/macro_rules.rs | 2 + src/libsyntax/ext/tt/transcribe.rs | 2 + src/libsyntax/fold.rs | 2 + src/libsyntax/parse/attr.rs | 3 + src/libsyntax/parse/comments.rs | 4 +- src/libsyntax/parse/common.rs | 4 + src/libsyntax/parse/lexer.rs | 4 +- src/libsyntax/parse/mod.rs | 106 +++++++--------- src/libsyntax/parse/obsolete.rs | 3 + src/libsyntax/parse/parser.rs | 38 +++--- src/libsyntax/parse/prec.rs | 4 +- src/libsyntax/parse/token.rs | 2 + src/libsyntax/print/pp.rs | 2 + src/libsyntax/print/pprust.rs | 6 +- src/libsyntax/util/interner.rs | 10 +- src/libsyntax/visit.rs | 2 + .../bench/task-perf-word-count-generic.rs | 52 ++++---- src/test/compile-fail/copy-into-closure.rs | 8 +- src/test/compile-fail/issue-2718-a.rs | 8 +- src/test/run-pass/export-non-interference2.rs | 9 +- src/test/run-pass/hashmap-memory.rs | 16 ++- src/test/run-pass/issue-2718.rs | 8 +- src/test/run-pass/pipe-bank-proto.rs | 16 +-- src/test/run-pass/pipe-pingpong-bounded.rs | 2 + .../run-pass/pipe-presentation-examples.rs | 8 +- src/test/run-pass/reflect-visit-data.rs | 1 + src/test/run-pass/static-impl.rs | 12 +- 250 files changed, 1342 insertions(+), 453 deletions(-) create mode 100644 src/libcore/prelude.rs diff --git a/doc/tutorial.md b/doc/tutorial.md index fb5e9dc07a8..ea53160109b 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -2284,6 +2284,10 @@ struct level. Note that fields and methods are _public_ by default. ~~~ mod farm { # use farm; +# pub type Chicken = int; +# type Cow = int; +# enum Human = int; +# impl Human { fn rest(&self) { } } # pub fn make_me_a_farm() -> farm::Farm { farm::Farm { chickens: ~[], cows: ~[], farmer: Human(0) } } pub struct Farm { priv mut chickens: ~[Chicken], @@ -2310,12 +2314,8 @@ fn main() { farm::feed_animals(&f); f.farmer.rest(); } -# type Chicken = int; -# type Cow = int; -# enum Human = int; # fn make_me_a_farm() -> farm::Farm { farm::make_me_a_farm() } -# fn make_me_a_chicken() -> Chicken { 0 } -# impl Human { fn rest(&self) { } } +# fn make_me_a_chicken() -> farm::Chicken { 0 } ~~~ ## Crates diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs index 136f40c9c20..5b93c55ddc6 100644 --- a/src/compiletest/common.rs +++ b/src/compiletest/common.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use cmp; enum mode { mode_compile_fail, mode_run_fail, mode_run_pass, mode_pretty, } diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs index 62961f6c6e4..54723253141 100644 --- a/src/compiletest/errors.rs +++ b/src/compiletest/errors.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use common::config; use io; use io::ReaderUtil; diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index 730e863d04d..9fe5d9acb9b 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use common; use common::config; use io; diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index 666deeca191..b3884917389 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use io; use io::{ReaderUtil, WriterUtil}; use libc; diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index a7dbfb9a3b2..d7810ced2b6 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use io; use io::WriterUtil; use os; diff --git a/src/compiletest/util.rs b/src/compiletest/util.rs index fe3bf4672c7..13614c58855 100644 --- a/src/compiletest/util.rs +++ b/src/compiletest/util.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use io; use os; use os::getenv; diff --git a/src/libcargo/pgp.rs b/src/libcargo/pgp.rs index e05260bace2..829a82baf7f 100644 --- a/src/libcargo/pgp.rs +++ b/src/libcargo/pgp.rs @@ -9,6 +9,7 @@ // except according to those terms. use core::os; +use core::path::Path; use core::run; fn gpgv(args: ~[~str]) -> { status: int, out: ~str, err: ~str } { diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs index 4f3f63c83fc..d78d241d2b1 100644 --- a/src/libcore/at_vec.rs +++ b/src/libcore/at_vec.rs @@ -15,8 +15,10 @@ #[forbid(deprecated_pattern)]; use cast::transmute; +use kinds::Copy; use iter; use libc; +use option::Option; use ptr::addr_of; use sys; use uint; @@ -150,6 +152,10 @@ fn vec_reserve_shared_actual(++t: *sys::TypeDesc, #[cfg(notest)] pub mod traits { + use at_vec::append; + use kinds::Copy; + use ops::Add; + pub impl @[T] : Add<&[const T],@[T]> { #[inline(always)] pure fn add(&self, rhs: & &self/[const T]) -> @[T] { @@ -162,8 +168,10 @@ pub impl @[T] : Add<&[const T],@[T]> { pub mod traits {} pub mod raw { - use at_vec::{rusti, rustrt}; + use at_vec::{capacity, rusti, rustrt}; + use cast::transmute; use libc; + use ptr::addr_of; use ptr; use sys; use uint; diff --git a/src/libcore/bool.rs b/src/libcore/bool.rs index 3181cb24ea7..3e7b88b7b78 100644 --- a/src/libcore/bool.rs +++ b/src/libcore/bool.rs @@ -19,6 +19,7 @@ use bool; use cmp; use cmp::Eq; +use option::{None, Option, Some}; /// Negation / inverse pub pure fn not(v: bool) -> bool { !v } diff --git a/src/libcore/cast.rs b/src/libcore/cast.rs index 4ae89191545..950a753d73f 100644 --- a/src/libcore/cast.rs +++ b/src/libcore/cast.rs @@ -108,6 +108,8 @@ pub unsafe fn copy_lifetime_vec(_ptr: &a/[S], ptr: &T) -> &a/T { #[cfg(test)] pub mod tests { + use cast::{bump_box_refcount, reinterpret_cast, transmute}; + #[test] pub fn test_reinterpret_cast() { assert 1u == unsafe { reinterpret_cast(&1) }; diff --git a/src/libcore/char.rs b/src/libcore/char.rs index 4fe60810dc3..8403c621608 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -16,6 +16,7 @@ use char; use cmp::Eq; +use option::{None, Option, Some}; use str; use u32; use uint; diff --git a/src/libcore/condition.rs b/src/libcore/condition.rs index 9ea48a45d3c..a40121445fa 100644 --- a/src/libcore/condition.rs +++ b/src/libcore/condition.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use prelude::*; use task; use task::local_data::{local_data_pop, local_data_set}; diff --git a/src/libcore/core.rc b/src/libcore/core.rc index 13e0e300242..b422d76e02d 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -53,6 +53,9 @@ Implicitly, all crates behave as if they included the following prologue: #[warn(vecs_implicitly_copyable)]; #[deny(non_camel_case_types)]; +/* The Prelude. */ + +pub mod prelude; /* Primitive types */ @@ -243,6 +246,8 @@ pub mod core { pub use cmp; pub use condition; + pub use option; + pub use kinds; } diff --git a/src/libcore/dlist.rs b/src/libcore/dlist.rs index 89789a38b24..1aa6c5a0197 100644 --- a/src/libcore/dlist.rs +++ b/src/libcore/dlist.rs @@ -22,7 +22,9 @@ #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; +use kinds::Copy; use managed; +use option::{None, Option, Some}; use option; use vec; @@ -94,13 +96,13 @@ impl DListNode { } /// Creates a new dlist node with the given data. -pure fn new_dlist_node(data: T) -> DListNode { +pub pure fn new_dlist_node(data: T) -> DListNode { DListNode(@{data: move data, mut linked: false, mut prev: None, mut next: None}) } /// Creates a new, empty dlist. -pure fn DList() -> DList { +pub pure fn DList() -> DList { DList_(@{mut size: 0, mut hd: None, mut tl: None}) } @@ -120,7 +122,7 @@ pub fn from_vec(vec: &[T]) -> DList { /// Produce a list from a list of lists, leaving no elements behind in the /// input. O(number of sub-lists). -fn concat(lists: DList>) -> DList { +pub fn concat(lists: DList>) -> DList { let result = DList(); while !lists.is_empty() { result.append(lists.pop().get()); @@ -474,7 +476,9 @@ fn pop_tail() -> Option { self.pop_tail_n().map (|nobe| nobe.data) } mod tests { #[legacy_exports]; + use dlist::{DList, concat, from_vec, new_dlist_node}; use iter; + use option::{None, Some}; use vec; #[test] diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs index dd6b0721121..92ac1faf306 100644 --- a/src/libcore/dvec.rs +++ b/src/libcore/dvec.rs @@ -25,6 +25,7 @@ use cast; use cast::reinterpret_cast; +use prelude::*; use ptr::null; use vec; diff --git a/src/libcore/either.rs b/src/libcore/either.rs index b2c70916a00..4902edcedb1 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -14,10 +14,11 @@ //! A type that represents one of two alternatives -use cmp; use cmp::Eq; -use result; +use cmp; +use kinds::Copy; use result::Result; +use result; use vec; /// The either type diff --git a/src/libcore/extfmt.rs b/src/libcore/extfmt.rs index 312fc18a033..474e4ae77bb 100644 --- a/src/libcore/extfmt.rs +++ b/src/libcore/extfmt.rs @@ -82,6 +82,7 @@ use cmp::Eq; use option::{Some, None}; +use prelude::*; use str; /* @@ -99,6 +100,7 @@ #[doc(hidden)] pub mod ct { use char; + use prelude::*; use str; use vec; diff --git a/src/libcore/float.rs b/src/libcore/float.rs index 34269b88748..3e521764723 100644 --- a/src/libcore/float.rs +++ b/src/libcore/float.rs @@ -31,6 +31,7 @@ use f64; use num; use num::Num::from_int; +use option::{None, Option, Some}; use str; use uint; diff --git a/src/libcore/gc.rs b/src/libcore/gc.rs index 89f5a4eb8f0..bab0c710c3a 100644 --- a/src/libcore/gc.rs +++ b/src/libcore/gc.rs @@ -42,6 +42,7 @@ use cast; use io; use libc::{size_t, uintptr_t}; +use option::{None, Option, Some}; use ptr; use send_map::linear::LinearMap; use stackwalk; diff --git a/src/libcore/int-template.rs b/src/libcore/int-template.rs index d04123fdb2b..4946a0997c1 100644 --- a/src/libcore/int-template.rs +++ b/src/libcore/int-template.rs @@ -21,6 +21,7 @@ use iter; use num; use num::Num::from_int; +use prelude::*; use str; use uint; use vec; diff --git a/src/libcore/int-template/int.rs b/src/libcore/int-template/int.rs index 9e06cc95270..224da0dc062 100644 --- a/src/libcore/int-template/int.rs +++ b/src/libcore/int-template/int.rs @@ -50,8 +50,8 @@ fn test_pow() { #[test] fn test_overflows() { - assert (max_value > 0); - assert (min_value <= 0); - assert (min_value + max_value + 1 == 0); + assert (::int::max_value > 0); + assert (::int::min_value <= 0); + assert (::int::min_value + ::int::max_value + 1 == 0); } } diff --git a/src/libcore/io.rs b/src/libcore/io.rs index ade4f9d7fc8..e0065f9c1e8 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -28,6 +28,7 @@ use libc::consts::os::extra::*; use option; use os; +use prelude::*; use ptr; use result; use str; @@ -35,7 +36,7 @@ use vec; #[allow(non_camel_case_types)] // not sure what to do about this -type fd_t = c_int; +pub type fd_t = c_int; #[abi = "cdecl"] extern mod rustrt { @@ -452,12 +453,12 @@ fn seek(&self, off: int, whence: SeekStyle) { fn tell(&self) -> uint { self.base.tell() } } -struct FILERes { +pub struct FILERes { f: *libc::FILE, drop { libc::fclose(self.f); } } -fn FILERes(f: *libc::FILE) -> FILERes { +pub fn FILERes(f: *libc::FILE) -> FILERes { FILERes { f: f } @@ -629,12 +630,12 @@ fn get_type(&self) -> WriterType { } } -struct FdRes { +pub struct FdRes { fd: fd_t, drop { libc::close(self.fd); } } -fn FdRes(fd: fd_t) -> FdRes { +pub fn FdRes(fd: fd_t) -> FdRes { FdRes { fd: fd } @@ -1028,7 +1029,10 @@ pub fn read_whole_file(file: &Path) -> Result<~[u8], ~str> { // fsync related pub mod fsync { + use io::{FILERes, FdRes, fd_t}; + use kinds::Copy; use libc; + use option::Option; use option; use os; @@ -1113,8 +1117,11 @@ pub fn obj_sync(o: FSyncable, opt_level: Option, #[cfg(test)] mod tests { + use debug; use i32; + use io::{BytesWriter, SeekCur, SeekEnd, SeekSet}; use io; + use path::Path; use result; use str; use u64; diff --git a/src/libcore/iter-trait.rs b/src/libcore/iter-trait.rs index 59eb9fbae8e..a139daddcef 100644 --- a/src/libcore/iter-trait.rs +++ b/src/libcore/iter-trait.rs @@ -16,7 +16,10 @@ #[forbid(deprecated_pattern)]; use cmp::{Eq, Ord}; +use iter::BaseIter; use iter; +use kinds::Copy; +use option::Option; use self::inst::{IMPL_T, EACH, SIZE_HINT}; diff --git a/src/libcore/iter-trait/dlist.rs b/src/libcore/iter-trait/dlist.rs index 42ed4b5f73c..eb395c57ae8 100644 --- a/src/libcore/iter-trait/dlist.rs +++ b/src/libcore/iter-trait/dlist.rs @@ -11,6 +11,7 @@ mod inst { use dlist; use managed; + use option::{Option, Some}; use option; #[allow(non_camel_case_types)] diff --git a/src/libcore/iter-trait/dvec.rs b/src/libcore/iter-trait/dvec.rs index f338578d143..28d1cf03d46 100644 --- a/src/libcore/iter-trait/dvec.rs +++ b/src/libcore/iter-trait/dvec.rs @@ -10,6 +10,7 @@ mod inst { use dvec; + use option::{Option, Some}; #[allow(non_camel_case_types)] pub type IMPL_T = dvec::DVec; diff --git a/src/libcore/iter-trait/option.rs b/src/libcore/iter-trait/option.rs index a3a18a5509a..2240db82f29 100644 --- a/src/libcore/iter-trait/option.rs +++ b/src/libcore/iter-trait/option.rs @@ -9,6 +9,8 @@ // except according to those terms. mod inst { + use option::{None, Option, Some}; + #[allow(non_camel_case_types)] pub type IMPL_T = Option; @@ -25,4 +27,4 @@ mod inst { Some(_) => Some(1) } } -} \ No newline at end of file +} diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index db82fa14950..1e56b0f14af 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -18,6 +18,8 @@ #[forbid(deprecated_pattern)]; use cmp::{Eq, Ord}; +use kinds::Copy; +use option::{None, Option, Some}; use vec; /// A function used to initialize the elements of a sequence diff --git a/src/libcore/libc.rs b/src/libcore/libc.rs index ae29bbe3085..8e468bab15d 100644 --- a/src/libcore/libc.rs +++ b/src/libcore/libc.rs @@ -164,7 +164,7 @@ pub use libc::funcs::posix88::unistd::{rmdir, unlink, write}; -mod types { +pub mod types { // Types tend to vary *per architecture* so we pull their definitions out // into this module. @@ -230,6 +230,8 @@ pub mod c99 { pub type uintptr_t = uint; } pub mod posix88 { + use prelude::*; + pub type off_t = i32; pub type dev_t = u64; pub type ino_t = u32; @@ -528,33 +530,6 @@ pub mod extra { pub mod os { pub mod common { pub mod posix01 { - pub type nlink_t = u16; - pub type blksize_t = i64; - pub type blkcnt_t = i32; - pub struct stat { - st_dev: dev_t, - st_mode: mode_t, - st_nlink: nlink_t, - st_ino: ino_t, - st_uid: uid_t, - st_gid: gid_t, - st_rdev: dev_t, - st_atime: time_t, - st_atime_nsec: c_long, - st_mtime: time_t, - st_mtime_nsec: c_long, - st_ctime: time_t, - st_ctime_nsec: c_long, - st_birthtime: time_t, - st_birthtime_nsec: c_long, - st_size: off_t, - st_blocks: blkcnt_t, - st_blksize: blksize_t, - st_flags: uint32_t, - st_gen: uint32_t, - st_lspare: int32_t, - st_qspare: [int64_t * 2], - } } } @@ -596,6 +571,34 @@ pub mod posix88 { pub type ssize_t = i32; } pub mod posix01 { + pub type nlink_t = u16; + pub type blksize_t = i64; + pub type blkcnt_t = i32; + + pub struct stat { + st_dev: dev_t, + st_mode: mode_t, + st_nlink: nlink_t, + st_ino: ino_t, + st_uid: uid_t, + st_gid: gid_t, + st_rdev: dev_t, + st_atime: time_t, + st_atime_nsec: c_long, + st_mtime: time_t, + st_mtime_nsec: c_long, + st_ctime: time_t, + st_ctime_nsec: c_long, + st_birthtime: time_t, + st_birthtime_nsec: c_long, + st_size: off_t, + st_blocks: blkcnt_t, + st_blksize: blksize_t, + st_flags: uint32_t, + st_gen: uint32_t, + st_lspare: int32_t, + st_qspare: [int64_t * 2], + } } pub mod posix08 { } @@ -643,6 +646,40 @@ pub mod posix88 { pub type ssize_t = i64; } pub mod posix01 { + use libc::types::common::c99::{int32_t, int64_t}; + use libc::types::common::c99::{uint32_t}; + use libc::types::os::arch::c95::{c_long, time_t}; + use libc::types::os::arch::posix88::{dev_t, gid_t, ino_t}; + use libc::types::os::arch::posix88::{mode_t, off_t, uid_t}; + + pub type nlink_t = u16; + pub type blksize_t = i64; + pub type blkcnt_t = i32; + + pub struct stat { + st_dev: dev_t, + st_mode: mode_t, + st_nlink: nlink_t, + st_ino: ino_t, + st_uid: uid_t, + st_gid: gid_t, + st_rdev: dev_t, + st_atime: time_t, + st_atime_nsec: c_long, + st_mtime: time_t, + st_mtime_nsec: c_long, + st_ctime: time_t, + st_ctime_nsec: c_long, + st_birthtime: time_t, + st_birthtime_nsec: c_long, + st_size: off_t, + st_blocks: blkcnt_t, + st_blksize: blksize_t, + st_flags: uint32_t, + st_gen: uint32_t, + st_lspare: int32_t, + st_qspare: [int64_t * 2], + } } pub mod posix08 { } @@ -934,6 +971,11 @@ pub mod funcs { // or anything. The same is not true of POSIX. pub mod c95 { + use libc::types::common::c95::{FILE, c_void, fpos_t}; + use libc::types::common::posix88::dirent_t; + use libc::types::os::arch::c95::{c_char, c_double, c_int, c_long}; + use libc::types::os::arch::c95::{c_uint, c_ulong, c_void, size_t}; + #[nolink] #[abi = "cdecl"] pub extern mod ctype { @@ -1174,6 +1216,14 @@ fn pipe(fds: *mut c_int, psize: c_uint, #[cfg(target_os = "macos")] #[cfg(target_os = "freebsd")] pub mod posix88 { + use libc::types::common::c95::{FILE, c_void}; + use libc::types::common::posix88::{DIR, dirent_t}; + use libc::types::os::arch::c95::{c_char, c_int, c_long, c_uint}; + use libc::types::os::arch::c95::{size_t}; + use libc::types::os::arch::posix01::stat; + use libc::types::os::arch::posix88::{gid_t, mode_t, off_t, pid_t}; + use libc::types::os::arch::posix88::{ssize_t, uid_t}; + #[nolink] #[abi = "cdecl"] pub extern mod stat_ { @@ -1282,6 +1332,10 @@ fn read(fd: c_int, buf: *mut c_void, #[cfg(target_os = "macos")] #[cfg(target_os = "freebsd")] pub mod posix01 { + use libc::types::os::arch::c95::{c_char, c_int, size_t}; + use libc::types::os::arch::posix01::stat; + use libc::types::os::arch::posix88::{pid_t, ssize_t}; + #[nolink] #[abi = "cdecl"] pub extern mod stat_ { @@ -1349,6 +1403,9 @@ pub mod posix08 { #[nolink] #[abi = "cdecl"] pub extern mod bsd44 { + use libc::types::common::c95::{c_void}; + use libc::types::os::arch::c95::{c_char, c_int, c_uint, size_t}; + fn sysctl(name: *c_int, namelen: c_uint, oldp: *mut c_void, oldlenp: *mut size_t, newp: *c_void, newlen: size_t) -> c_int; @@ -1371,6 +1428,8 @@ pub mod bsd44 { #[nolink] #[abi = "cdecl"] pub extern mod extra { + use libc::types::os::arch::c95::{c_char, c_int}; + fn _NSGetExecutablePath(buf: *mut c_char, bufsize: *mut u32) -> c_int; } diff --git a/src/libcore/managed.rs b/src/libcore/managed.rs index 5bbb5f6bec2..b334d246743 100644 --- a/src/libcore/managed.rs +++ b/src/libcore/managed.rs @@ -15,10 +15,12 @@ #[forbid(deprecated_pattern)]; use cmp::{Eq, Ord}; -use intrinsic::TyDesc; +use prelude::*; use ptr; pub mod raw { + use intrinsic::TyDesc; + pub struct BoxHeaderRepr { ref_count: uint, type_desc: *TyDesc, diff --git a/src/libcore/oldcomm.rs b/src/libcore/oldcomm.rs index 2ce2c323cbf..4425858bcff 100644 --- a/src/libcore/oldcomm.rs +++ b/src/libcore/oldcomm.rs @@ -52,11 +52,13 @@ use iter; use libc; use libc::size_t; +use prelude::*; use ptr; use result; use sys; use task; use vec; + // After snapshot, change p2::addr_of => addr_of /** diff --git a/src/libcore/option.rs b/src/libcore/option.rs index a46736055a0..49ba10dfffb 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -45,6 +45,7 @@ #[forbid(deprecated_pattern)]; use cmp::Eq; +use kinds::Copy; use option; use ptr; use str; diff --git a/src/libcore/os.rs b/src/libcore/os.rs index b42d6d363e3..587d684c60c 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -38,6 +38,7 @@ use libc::{mode_t, pid_t, FILE}; use option; use option::{Some, None}; +use prelude::*; use private; use ptr; use str; @@ -144,6 +145,7 @@ mod global_env { use either; use libc; use oldcomm; + use option::Option; use private; use str; use task; @@ -217,6 +219,7 @@ fn global_env_task(msg_po: oldcomm::Port) { mod impl_ { use cast; use libc; + use option::Option; use option; use ptr; use str; @@ -780,7 +783,7 @@ unsafe fn load_argc_and_argv(argc: c_int, argv: **c_char) -> ~[~str] { * Returns a list of the command line arguments. */ #[cfg(target_os = "macos")] -fn real_args() -> ~[~str] { +pub fn real_args() -> ~[~str] { unsafe { let (argc, argv) = (*_NSGetArgc() as c_int, *_NSGetArgv() as **c_char); @@ -790,7 +793,7 @@ fn real_args() -> ~[~str] { #[cfg(target_os = "linux")] #[cfg(target_os = "freebsd")] -fn real_args() -> ~[~str] { +pub fn real_args() -> ~[~str] { unsafe { let argc = rustrt::rust_get_argc(); let argv = rustrt::rust_get_argv(); @@ -799,7 +802,7 @@ fn real_args() -> ~[~str] { } #[cfg(windows)] -fn real_args() -> ~[~str] { +pub fn real_args() -> ~[~str] { let mut nArgs: c_int = 0; let lpArgCount = ptr::to_mut_unsafe_ptr(&mut nArgs); let lpCmdLine = GetCommandLineW(); @@ -873,7 +876,7 @@ pub fn set_args(new_args: ~[~str]) { pub fn _NSGetArgv() -> ***c_char; } -mod consts { +pub mod consts { #[cfg(unix)] use os::consts::unix::*; @@ -954,9 +957,15 @@ pub mod arm { #[cfg(test)] #[allow(non_implicitly_copyable_typarams)] mod tests { + use debug; + use libc::{c_int, c_void, size_t}; use libc; + use option::{None, Option, Some}; use option; + use os::{as_c_charp, env, getcwd, getenv, make_absolute, real_args}; + use os::{remove_file, setenv}; use os; + use path::Path; use rand; use run; use str; @@ -964,7 +973,7 @@ mod tests { #[test] pub fn last_os_error() { - log(debug, last_os_error()); + log(debug, os::last_os_error()); } #[test] diff --git a/src/libcore/path.rs b/src/libcore/path.rs index 115983e5fdb..d1d7d00bab8 100644 --- a/src/libcore/path.rs +++ b/src/libcore/path.rs @@ -20,8 +20,10 @@ use cmp::Eq; use libc; +use option::{None, Option, Some}; use ptr; use str; +use to_str::ToStr; #[deriving_eq] pub struct WindowsPath { @@ -751,6 +753,8 @@ impl WindowsPath : GenericPath { // Various windows helpers, and tests for the impl. pub mod windows { use libc; + use option::{None, Option, Some}; + use to_str::ToStr; #[inline(always)] pub pure fn is_sep(u: u8) -> bool { @@ -793,7 +797,8 @@ pub mod windows { #[cfg(test)] mod tests { - use path::windows; + use option::{None, Some}; + use path::{PosixPath, WindowsPath, windows}; use str; #[test] diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index a129a9f4c5a..260bc7e2476 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -90,11 +90,13 @@ use cmp::Eq; use cast::{forget, reinterpret_cast, transmute}; use either::{Either, Left, Right}; +use kinds::Owned; use libc; use option; use option::unwrap; use pipes; use ptr; +use prelude::*; use private; use task; use vec; @@ -1238,6 +1240,8 @@ pub fn try_send_one(chan: ChanOne, data: T) } pub mod rt { + use option::{None, Option, Some}; + // These are used to hide the option constructors from the // compiler because their names are changing pub fn make_some(val: T) -> Option { Some(move val) } @@ -1246,7 +1250,8 @@ pub fn make_none() -> Option { None } #[cfg(test)] pub mod test { - use pipes::oneshot; + use either::{Either, Left, Right}; + use pipes::{Chan, Port, oneshot, recv_one, stream}; use pipes; #[test] diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs new file mode 100644 index 00000000000..3d5139a2d32 --- /dev/null +++ b/src/libcore/prelude.rs @@ -0,0 +1,93 @@ +// This file is imported into every module by default. + +/* Reexported core operators */ + +pub use kinds::{Const, Copy, Owned, Durable}; +pub use ops::{Drop}; +pub use ops::{Add, Sub, Mul, Div, Modulo, Neg}; +pub use ops::{BitAnd, BitOr, BitXor}; +pub use ops::{Shl, Shr, Index}; +pub use option::{Option, Some, None}; +pub use result::{Result, Ok, Err}; + +/* Reexported types and traits */ + +pub use path::Path; +pub use path::GenericPath; +pub use path::WindowsPath; +pub use path::PosixPath; + +pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps}; +pub use str::{StrSlice, Trimmable}; +pub use vec::{ConstVector, CopyableVector, ImmutableVector}; +pub use vec::{ImmutableEqVector, ImmutableCopyableVector}; +pub use vec::{MutableVector, MutableCopyableVector}; +pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter}; +pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times}; + +pub use num::Num; +pub use ptr::Ptr; +pub use to_str::ToStr; +pub use clone::Clone; + +pub use cmp::{Eq, Ord}; +pub use hash::Hash; +pub use to_bytes::IterBytes; + +/* Reexported modules */ + +pub use at_vec; +pub use bool; +pub use cast; +pub use char; +pub use cmp; +pub use dvec; +pub use either; +pub use extfmt; +pub use f32; +pub use f64; +pub use float; +pub use i16; +pub use i32; +pub use i64; +pub use i8; +pub use int; +pub use io; +pub use iter; +pub use libc; +pub use num; +pub use oldcomm; +pub use ops; +pub use option; +pub use os; +pub use path; +pub use pipes; +pub use private; +pub use ptr; +pub use rand; +pub use result; +pub use str; +pub use sys; +pub use task; +pub use to_str; +pub use u16; +pub use u32; +pub use u64; +pub use u8; +pub use uint; +pub use vec; + +/* + * Export the log levels as global constants. Higher levels mean + * more-verbosity. Error is the bottom level, default logging level is + * warn-and-below. + */ + +/// The error log level +pub const error : u32 = 1_u32; +/// The warning log level +pub const warn : u32 = 2_u32; +/// The info log level +pub const info : u32 = 3_u32; +/// The debug log level +pub const debug : u32 = 4_u32; diff --git a/src/libcore/private.rs b/src/libcore/private.rs index efa5062ad98..273e933f530 100644 --- a/src/libcore/private.rs +++ b/src/libcore/private.rs @@ -21,6 +21,7 @@ use oldcomm; use option; use pipes; +use prelude::*; use ptr; use result; use task; @@ -580,8 +581,11 @@ pub fn unwrap_exclusive(arc: Exclusive) -> T { #[cfg(test)] pub mod tests { + use core::option::{None, Some}; + use option; use pipes; + use private::{exclusive, unwrap_exclusive}; use result; use task; use uint; diff --git a/src/libcore/rand.rs b/src/libcore/rand.rs index d816f23d4c0..cf114f0b5bc 100644 --- a/src/libcore/rand.rs +++ b/src/libcore/rand.rs @@ -15,6 +15,7 @@ #[forbid(deprecated_pattern)]; use int; +use prelude::*; use str; use task; use u32; @@ -362,7 +363,8 @@ pub fn random() -> uint { #[cfg(test)] pub mod tests { - use option::Option; + use debug; + use option::{None, Option, Some}; use rand; #[test] diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 9e9886e66ab..91f51908be8 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -19,6 +19,8 @@ use cmp::Eq; use either; use either::Either; +use kinds::Copy; +use option::{None, Option, Some}; use vec; /// The result type @@ -382,6 +384,7 @@ pub fn iter_vec2(ss: &[S], ts: &[T], mod tests { #[legacy_exports]; + use result::{Err, Ok, Result, chain, get, get_err}; use result; fn op1() -> result::Result { result::Ok(666) } diff --git a/src/libcore/run.rs b/src/libcore/run.rs index b753c647627..60fe54109d0 100644 --- a/src/libcore/run.rs +++ b/src/libcore/run.rs @@ -20,6 +20,7 @@ use oldcomm; use option::{Some, None}; use os; +use prelude::*; use ptr; use run; use str; @@ -349,7 +350,7 @@ pub fn program_output(prog: &str, args: &[~str]) -> return {status: status, out: move outs, err: move errs}; } -fn writeclose(fd: c_int, s: ~str) { +pub fn writeclose(fd: c_int, s: ~str) { use io::WriterUtil; error!("writeclose %d, %s", fd as int, s); @@ -359,7 +360,7 @@ fn writeclose(fd: c_int, s: ~str) { os::close(fd); } -fn readclose(fd: c_int) -> ~str { +pub fn readclose(fd: c_int) -> ~str { let file = os::fdopen(fd); let reader = io::FILE_reader(file, false); let buf = io::with_bytes_writer(|writer| { @@ -417,8 +418,11 @@ fn WEXITSTATUS(status: i32) -> i32 { #[cfg(test)] mod tests { + use debug; use io::WriterUtil; + use option::{None, Some}; use os; + use run::{readclose, writeclose}; use run; // Regression test for memory leaks diff --git a/src/libcore/send_map.rs b/src/libcore/send_map.rs index b6f237e14fb..4cd3502bd62 100644 --- a/src/libcore/send_map.rs +++ b/src/libcore/send_map.rs @@ -20,6 +20,7 @@ use cmp::Eq; use hash::Hash; +use prelude::*; use to_bytes::IterBytes; pub trait SendMap { @@ -45,9 +46,14 @@ pub trait SendMap { /// Open addressing with linear probing. pub mod linear { + use cmp::Eq; use cmp; + use hash::Hash; + use kinds::Copy; + use option::{None, Option, Some}; use option; use rand; + use to_bytes::IterBytes; use uint; use vec; @@ -458,6 +464,7 @@ impl LinearMap: cmp::Eq { #[test] pub mod test { + use option::{None, Some}; use send_map::linear::LinearMap; use send_map::linear; use uint; diff --git a/src/libcore/str.rs b/src/libcore/str.rs index a1595e4135e..722d62626a6 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -27,6 +27,7 @@ use libc; use libc::size_t; use io::WriterUtil; +use option::{None, Option, Some}; use ptr; use str; use to_str::ToStr; @@ -1949,6 +1950,7 @@ pub mod raw { use libc; use ptr; use str::raw; + use str::{as_buf, is_utf8, len, reserve_at_least}; use vec; /// Create a Rust string from a null-terminated *u8 buffer @@ -2129,6 +2131,9 @@ impl ~str: Trimmable { #[cfg(notest)] pub mod traits { + use ops::Add; + use str::append; + impl ~str : Add<&str,~str> { #[inline(always)] pure fn add(&self, rhs: & &self/str) -> ~str { @@ -2308,10 +2313,11 @@ impl &str: StrSlice { #[cfg(test)] mod tests { use char; + use debug; use libc::c_char; use libc; use ptr; - use str::raw; + use str::*; use vec; #[test] diff --git a/src/libcore/sys.rs b/src/libcore/sys.rs index d79fa3a86ff..4cefe2fea1c 100644 --- a/src/libcore/sys.rs +++ b/src/libcore/sys.rs @@ -146,6 +146,7 @@ pub struct Closure { #[cfg(test)] pub mod tests { use cast; + use sys::{Closure, pref_align_of, size_of}; #[test] pub fn size_of_basic() { diff --git a/src/libcore/task/local_data.rs b/src/libcore/task/local_data.rs index 0cfceb6358a..990d309a159 100644 --- a/src/libcore/task/local_data.rs +++ b/src/libcore/task/local_data.rs @@ -26,6 +26,7 @@ */ +use prelude::*; use rt; use task::local_data_priv::{local_get, local_pop, local_modify, local_set}; use task; diff --git a/src/libcore/task/local_data_priv.rs b/src/libcore/task/local_data_priv.rs index c6b3cfa6626..c08f0f9c997 100644 --- a/src/libcore/task/local_data_priv.rs +++ b/src/libcore/task/local_data_priv.rs @@ -11,9 +11,11 @@ #[doc(hidden)]; // FIXME #3538 use cast; +use cmp::Eq; use dvec; use libc; use option; +use prelude::*; use task::rt; use task::local_data::LocalDataKey; diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index 245b955c871..62d30bdc45c 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -48,6 +48,7 @@ use result::Result; use pipes::{stream, Chan, Port}; use pipes; +use prelude::*; use ptr; use result; use task::local_data_priv::{local_get, local_set}; diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index a904cbec3e5..1ffd7fee6b1 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -76,13 +76,19 @@ use cast; use oldcomm; use option; +use pipes::{Chan, Port}; use pipes; +use prelude::*; use private; use ptr; use send_map; -use task::rt; +use task::local_data_priv::{local_get, local_set}; use task::rt::rust_task; use task::rt::rust_closure; +use task::rt; +use task::{Failure, ManualThreads, PlatformThread, SchedOpts, SingleThreaded}; +use task::{Success, TaskOpts, TaskResult, ThreadPerCore, ThreadPerTask}; +use task::{default_task_opts, unkillable}; use uint; use util; diff --git a/src/libcore/to_bytes.rs b/src/libcore/to_bytes.rs index edd69219c3f..8f5ca4bc72a 100644 --- a/src/libcore/to_bytes.rs +++ b/src/libcore/to_bytes.rs @@ -20,6 +20,7 @@ use io; use io::Writer; +use option::{None, Option, Some}; use str; pub type Cb = fn(buf: &[const u8]) -> bool; @@ -181,6 +182,8 @@ pub impl uint: IterBytes { #[cfg(target_word_size = "64")] pub mod x64 { + use to_bytes::{Cb, IterBytes}; + pub impl uint: IterBytes { #[inline(always)] pure fn iter_bytes(&self, lsb0: bool, f: Cb) { diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs index 963901c2c75..fb4ea48ca95 100644 --- a/src/libcore/to_str.rs +++ b/src/libcore/to_str.rs @@ -18,6 +18,7 @@ #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; +use kinds::Copy; use str; use vec; diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs index c602c193170..6ac7a1a04a3 100644 --- a/src/libcore/tuple.rs +++ b/src/libcore/tuple.rs @@ -15,6 +15,7 @@ //! Operations on tuples use cmp::{Eq, Ord}; +use kinds::Copy; use vec; pub trait CopyableTuple { diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs index ec280568282..ad6f73e56c0 100644 --- a/src/libcore/uint-template.rs +++ b/src/libcore/uint-template.rs @@ -19,6 +19,7 @@ use from_str::FromStr; use iter; use num; +use option::{None, Option, Some}; use str; use uint; use vec; diff --git a/src/libcore/util.rs b/src/libcore/util.rs index 7dbc9f76f7a..423dbaedf26 100644 --- a/src/libcore/util.rs +++ b/src/libcore/util.rs @@ -19,6 +19,7 @@ #[forbid(deprecated_pattern)]; use cmp::Eq; +use prelude::*; /// The identity function. #[inline(always)] @@ -104,6 +105,10 @@ pub fn unreachable() -> ! { mod tests { #[legacy_exports]; + + use option::{None, Some}; + use util::{NonCopyable, id, replace, swap}; + #[test] fn identity_crisis() { // Writing a test for the identity function. How did it come to this? diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index a128b45c350..541dcde2181 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -16,10 +16,12 @@ use cast; use cmp::{Eq, Ord}; +use iter::BaseIter; use iter; +use kinds::Copy; use libc; use libc::size_t; -use option::{Some, None}; +use option::{None, Option, Some}; use ptr; use ptr::addr_of; use sys; @@ -673,7 +675,7 @@ pub fn dedup(v: &mut ~[T]) unsafe { } #[inline(always)] -pure fn append_mut(lhs: ~[mut T], rhs: &[const T]) -> ~[mut T] { +pub pure fn append_mut(lhs: ~[mut T], rhs: &[const T]) -> ~[mut T] { to_mut(append(from_mut(lhs), rhs)) } @@ -1517,6 +1519,10 @@ impl @[T] : Ord { #[cfg(notest)] pub mod traits { + use kinds::Copy; + use ops::Add; + use vec::{append, append_mut}; + impl ~[T] : Add<&[const T],~[T]> { #[inline(always)] pure fn add(&self, rhs: & &self/[const T]) -> ~[T] { @@ -1839,10 +1845,14 @@ pub struct UnboxedVecRepr { /// Unsafe operations pub mod raw { + use kinds::Copy; use managed; + use option::{None, Some}; use option; + use ptr::addr_of; use ptr; use sys; + use vec::{UnboxedVecRepr, as_const_buf, as_mut_buf, len, with_capacity}; use vec::rusti; /// The internal representation of a (boxed) vector @@ -1992,8 +2002,9 @@ pub unsafe fn memmove(dst: &[mut T], src: &[const T], count: uint) { pub mod bytes { use libc; use uint; - use vec; + use vec::len; use vec::raw; + use vec; /// Bytewise string comparison pub pure fn cmp(a: &~[u8], b: &~[u8]) -> int { @@ -2280,8 +2291,9 @@ impl @[A] : iter::CopyableNonstrictIter { #[cfg(test)] mod tests { + use option::{None, Option, Some}; use option; - use vec::raw; + use vec::*; fn square(n: uint) -> uint { return n * n; } diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index 59d9886455a..85268ad8f02 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use back::rpath; use driver::session; @@ -29,6 +30,7 @@ use core::hash; use core::io::{Writer, WriterUtil}; use core::libc::{c_int, c_uint, c_char}; +use core::os::consts::{macos, freebsd, linux, win32}; use core::os; use core::ptr; use core::run; @@ -41,9 +43,7 @@ use syntax::attr; use syntax::print::pprust; -use core::os::consts::{macos, freebsd, linux, win32}; - -enum output_type { +pub enum output_type { output_type_none, output_type_bitcode, output_type_assembly, @@ -59,7 +59,7 @@ impl output_type : cmp::Eq { pure fn ne(&self, other: &output_type) -> bool { !(*self).eq(other) } } -fn llvm_err(sess: Session, +msg: ~str) -> ! unsafe { +pub fn llvm_err(sess: Session, +msg: ~str) -> ! unsafe { let cstr = llvm::LLVMRustGetLastError(); if cstr == ptr::null() { sess.fatal(msg); @@ -68,7 +68,7 @@ fn llvm_err(sess: Session, +msg: ~str) -> ! unsafe { } } -fn WriteOutputFile(sess: Session, +pub fn WriteOutputFile(sess: Session, PM: lib::llvm::PassManagerRef, M: ModuleRef, Triple: *c_char, // FIXME: When #2334 is fixed, change @@ -86,10 +86,14 @@ fn WriteOutputFile(sess: Session, pub mod jit { #[legacy_exports]; + use back::link::llvm_err; 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; use core::ptr; use core::str; @@ -161,11 +165,19 @@ mod write { #[legacy_exports]; use back::link::jit; + use back::link::{ModuleRef, WriteOutputFile, output_type}; + 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; use lib::llvm::llvm; + use lib::llvm::{False, True, mk_pass_manager, mk_target_data}; use lib; + use session::Session; use core::char; + use core::libc::{c_char, c_int, c_uint}; + use core::path::Path; use core::str; use core::vec; diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs index c6b43ff6ad5..8378270bee4 100644 --- a/src/librustc/back/rpath.rs +++ b/src/librustc/back/rpath.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use driver::session; use metadata::cstore; @@ -20,7 +21,13 @@ use std::map::HashMap; use std::map; +export get_absolute_rpath; +export get_install_prefix_rpath; +export get_relative_to; export get_rpath_flags; +export get_rpath_relative_to_output; +export minimize_rpaths; +export rpaths_to_flags; pure fn not_win32(os: session::os) -> bool { match os { @@ -202,6 +209,11 @@ fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] { mod test { #[legacy_exports]; + use core::prelude::*; + + 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}; use driver::session; use core::os; diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index 3212adf29ac..cbc598228a4 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -9,6 +9,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use back::link; use back::{x86, x86_64}; @@ -830,7 +831,13 @@ fn list_metadata(sess: Session, path: &Path, out: io::Writer) { mod test { #[legacy_exports]; + use core::prelude::*; + + use driver::driver::{build_configuration, build_session}; + use driver::driver::{build_session_options, optgroups, str_input}; + use core::vec; + use std::getopts::groups::getopts; use std::getopts; use syntax::attr; use syntax::diagnostic; diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index d60ad7606fd..ee34570203b 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use back::link; use back::target_strs; @@ -333,6 +334,12 @@ fn sess_os_to_meta_os(os: os) -> metadata::loader::os { #[cfg(test)] mod test { #[legacy_exports]; + + use core::prelude::*; + + use driver::session::{bin_crate, building_library, lib_crate}; + use driver::session::{unknown_crate}; + use syntax::ast; use syntax::ast_util; diff --git a/src/librustc/front/config.rs b/src/librustc/front/config.rs index 7a073057f0d..b5622e1e575 100644 --- a/src/librustc/front/config.rs +++ b/src/librustc/front/config.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use syntax::{ast, fold, attr}; diff --git a/src/librustc/front/core_inject.rs b/src/librustc/front/core_inject.rs index 6df5e367ad1..9bd7566e2e7 100644 --- a/src/librustc/front/core_inject.rs +++ b/src/librustc/front/core_inject.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use driver::session::Session; @@ -75,10 +76,18 @@ fn spanned(x: T) -> ast::spanned { fold_mod: |module, fld| { let n2 = sess.next_node_id(); - let vp = @spanned( - ast::view_path_glob(ident_to_path(dummy_sp(), - sess.ident_of(~"core")), - n2)); + let prelude_path = @{ + span: dummy_sp(), + global: false, + idents: ~[ + sess.ident_of(~"core"), + sess.ident_of(~"prelude") + ], + rp: None, + types: ~[] + }; + + let vp = @spanned(ast::view_path_glob(prelude_path, n2)); let vi2 = @{node: ast::view_item_import(~[vp]), attrs: ~[], vis: ast::private, diff --git a/src/librustc/front/intrinsic_inject.rs b/src/librustc/front/intrinsic_inject.rs index 08b61557fdd..bad8ca88ad8 100644 --- a/src/librustc/front/intrinsic_inject.rs +++ b/src/librustc/front/intrinsic_inject.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use driver::session::Session; use syntax::parse; diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs index 09db770512f..1e2063649b0 100644 --- a/src/librustc/front/test.rs +++ b/src/librustc/front/test.rs @@ -10,6 +10,7 @@ // Code that generates a test runner to run all the tests in a crate +use core::prelude::*; use driver::session; use front::config; diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index 62956341189..d5c05584539 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use core::cast; use core::cmp; diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs index da33aaa460b..078b5ea9a4b 100644 --- a/src/librustc/metadata/creader.rs +++ b/src/librustc/metadata/creader.rs @@ -11,6 +11,8 @@ //! Validates all used crates and extern libraries and loads their metadata +use core::prelude::*; + use metadata::cstore; use metadata::common::*; use metadata::decoder; diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs index 2dfe5bad27a..2b1c66eb4bb 100644 --- a/src/librustc/metadata/csearch.rs +++ b/src/librustc/metadata/csearch.rs @@ -11,6 +11,8 @@ // Searching for information from the cstore +use core::prelude::*; + use metadata::common::*; use metadata::cstore; use metadata::decoder; diff --git a/src/librustc/metadata/cstore.rs b/src/librustc/metadata/cstore.rs index b09f2d87b6c..e9d6711d87b 100644 --- a/src/librustc/metadata/cstore.rs +++ b/src/librustc/metadata/cstore.rs @@ -12,6 +12,8 @@ // The crate store - a central repo for information collected about external // crates and libraries +use core::prelude::*; + use metadata::creader; use metadata::cstore; use metadata::decoder; diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index d4cebea66cd..dbc70f1318c 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -11,6 +11,8 @@ // Decoding metadata from a single crate's metadata +use core::prelude::*; + use cmd = metadata::cstore::crate_metadata; use dvec::DVec; use hash::{Hash, HashUtil}; diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 5a936e113ee..f52c2e448fe 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -11,6 +11,8 @@ // Metadata encoding +use core::prelude::*; + use metadata::common::*; use metadata::csearch; use metadata::cstore; diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs index 0401d8fcb6c..15c0a1944ea 100644 --- a/src/librustc/metadata/filesearch.rs +++ b/src/librustc/metadata/filesearch.rs @@ -13,6 +13,8 @@ // FIXME (#2658): I'm not happy how this module turned out. Should // probably just be folded into cstore. +use core::prelude::*; + use core::option; use core::os; use core::result::Result; diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index fa858f9e9a3..535f45ae839 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -11,6 +11,8 @@ //! Finds crate binaries and loads their metadata +use core::prelude::*; + use lib::llvm::{False, llvm, mk_object_file, mk_section_iter}; use metadata::decoder; use metadata::encoder; @@ -26,14 +28,13 @@ use core::flate; use core::io::WriterUtil; use core::io; +use core::os::consts::{macos, freebsd, linux, win32}; use core::option; use core::ptr; use core::str; use core::uint; use core::vec; -use core::os::consts::{macos, freebsd, linux, win32}; - export os; export os_macos, os_win32, os_linux, os_freebsd; export ctxt; diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 089e528c0c2..927ef29b04f 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -14,6 +14,8 @@ // tjc note: Would be great to have a `match check` macro equivalent // for some of these +use core::prelude::*; + use middle::ty; use middle::ty::{FnTyBase, FnMeta, FnSig}; diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs index 24095ebfe00..67f168cc5b6 100644 --- a/src/librustc/metadata/tyencode.rs +++ b/src/librustc/metadata/tyencode.rs @@ -11,6 +11,8 @@ // Type encoding +use core::prelude::*; + use middle::ty; use middle::ty::vid; diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index c97553ce1c0..c2f2d7711af 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use c = metadata::common; use cstore = metadata::cstore; diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs index 4370707e665..534098d96dc 100644 --- a/src/librustc/middle/borrowck/check_loans.rs +++ b/src/librustc/middle/borrowck/check_loans.rs @@ -15,18 +15,29 @@ // 1. assignments are always made to mutable locations; // 2. loans made in overlapping scopes do not conflict // 3. assignments do not affect things loaned out as immutable -// 4. moves to dnot affect things loaned out in any way +// 4. moves do not affect things loaned out in any way +use core::prelude::*; +use middle::borrowck::{Loan, bckerr, borrowck_ctxt, cmt, inherent_mutability}; +use middle::borrowck::{req_maps, save_and_restore}; +use middle::mem_categorization::{cat_arg, cat_binding, cat_deref, cat_local}; +use middle::mem_categorization::{cat_rvalue, cat_special}; +use middle::mem_categorization::{loan_path, lp_arg, lp_comp, lp_deref}; +use middle::mem_categorization::{lp_local}; use middle::ty::{CopyValue, MoveValue, ReadValue}; use middle::ty; +use util::ppaux::ty_to_str; use core::cmp; use core::dvec::DVec; use core::uint; use core::vec; +use std::map::HashMap; +use syntax::ast::{m_const, m_imm, m_mutbl}; use syntax::ast; use syntax::ast_util; +use syntax::codemap::span; use syntax::print::pprust; use syntax::visit; diff --git a/src/librustc/middle/borrowck/gather_loans.rs b/src/librustc/middle/borrowck/gather_loans.rs index d5652ae78d6..215256a8e95 100644 --- a/src/librustc/middle/borrowck/gather_loans.rs +++ b/src/librustc/middle/borrowck/gather_loans.rs @@ -16,17 +16,26 @@ // their associated scopes. In phase two, checking loans, we will then make // sure that all of these loans are honored. +use core::prelude::*; use middle::borrowck::preserve::{preserve_condition, pc_ok, pc_if_pure}; -use middle::mem_categorization::{mem_categorization_ctxt, opt_deref_kind}; +use middle::borrowck::{Loan, bckres, borrowck_ctxt, err_mutbl, req_maps}; +use middle::mem_categorization::{cat_binding, cat_discr, cmt, comp_variant}; +use middle::mem_categorization::{mem_categorization_ctxt}; +use middle::mem_categorization::{opt_deref_kind}; use middle::pat_util; use middle::ty::{ty_region}; use middle::ty; +use util::common::indenter; +use util::ppaux::{expr_repr, region_to_str}; use core::dvec; use core::send_map::linear::LinearMap; use core::vec; +use std::map::HashMap; +use syntax::ast::{m_const, m_imm, m_mutbl}; use syntax::ast; +use syntax::codemap::span; use syntax::print::pprust; use syntax::visit; diff --git a/src/librustc/middle/borrowck/loan.rs b/src/librustc/middle/borrowck/loan.rs index 6539cb0c6c3..92a3ce24589 100644 --- a/src/librustc/middle/borrowck/loan.rs +++ b/src/librustc/middle/borrowck/loan.rs @@ -12,10 +12,19 @@ // Loan(Ex, M, S) = Ls holds if ToAddr(Ex) will remain valid for the entirety // of the scope S, presuming that the returned set of loans `Ls` are honored. +use core::prelude::*; +use middle::borrowck::{Loan, bckres, borrowck_ctxt, cmt, err_mutbl}; +use middle::borrowck::{err_out_of_scope}; +use middle::mem_categorization::{cat_arg, cat_binding, cat_discr, cat_comp}; +use middle::mem_categorization::{cat_deref, cat_discr, cat_local}; +use middle::mem_categorization::{cat_special, cat_stack_upvar, comp_field}; +use middle::mem_categorization::{comp_index, comp_variant, region_ptr}; use middle::ty; +use util::common::indenter; -use core::result::{Result, Ok, Err}; +use core::result::{Err, Ok, Result}; +use syntax::ast::{m_const, m_imm, m_mutbl}; use syntax::ast; export public_methods; diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index fa7dfd1b77f..a6fbe5bd6dd 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -226,6 +226,8 @@ #[legacy_exports]; +use core::prelude::*; + use middle::liveness; use middle::mem_categorization::*; use middle::region; @@ -259,9 +261,6 @@ #[legacy_exports] pub mod preserve; -export check_crate, root_map, mutbl_map; -export check_loans, gather_loans, loan, preserve; - fn check_crate(tcx: ty::ctxt, method_map: typeck::method_map, last_use_map: liveness::last_use_map, @@ -410,7 +409,7 @@ impl bckerr : cmp::Eq { type bckres = Result; /// a complete record of a loan that was granted -struct Loan {lp: @loan_path, cmt: cmt, mutbl: ast::mutability} +pub struct Loan {lp: @loan_path, cmt: cmt, mutbl: ast::mutability} /// maps computed by `gather_loans` that are then used by `check_loans` /// @@ -418,7 +417,7 @@ struct Loan {lp: @loan_path, cmt: cmt, mutbl: ast::mutability} /// for the duration of that block/expr /// - `pure_map`: map from block/expr that must be pure to the error message /// that should be reported if they are not pure -type req_maps = { +pub type req_maps = { req_loan_map: HashMap>, pure_map: HashMap }; diff --git a/src/librustc/middle/borrowck/preserve.rs b/src/librustc/middle/borrowck/preserve.rs index e6d311fd04f..600ede8c720 100644 --- a/src/librustc/middle/borrowck/preserve.rs +++ b/src/librustc/middle/borrowck/preserve.rs @@ -13,9 +13,19 @@ // the scope S. // +use core::prelude::*; +use middle::borrowck::{bckerr, bckerr_code, bckres, borrowck_ctxt, cmt}; +use middle::borrowck::{err_mut_uniq, err_mut_variant, err_out_of_root_scope}; +use middle::borrowck::{err_out_of_scope, err_root_not_permitted}; +use middle::mem_categorization::{cat_arg, cat_binding, cat_comp, cat_deref}; +use middle::mem_categorization::{cat_discr, cat_local, cat_special}; +use middle::mem_categorization::{cat_stack_upvar, comp_field, comp_index}; +use middle::mem_categorization::{comp_variant, region_ptr}; use middle::ty; +use util::common::indenter; +use syntax::ast::{m_const, m_imm, m_mutbl}; use syntax::ast; export public_methods, preserve_condition, pc_ok, pc_if_pure; diff --git a/src/librustc/middle/capture.rs b/src/librustc/middle/capture.rs index 86d9151ae9b..bd8d1b64906 100644 --- a/src/librustc/middle/capture.rs +++ b/src/librustc/middle/capture.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use middle::freevars; use middle::ty; diff --git a/src/librustc/middle/check_const.rs b/src/librustc/middle/check_const.rs index 13df0b73db0..b8d222aecd7 100644 --- a/src/librustc/middle/check_const.rs +++ b/src/librustc/middle/check_const.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use driver::session::Session; use middle::resolve; diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index dc66df93624..c70d17423cf 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use middle::const_eval::{compare_const_vals, lookup_const_by_id}; use middle::const_eval::{eval_const_expr, const_val, const_int, const_bool}; diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index e2de186ca2f..5821bf4fbe5 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use middle::resolve; use middle::ty; diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs index 671a0a2dc81..f2a7dd0648c 100644 --- a/src/librustc/middle/kind.rs +++ b/src/librustc/middle/kind.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use middle::freevars::freevar_entry; use middle::freevars; diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 8c887139b70..cca71153a7d 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -20,6 +20,8 @@ // // * Functions called by the compiler itself. +use core::prelude::*; + use driver::session::Session; use metadata::csearch::{each_lang_item, get_item_attrs}; use metadata::cstore::{iter_crate_data}; diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 635e2d18d6c..d5992d201bb 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use driver::session::Session; use driver::session; diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 91e6ed289bd..6c78c270139 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -103,6 +103,8 @@ * to return explicitly. */ +use core::prelude::*; + use middle::capture::{cap_move, cap_drop, cap_copy, cap_ref}; use middle::capture; use middle::pat_util; diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 9b373ef0c16..b72950cbf4b 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -47,6 +47,8 @@ * then an index to jump forward to the relevant item. */ +use core::prelude::*; + use middle::ty; use middle::typeck; use util::ppaux::{ty_to_str, region_to_str}; @@ -136,7 +138,7 @@ impl categorization : cmp::Eq { } // different kinds of pointers: -enum ptr_kind { +pub enum ptr_kind { uniq_ptr, gc_ptr, region_ptr(ty::Region), @@ -177,7 +179,7 @@ impl ptr_kind : cmp::Eq { // I am coining the term "components" to mean "pieces of a data // structure accessible without a dereference": -enum comp_kind { +pub enum comp_kind { comp_tuple, // elt in a tuple comp_anon_field, // anonymous field (in e.g. // struct Foo(int, int); @@ -269,7 +271,7 @@ impl cmt_ : cmp::Eq { // a loan path is like a category, but it exists only when the data is // interior to the stack frame. loan paths are used as the key to a // map indicating what is borrowed at any point in time. -enum loan_path { +pub enum loan_path { lp_local(ast::node_id), lp_arg(ast::node_id), lp_deref(@loan_path, ptr_kind), diff --git a/src/librustc/middle/mode.rs b/src/librustc/middle/mode.rs index a736b3d2fa6..00be40cbf49 100644 --- a/src/librustc/middle/mode.rs +++ b/src/librustc/middle/mode.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use middle::pat_util; use middle::ty; diff --git a/src/librustc/middle/pat_util.rs b/src/librustc/middle/pat_util.rs index 54d3180dbe4..5a4d36f1d10 100644 --- a/src/librustc/middle/pat_util.rs +++ b/src/librustc/middle/pat_util.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use middle::resolve; use middle::ty::{CopyValue, MoveValue, ReadValue}; diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 1aa3017083c..56dee0843dd 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -12,6 +12,8 @@ // A pass that checks to make sure private fields and methods aren't used // outside their scopes. +use core::prelude::*; + use middle::ty::{ty_struct, ty_enum}; use middle::ty; use middle::typeck::{method_map, method_origin, method_param, method_self}; diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 6f9c3070a0e..21ccfd3b5f2 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -17,6 +17,7 @@ */ +use core::prelude::*; use driver::session::Session; use metadata::csearch; diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 625ed9076e7..4e5e9b97957 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use driver::session::Session; use metadata::csearch::{each_path, get_method_names_if_trait}; @@ -3075,77 +3076,6 @@ fn resolve_module_prefix(module_: @Module, self.module_to_str(containing_module)); return Success(PrefixFound(containing_module, i)); - - /* - // If we reached the end, return the containing module. - if i == module_path.len() { - return ModulePrefixResult { - result: Success(containing_module), - prefix_len: i - }; - } - - // Is the containing module the current module? If so, we allow - // globs to be unresolved. - let allow_globs = core::managed::ptr_eq(containing_module, module_); - - let name = module_path.get_elt(i); - i += 1; - - let resolve_result = self.resolve_name_in_module(containing_module, - name, - TypeNS, - Xray, - allow_globs); - match resolve_result { - Success(target) => { - match target.bindings.type_def { - Some(ref type_def) => { - match (*type_def).module_def { - None => { - error!("!!! (resolving crate-relative \ - module) module wasn't actually a \ - module!"); - return ModulePrefixResult { - result: Failed, - prefix_len: i - }; - } - Some(module_def) => { - return ModulePrefixResult { - result: Success(module_def), - prefix_len: i - }; - } - } - } - None => { - error!("!!! (resolving crate-relative module) module - wasn't actually a module!"); - return ModulePrefixResult { - result: Failed, - prefix_len: i - }; - } - } - } - Indeterminate => { - debug!("(resolving crate-relative module) indeterminate; \ - bailing"); - return ModulePrefixResult { - result: Indeterminate, - prefix_len: i - }; - } - Failed => { - debug!("(resolving crate-relative module) failed to resolve"); - return ModulePrefixResult { - result: Failed, - prefix_len: i - }; - } - } - */ } fn name_is_exported(module_: @Module, name: ident) -> bool { @@ -3165,7 +3095,6 @@ fn resolve_name_in_module(module_: @Module, xray: XrayFlag, allow_globs: bool) -> ResolveResult { - debug!("(resolving name in module) resolving `%s` in `%s`", self.session.str_of(name), self.module_to_str(module_)); @@ -4818,7 +4747,7 @@ fn resolve_identifier(identifier: ident, } return self.resolve_item_by_identifier_in_lexical_scope(identifier, - namespace); + namespace); } // XXX: Merge me with resolve_name_in_module? @@ -5035,7 +4964,7 @@ fn resolve_item_by_identifier_in_lexical_scope(ident: ident, match self.resolve_item_in_lexical_scope(self.current_module, ident, namespace, - SearchThroughModules) { + DontSearchThroughModules) { Success(target) => { match (*target.bindings).def_for_namespace(namespace) { None => { diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 97331021560..2b07ed1fc2d 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -142,6 +142,7 @@ * */ +use core::prelude::*; use back::abi; use lib::llvm::llvm; diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 317d0fbfd03..78c70dd3cf1 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -23,6 +23,7 @@ // but many TypeRefs correspond to one ty::t; for instance, tup(int, int, // int) and rec(x=int, y=int, z=int) will have the same TypeRef. +use core::prelude::*; use back::link::{mangle_exported_name}; use back::link::{mangle_internal_name_by_path_and_seq}; diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs index 88f908c4c26..8f02cee5b2a 100644 --- a/src/librustc/middle/trans/callee.rs +++ b/src/librustc/middle/trans/callee.rs @@ -16,6 +16,7 @@ // and methods are represented as just a fn ptr and not a full // closure. +use core::prelude::*; use lib::llvm::ValueRef; use middle::trans::base::{get_item_val, trans_external_path}; diff --git a/src/librustc/middle/trans/closure.rs b/src/librustc/middle/trans/closure.rs index 6a0c2aceda3..63287055685 100644 --- a/src/librustc/middle/trans/closure.rs +++ b/src/librustc/middle/trans/closure.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use back::abi; use back::link::{mangle_internal_name_by_path_and_seq}; diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index ee2028200e4..3bec973fc90 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -14,6 +14,8 @@ */ +use core::prelude::*; + use back::{link, abi, upcall}; use driver::session; use driver::session::Session; diff --git a/src/librustc/middle/trans/consts.rs b/src/librustc/middle/trans/consts.rs index 0d698b2871d..0f57ca09386 100644 --- a/src/librustc/middle/trans/consts.rs +++ b/src/librustc/middle/trans/consts.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use middle::const_eval; use middle::trans::base::get_insn_ctxt; diff --git a/src/librustc/middle/trans/controlflow.rs b/src/librustc/middle/trans/controlflow.rs index 7ae3fbcd1b8..c1abe7e417b 100644 --- a/src/librustc/middle/trans/controlflow.rs +++ b/src/librustc/middle/trans/controlflow.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use lib::llvm::ValueRef; use middle::trans::base::*; diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs index 5c13364ddeb..b94d0658597 100644 --- a/src/librustc/middle/trans/datum.rs +++ b/src/librustc/middle/trans/datum.rs @@ -95,6 +95,7 @@ * methods themselves. Most are only suitable for some types of * values. */ +use core::prelude::*; use lib::llvm::ValueRef; use middle::trans::base::*; diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 10edfb2f929..ce8db8690ac 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use driver::session; use lib::llvm::ValueRef; diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index ed9abea465b..40face3655d 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -111,6 +111,7 @@ */ +use core::prelude::*; use lib::llvm::ValueRef; use middle::resolve; diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs index 85aed8d5387..658cffa936b 100644 --- a/src/librustc/middle/trans/foreign.rs +++ b/src/librustc/middle/trans/foreign.rs @@ -11,6 +11,7 @@ // The classification code for the x86_64 ABI is taken from the clay language // https://github.com/jckarter/clay/blob/master/compiler/src/externals.cpp +use core::prelude::*; use back::{link, abi}; use driver::session::arch_x86_64; diff --git a/src/librustc/middle/trans/glue.rs b/src/librustc/middle/trans/glue.rs index 2ea3873ebcd..70049fb3e4e 100644 --- a/src/librustc/middle/trans/glue.rs +++ b/src/librustc/middle/trans/glue.rs @@ -12,6 +12,7 @@ // // Code relating to taking, dropping, etc as well as type descriptors. +use core::prelude::*; use lib::llvm::{ValueRef, TypeRef}; use middle::trans::base::*; diff --git a/src/librustc/middle/trans/inline.rs b/src/librustc/middle/trans/inline.rs index 28955f49844..447b4455adf 100644 --- a/src/librustc/middle/trans/inline.rs +++ b/src/librustc/middle/trans/inline.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use middle::astencode; use middle::trans::base::{get_insn_ctxt}; diff --git a/src/librustc/middle/trans/meth.rs b/src/librustc/middle/trans/meth.rs index 070a3b667bd..9631fd8b389 100644 --- a/src/librustc/middle/trans/meth.rs +++ b/src/librustc/middle/trans/meth.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use back::{link, abi}; use driver; use lib::llvm::llvm::LLVMGetParam; diff --git a/src/librustc/middle/trans/monomorphize.rs b/src/librustc/middle/trans/monomorphize.rs index ccbced417e2..60ad1b83807 100644 --- a/src/librustc/middle/trans/monomorphize.rs +++ b/src/librustc/middle/trans/monomorphize.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use back::link::mangle_exported_name; use middle::trans::base::{get_insn_ctxt}; diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 2880e4b770e..b894b9f50eb 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -10,6 +10,8 @@ #[warn(deprecated_pattern)]; +use core::prelude::*; + use driver::session; use metadata::csearch; use metadata; diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index b290f6c1742..043ff3fbec4 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -52,18 +52,24 @@ * an rptr (`&r.T`) use the region `r` that appears in the rptr. */ +use core::prelude::*; -use middle::ty::{FnTyBase, FnMeta, FnSig}; +use middle::pat_util::pat_id_map; +use middle::ty::{FnTyBase, FnMeta, FnSig, ty_param_substs_and_ty}; use middle::ty; use middle::typeck::check::fn_ctxt; use middle::typeck::collect; use middle::typeck::rscope::{anon_rscope, binding_rscope, empty_rscope}; use middle::typeck::rscope::{in_anon_rscope, in_binding_rscope}; use middle::typeck::rscope::{region_scope, type_rscope}; +use middle::typeck::{crate_ctxt, write_substs_to_tcx, write_ty_to_tcx}; use core::result; use core::vec; use syntax::ast; +use syntax::codemap::span; +use syntax::print::pprust::path_to_str; +use util::common::indent; pub trait ast_conv { fn tcx() -> ty::ctxt; diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs index 7ff3dfcb073..5514d2f04b3 100644 --- a/src/librustc/middle/typeck/check/_match.rs +++ b/src/librustc/middle/typeck/check/_match.rs @@ -8,17 +8,23 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; -use middle::pat_util::{pat_is_binding, pat_is_const}; +use middle::pat_util::{PatIdMap, pat_id_map, pat_is_binding, pat_is_const}; use middle::pat_util::{pat_is_variant_or_struct}; use middle::ty; use middle::typeck::check::demand; +use middle::typeck::check::{check_block, check_expr_with, fn_ctxt}; +use middle::typeck::check::{instantiate_path, lookup_def, lookup_local}; +use middle::typeck::check::{structure_of, valid_range_bounds}; +use middle::typeck::require_same_types; use core::vec; use std::map::HashMap; use syntax::ast; use syntax::ast_util::walk_pat; use syntax::ast_util; +use syntax::codemap::span; use syntax::print::pprust; fn check_match(fcx: @fn_ctxt, diff --git a/src/librustc/middle/typeck/check/demand.rs b/src/librustc/middle/typeck/check/demand.rs index 954608540f5..e4b232500bb 100644 --- a/src/librustc/middle/typeck/check/demand.rs +++ b/src/librustc/middle/typeck/check/demand.rs @@ -13,8 +13,10 @@ use middle::typeck::check::fn_ctxt; use middle::typeck::infer; +use core::result::{Err, Ok}; use core::result; use syntax::ast; +use syntax::codemap::span; // Requires that the two types unify, and prints an error message if they // don't. diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index f903270e15c..a8c1b0aaa90 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -79,20 +79,29 @@ trait `ToStr` imported, and I call `to_str()` on a value of type `T`, */ +use core::prelude::*; use middle::resolve::{Impl, MethodInfo}; use middle::resolve; use middle::ty::*; use middle::ty; -use middle::typeck::check; +use middle::typeck::check::{fn_ctxt, impl_self_ty}; +use middle::typeck::check::{structurally_resolved_type}; +use middle::typeck::check::vtable::VtableContext; use middle::typeck::check::vtable; +use middle::typeck::check; use middle::typeck::coherence::get_base_type_def_id; use middle::typeck::infer; +use middle::typeck::{method_map_entry, method_origin, method_param}; +use middle::typeck::{method_self, method_static, method_trait}; +use util::common::indenter; +use util::ppaux::expr_repr; use core::dvec::DVec; use core::result; use core::uint; use core::vec; +use std::map::HashMap; use syntax::ast::{def_id, sty_by_ref, sty_value, sty_region, sty_box}; use syntax::ast::{sty_uniq, sty_static, node_id, by_copy, by_ref}; use syntax::ast::{m_const, m_mutbl, m_imm}; @@ -100,6 +109,7 @@ trait `ToStr` imported, and I call `to_str()` on a value of type `T`, use syntax::ast_map; use syntax::ast_map::node_id_to_str; use syntax::ast_util::dummy_sp; +use syntax::codemap::span; fn lookup( fcx: @fn_ctxt, diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index bd8b6934e0d..d0abd61697d 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -76,11 +76,14 @@ */ +use core::prelude::*; use middle::capture; use middle::const_eval; +use middle::pat_util::pat_id_map; use middle::pat_util; -use middle::ty::{TyVid, vid, FnTyBase, FnMeta, FnSig, VariantInfo_}; +use middle::ty::{TyVid, vid, FnTyBase, FnMeta, FnSig, VariantInfo_, field}; +use middle::ty::{ty_param_bounds_and_ty, ty_param_substs_and_ty}; use middle::ty; use middle::typeck::astconv::{ast_conv, ast_path_to_ty}; use middle::typeck::astconv::{ast_region_to_region, ast_ty_to_ty}; @@ -89,12 +92,18 @@ use middle::typeck::check::method::TransformTypeNormally; use middle::typeck::check::regionmanip::replace_bound_regions_in_fn_ty; use middle::typeck::check::vtable::{LocationInfo, VtableContext}; +use middle::typeck::crate_ctxt; use middle::typeck::infer::{resolve_type, force_tvar}; use middle::typeck::infer; use middle::typeck::rscope::{anon_rscope, binding_rscope, bound_self_region}; use middle::typeck::rscope::{empty_rscope, in_anon_rscope}; use middle::typeck::rscope::{in_binding_rscope, region_scope, type_rscope}; use middle::typeck::rscope; +use middle::typeck::{isr_alist, lookup_def_ccx, method_map_entry}; +use middle::typeck::{method_origin, method_self, method_trait, no_params}; +use middle::typeck::{require_same_types}; +use util::common::{block_query, indenter, loop_query}; +use util::ppaux::{bound_region_to_str, expr_repr}; use util::ppaux; use core::either; @@ -104,15 +113,19 @@ use core::result; use core::str; use core::vec; +use std::list::Nil; use std::map::HashMap; use std::map; -use syntax::ast::ty_i; +use syntax::ast::{provided, required, spanned, ty_i}; use syntax::ast; use syntax::ast_map; -use syntax::ast_util::{is_local, visibility_to_privacy, Private, Public}; +use syntax::ast_util::{Private, Public, is_local, local_def, respan}; +use syntax::ast_util::{visibility_to_privacy}; use syntax::ast_util; +use syntax::codemap::span; use syntax::codemap; use syntax::parse::token::special_idents; +use syntax::print::pprust::{expr_to_str, pat_to_str}; use syntax::print::pprust; use syntax::visit; use syntax; @@ -131,6 +144,15 @@ export DontDerefArgs; export DoDerefArgs; export check_item_types; +export check_block; +export check_expr_with; +export fn_ctxt; +export lookup_def; +export structure_of; +export self_info; +export structurally_resolved_type; +export instantiate_path; +export valid_range_bounds; #[legacy_exports] pub mod _match; diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs index c74b5789075..029a61c8ca6 100644 --- a/src/librustc/middle/typeck/check/regionck.rs +++ b/src/librustc/middle/typeck/check/regionck.rs @@ -27,6 +27,7 @@ */ +use core::prelude::*; use middle::freevars::get_freevars; use middle::pat_util::pat_bindings; @@ -34,13 +35,17 @@ use middle::ty::{ty_fn_proto, vstore_box, vstore_fixed, vstore_slice}; use middle::ty::{vstore_uniq}; use middle::ty; -use middle::typeck::infer::{resolve_and_force_all_but_regions, fres}; +use middle::typeck::check::fn_ctxt; +use middle::typeck::check::lookup_def; +use middle::typeck::infer::{fres, resolve_and_force_all_but_regions}; +use middle::typeck::infer::{resolve_type}; use util::ppaux::{note_and_explain_region, ty_to_str}; use core::result; use syntax::ast::{ProtoBare, ProtoBox, ProtoUniq, ProtoBorrowed}; use syntax::ast::{def_arg, def_binding, def_local, def_self, def_upvar}; use syntax::ast; +use syntax::codemap::span; use syntax::print::pprust; use syntax::visit; diff --git a/src/librustc/middle/typeck/check/regionmanip.rs b/src/librustc/middle/typeck/check/regionmanip.rs index c7000bb7e70..1de37f79f08 100644 --- a/src/librustc/middle/typeck/check/regionmanip.rs +++ b/src/librustc/middle/typeck/check/regionmanip.rs @@ -10,9 +10,16 @@ // #[warn(deprecated_mode)]; +use core::prelude::*; + use middle::ty; +use middle::typeck::check::self_info; +use middle::typeck::isr_alist; +use util::common::indenter; +use util::ppaux::region_to_str; use util::ppaux; +use std::list::Cons; use syntax::ast; use syntax::print::pprust::{expr_to_str}; diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs index 0872b1445c3..593d32c644e 100644 --- a/src/librustc/middle/typeck/check/vtable.rs +++ b/src/librustc/middle/typeck/check/vtable.rs @@ -8,23 +8,30 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use middle::resolve; use middle::ty; use middle::typeck::check::{fn_ctxt, impl_self_ty}; +use middle::typeck::check::{structurally_resolved_type}; use middle::typeck::infer::{fixup_err_to_str, infer_ctxt}; use middle::typeck::infer::{resolve_and_force_all_but_regions, resolve_type}; use middle::typeck::infer; +use middle::typeck::{crate_ctxt, vtable_origin, vtable_param, vtable_res}; +use middle::typeck::{vtable_static, vtable_trait}; use util::common::indenter; +use util::ppaux::tys_to_str; use util::ppaux; use core::result; use core::uint; use core::vec; use result::{Result, Ok, Err}; +use std::map::HashMap; use syntax::ast; use syntax::ast_util; use syntax::codemap::span; +use syntax::print::pprust::expr_to_str; use syntax::print::pprust; use syntax::visit; diff --git a/src/librustc/middle/typeck/check/writeback.rs b/src/librustc/middle/typeck/check/writeback.rs index 623c280ac22..a00fe073c54 100644 --- a/src/librustc/middle/typeck/check/writeback.rs +++ b/src/librustc/middle/typeck/check/writeback.rs @@ -12,18 +12,24 @@ // unresolved type variables and replaces "ty_var" types with their // substitutions. +use core::prelude::*; use middle::pat_util; use middle::ty; -use middle::typeck::check::{fn_ctxt, lookup_local}; +use middle::typeck::check::{fn_ctxt, lookup_local, self_info}; use middle::typeck::infer::{force_all, resolve_all, resolve_region}; use middle::typeck::infer::{resolve_type}; use middle::typeck::infer; +use middle::typeck::{vtable_param, vtable_trait, write_substs_to_tcx}; +use middle::typeck::{write_ty_to_tcx}; use util::ppaux; use core::result::{Result, Ok, Err}; use core::vec; +use std::map::HashMap; use syntax::ast; +use syntax::codemap::span; +use syntax::print::pprust::pat_to_str; use syntax::visit; export resolve_type_vars_in_fn; diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs index 0116214b5f9..d25c91dfe47 100644 --- a/src/librustc/middle/typeck/coherence.rs +++ b/src/librustc/middle/typeck/coherence.rs @@ -14,6 +14,7 @@ // has at most one implementation for each type. Then we build a mapping from // each trait in the system to its implementations. +use core::prelude::*; use driver; use metadata::csearch::{ProvidedTraitMethodInfo, each_path, get_impl_traits}; @@ -25,12 +26,14 @@ use middle::ty::{ProvidedMethodSource, ProvidedMethodInfo, bound_copy, get}; use middle::ty::{kind_can_be_copied, lookup_item_type, param_bounds, subst}; use middle::ty::{t, ty_bool, ty_bot, ty_box, ty_enum, ty_err, ty_estr}; -use middle::ty::{ty_evec, ty_float, ty_fn, ty_infer, ty_int, ty_nil, ty_ptr}; -use middle::ty::{ty_rec, ty_rptr, ty_struct, ty_trait, ty_tup, ty_uint}; -use middle::ty::{ty_param, ty_self, ty_type, ty_opaque_box, ty_uniq}; +use middle::ty::{ty_evec, ty_float, ty_fn, ty_infer, ty_int, ty_nil}; +use middle::ty::{ty_opaque_box, ty_param, ty_param_bounds_and_ty, ty_ptr}; +use middle::ty::{ty_rec, ty_rptr, ty_self, ty_struct, ty_trait, ty_tup}; +use middle::ty::{ty_type, ty_uint, ty_uniq}; use middle::ty::{ty_opaque_closure_ptr, ty_unboxed_vec, type_kind_ext}; use middle::ty::{type_is_ty_var}; use middle::ty; +use middle::typeck::crate_ctxt; use middle::typeck::infer::{infer_ctxt, can_mk_subty}; use middle::typeck::infer::{new_infer_ctxt, resolve_ivar}; use middle::typeck::infer::{resolve_nested_tvar, resolve_type}; @@ -42,7 +45,7 @@ use syntax::ast; use syntax::ast_map::node_item; use syntax::ast_map; -use syntax::ast_util::{def_id_of_def, dummy_sp}; +use syntax::ast_util::{def_id_of_def, dummy_sp, local_def}; use syntax::attr; use syntax::codemap::span; use syntax::parse; diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index e8d424b899f..11a932db287 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -30,8 +30,11 @@ */ +use core::prelude::*; + use metadata::csearch; use middle::ty::{FnMeta, FnSig, FnTyBase, InstantiatedTraitRef}; +use middle::ty::{ty_param_substs_and_ty}; use middle::ty; use middle::typeck::astconv::{ast_conv, ty_of_fn_decl, ty_of_arg}; use middle::typeck::astconv::{ast_ty_to_ty}; @@ -39,7 +42,8 @@ use middle::typeck::infer; use middle::typeck::rscope::*; use middle::typeck::rscope; -use util::common::pluralize; +use middle::typeck::{crate_ctxt, lookup_def_tcx, no_params, write_ty_to_tcx}; +use util::common::{indenter, pluralize}; use util::ppaux; use util::ppaux::bound_to_str; @@ -48,9 +52,12 @@ use core::vec; use syntax::ast; use syntax::ast_map; -use syntax::ast_util::trait_method_to_ty_method; +use syntax::ast_util::{local_def, split_trait_methods}; +use syntax::ast_util::{trait_method_to_ty_method}; use syntax::ast_util; +use syntax::codemap::span; use syntax::codemap; +use syntax::print::pprust::path_to_str; use syntax::visit; fn collect_item_types(ccx: @crate_ctxt, crate: @ast::crate) { diff --git a/src/librustc/middle/typeck/infer/assignment.rs b/src/librustc/middle/typeck/infer/assignment.rs index 8eb3e0336df..8e524bb8019 100644 --- a/src/librustc/middle/typeck/infer/assignment.rs +++ b/src/librustc/middle/typeck/infer/assignment.rs @@ -58,12 +58,18 @@ // A. But this upper-bound might be stricter than what is truly // needed. +use core::prelude::*; +use middle::ty::TyVar; use middle::ty; +use middle::typeck::infer::{ares, cres}; use middle::typeck::infer::combine::combine_fields; +use middle::typeck::infer::sub::Sub; use middle::typeck::infer::to_str::ToStr; +use util::common::{indent, indenter}; use core::option; +use syntax::ast::{m_const, m_imm, m_mutbl}; use syntax::ast; fn to_ares(+c: cres) -> ares { diff --git a/src/librustc/middle/typeck/infer/combine.rs b/src/librustc/middle/typeck/infer/combine.rs index f790939f4e7..d0b17d2ddc3 100644 --- a/src/librustc/middle/typeck/infer/combine.rs +++ b/src/librustc/middle/typeck/infer/combine.rs @@ -54,14 +54,22 @@ // terms of error reporting, although we do not do that properly right // now. +use core::prelude::*; + +use middle::ty::{FloatVar, FnTyBase, FnMeta, FnSig, IntVar, TyVar}; use middle::ty; -use middle::ty::{FnTyBase, FnMeta, FnSig}; +use middle::typeck::infer::glb::Glb; +use middle::typeck::infer::lub::Lub; use middle::typeck::infer::sub::Sub; use middle::typeck::infer::to_str::ToStr; +use middle::typeck::infer::{cres, infer_ctxt, ures}; +use util::common::indent; +use core::result::{iter_vec2, map_vec2}; use core::vec; -use syntax::ast::Onceness; +use syntax::ast::{Onceness, purity, ret_style}; use syntax::ast; +use syntax::codemap::span; fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export. diff --git a/src/librustc/middle/typeck/infer/floating.rs b/src/librustc/middle/typeck/infer/floating.rs index 85a11a598e9..68adeeb82db 100644 --- a/src/librustc/middle/typeck/infer/floating.rs +++ b/src/librustc/middle/typeck/infer/floating.rs @@ -14,9 +14,10 @@ */ +use core::prelude::*; +use middle::ty::{get, ty_float}; use middle::ty; -use middle::ty::ty_float; use middle::typeck::infer::to_str::ToStr; use core::uint; diff --git a/src/librustc/middle/typeck/infer/glb.rs b/src/librustc/middle/typeck/infer/glb.rs index 920b058770a..62be4488796 100644 --- a/src/librustc/middle/typeck/infer/glb.rs +++ b/src/librustc/middle/typeck/infer/glb.rs @@ -8,17 +8,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use middle::ty; use middle::typeck::infer::combine::*; use middle::typeck::infer::lattice::*; +use middle::typeck::infer::glb::Glb; +use middle::typeck::infer::lub::Lub; use middle::typeck::infer::sub::Sub; use middle::typeck::infer::to_str::ToStr; +use syntax::ast::{Many, Once, extern_fn, impure_fn, m_const, m_imm, m_mutbl}; +use syntax::ast::{noreturn, pure_fn, ret_style, return_val, unsafe_fn}; +use util::ppaux::mt_to_str; use std::list; -use syntax::ast::{Many, Once}; - enum Glb = combine_fields; // "greatest lower bound" (common subtype) impl Glb: combine { diff --git a/src/librustc/middle/typeck/infer/integral.rs b/src/librustc/middle/typeck/infer/integral.rs index e6701182342..aa67c1371f9 100644 --- a/src/librustc/middle/typeck/infer/integral.rs +++ b/src/librustc/middle/typeck/infer/integral.rs @@ -14,6 +14,9 @@ */ +use core::prelude::*; + +use middle::ty::{get, ty_int, ty_uint}; use middle::ty; use middle::typeck::infer::to_str::ToStr; diff --git a/src/librustc/middle/typeck/infer/lattice.rs b/src/librustc/middle/typeck/infer/lattice.rs index ea994c238c6..47343f8b48b 100644 --- a/src/librustc/middle/typeck/infer/lattice.rs +++ b/src/librustc/middle/typeck/infer/lattice.rs @@ -8,9 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; +use middle::ty::TyVar; use middle::ty; +use middle::typeck::infer::*; use middle::typeck::infer::combine::*; +use middle::typeck::infer::glb::Glb; +use middle::typeck::infer::lub::Lub; use middle::typeck::infer::unify::*; use middle::typeck::infer::to_str::ToStr; diff --git a/src/librustc/middle/typeck/infer/lub.rs b/src/librustc/middle/typeck/infer/lub.rs index 10ac6a3add9..d478e8d9b92 100644 --- a/src/librustc/middle/typeck/infer/lub.rs +++ b/src/librustc/middle/typeck/infer/lub.rs @@ -8,15 +8,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; +use middle::ty::RegionVid; use middle::ty; use middle::typeck::infer::combine::*; +use middle::typeck::infer::glb::Glb; use middle::typeck::infer::lattice::*; use middle::typeck::infer::sub::Sub; use middle::typeck::infer::to_str::ToStr; +use middle::typeck::isr_alist; +use util::ppaux::mt_to_str; use std::list; -use syntax::ast::{Many, Once}; +use syntax::ast::{Many, Once, extern_fn, m_const, impure_fn, noreturn}; +use syntax::ast::{pure_fn, ret_style, return_val, unsafe_fn}; fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export. diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs index 7d6a2c4366e..51e0a5186e8 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -259,6 +259,8 @@ fn bar() { #[warn(deprecated_mode)]; #[warn(deprecated_pattern)]; +use core::prelude::*; + use middle::ty::{TyVid, IntVid, FloatVid, RegionVid, vid}; use middle::ty::{mk_fn, type_is_bot}; use middle::ty::{ty_int, ty_uint, get, terr_fn, TyVar, IntVar, FloatVar}; @@ -280,21 +282,25 @@ fn bar() { use middle::typeck::infer::sub::Sub; use middle::typeck::infer::to_str::ToStr; use middle::typeck::infer::unify::{vals_and_bindings, root}; +use middle::typeck::isr_alist; use util::common::{indent, indenter}; -use util::ppaux::{ty_to_str, mt_to_str}; +use util::ppaux::{bound_region_to_str, ty_to_str, mt_to_str}; use core::cmp::Eq; use core::dvec::DVec; use core::result::{Result, Ok, Err, map_vec, map_vec2, iter_vec2}; use core::result; use core::vec; +use std::list::Nil; use std::map::HashMap; use std::smallintmap; use syntax::ast::{ret_style, purity}; use syntax::ast::{m_const, m_imm, m_mutbl}; use syntax::ast::{unsafe_fn, impure_fn, pure_fn, extern_fn}; +use syntax::ast; use syntax::ast_util::dummy_sp; -use syntax::{ast, ast_util}; +use syntax::ast_util; +use syntax::codemap::span; export infer_ctxt; export new_infer_ctxt; @@ -325,6 +331,13 @@ fn bar() { export sub; export to_str; export unify; +export uok; +export cyclic_ty, unresolved_ty, region_var_bound_by_region_var; +export bound, bounds; +export ures; +export ares; +export infer_ctxt; +export fixup_err; #[legacy_exports] mod assignment; @@ -557,7 +570,7 @@ fn compare(t: T, f: fn() -> ty::type_err) -> cres { } } -fn uok() -> ures { +pub fn uok() -> ures { Ok(()) } diff --git a/src/librustc/middle/typeck/infer/region_inference.rs b/src/librustc/middle/typeck/infer/region_inference.rs index e5ca30a3e2c..0d9c90e454c 100644 --- a/src/librustc/middle/typeck/infer/region_inference.rs +++ b/src/librustc/middle/typeck/infer/region_inference.rs @@ -539,13 +539,16 @@ fn(&a, &b, &a) fn(&x, &y, &y) fn(&a, &a, &a) fn(&a,&b,&c) #[warn(deprecated_mode)]; #[warn(deprecated_pattern)]; +use core::prelude::*; + use middle::region::is_subregion_of; use middle::region; use middle::ty; -use middle::ty::{Region, RegionVid, re_static, re_infer, re_free, re_bound}; -use middle::ty::{re_scope, ReVar, ReSkolemized, br_fresh}; +use middle::ty::{Region, RegionVid, br_fresh, re_bound, re_free, re_infer}; +use middle::ty::{re_scope, re_static, ReVar, ReSkolemized}; +use middle::typeck::infer::cres; use middle::typeck::infer::to_str::ToStr; -use syntax::codemap; +use util::common::indenter; use util::ppaux::note_and_explain_region; use core::cmp; @@ -558,6 +561,8 @@ fn(&a, &b, &a) fn(&x, &y, &y) fn(&a, &a, &a) fn(&a,&b,&c) use std::map::HashMap; use std::cell::{Cell, empty_cell}; use std::list::{List, Nil, Cons}; +use syntax::codemap::span; +use syntax::codemap; export RegionVarBindings; export make_subregion; diff --git a/src/librustc/middle/typeck/infer/resolve.rs b/src/librustc/middle/typeck/infer/resolve.rs index da4c02b9e35..68e589cab27 100644 --- a/src/librustc/middle/typeck/infer/resolve.rs +++ b/src/librustc/middle/typeck/infer/resolve.rs @@ -46,13 +46,21 @@ // future). If you want to resolve everything but one type, you are // probably better off writing `resolve_all - resolve_ivar`. +use core::prelude::*; +use middle::ty::{FloatVar, FloatVid, IntVar, IntVid, RegionVid, TyVar, TyVid}; +use middle::ty::{type_is_bot}; use middle::ty; +use middle::typeck::infer::{cyclic_ty, fixup_err, fres, infer_ctxt}; +use middle::typeck::infer::{region_var_bound_by_region_var, unresolved_ty}; use middle::typeck::infer::floating::*; use middle::typeck::infer::floating; use middle::typeck::infer::integral::*; use middle::typeck::infer::integral; use middle::typeck::infer::to_str::ToStr; +use middle::typeck::infer::unify::root; +use util::common::indent; +use util::ppaux::ty_to_str; use core::uint; use core::vec; diff --git a/src/librustc/middle/typeck/infer/sub.rs b/src/librustc/middle/typeck/infer/sub.rs index c96724bd652..79405e955f5 100644 --- a/src/librustc/middle/typeck/infer/sub.rs +++ b/src/librustc/middle/typeck/infer/sub.rs @@ -8,13 +8,22 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use middle::ty; +use middle::typeck::check::regionmanip::replace_bound_regions_in_fn_ty; use middle::typeck::infer::combine::*; +use middle::typeck::infer::cres; +use middle::typeck::infer::glb::Glb; +use middle::typeck::infer::infer_ctxt; +use middle::typeck::infer::lub::Lub; use middle::typeck::infer::to_str::ToStr; use middle::typeck::infer::unify::*; +use util::ppaux::bound_region_to_str; +use std::list::Nil; use std::list; +use syntax::ast::{m_const, purity, ret_style}; fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export. diff --git a/src/librustc/middle/typeck/infer/test.rs b/src/librustc/middle/typeck/infer/test.rs index abc249a45ec..5f85d6c4268 100644 --- a/src/librustc/middle/typeck/infer/test.rs +++ b/src/librustc/middle/typeck/infer/test.rs @@ -16,22 +16,24 @@ */ -use dvec::DVec; -use std::getopts; -use std::map::HashMap; -use std::getopts; -use std::getopts::{opt_present}; -use std::getopts::groups; -use std::getopts::groups::{optopt, optmulti, optflag, optflagopt, getopts}; -use driver::driver::{optgroups, build_session_options, build_session, - str_input, build_configuration}; +use core::prelude::*; + use driver::diagnostic; -use syntax::{ast, attr, parse}; -use syntax::parse::parse_crate_from_source_str; -use middle::lang_items::LanguageItems; +use driver::driver::{optgroups, build_session_options, build_session}; +use driver::driver::{str_input, build_configuration}; +use middle::lang_items::{LanguageItems, language_items}; +use middle::ty::{FnTyBase, FnMeta, FnSig}; use util::ppaux::ty_to_str; + +use std::getopts::groups::{optopt, optmulti, optflag, optflagopt, getopts}; +use std::getopts::groups; +use std::getopts::{opt_present}; +use std::getopts; +use std::getopts; +use std::map::HashMap; use syntax::ast_util::dummy_sp; -use middle::ty::{FnTyBase, FnMeta, FnSig}; +use syntax::parse::parse_crate_from_source_str; +use syntax::{ast, attr, parse}; struct Env { crate: @ast::crate, diff --git a/src/librustc/middle/typeck/infer/to_str.rs b/src/librustc/middle/typeck/infer/to_str.rs index 73352b802d6..0a1647eb09a 100644 --- a/src/librustc/middle/typeck/infer/to_str.rs +++ b/src/librustc/middle/typeck/infer/to_str.rs @@ -8,11 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; +use middle::ty::vid; use middle::ty; -use middle::typeck::infer::integral::int_ty_set; +use middle::typeck::infer::{bound, bounds}; use middle::typeck::infer::floating::float_ty_set; +use middle::typeck::infer::infer_ctxt; +use middle::typeck::infer::integral::int_ty_set; use middle::typeck::infer::unify::{redirect, root, var_value}; +use util::ppaux::{mt_to_str, ty_to_str}; use util::ppaux; use core::uint; diff --git a/src/librustc/middle/typeck/infer/unify.rs b/src/librustc/middle/typeck/infer/unify.rs index 8056c2c6bb3..633ff706a26 100644 --- a/src/librustc/middle/typeck/infer/unify.rs +++ b/src/librustc/middle/typeck/infer/unify.rs @@ -8,14 +8,19 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; +use middle::ty::vid; use middle::ty; +use middle::typeck::infer::{bound, bounds, cres, uok, ures}; use middle::typeck::infer::combine::combine; use middle::typeck::infer::floating::*; use middle::typeck::infer::floating; +use middle::typeck::infer::infer_ctxt; use middle::typeck::infer::integral::*; use middle::typeck::infer::integral; use middle::typeck::infer::to_str::ToStr; +use util::common::{indent, indenter}; use core::result; use std::smallintmap::SmallIntMap; diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs index adb6fc8baf7..f922e83a164 100644 --- a/src/librustc/middle/typeck/mod.rs +++ b/src/librustc/middle/typeck/mod.rs @@ -50,6 +50,8 @@ #[legacy_exports]; +use core::prelude::*; + use metadata::csearch; use middle::pat_util::{pat_id_map, PatIdMap}; use middle::resolve; @@ -99,6 +101,12 @@ export collect; export coherence; export deriving; +export crate_ctxt; +export write_ty_to_tcx, write_substs_to_tcx; +export no_params; +export isr_alist; +export require_same_types; +export lookup_def_ccx, lookup_def_tcx; #[legacy_exports] #[path = "check/mod.rs"] @@ -225,7 +233,7 @@ struct crate_ctxt__ { tcx: ty::ctxt } -enum crate_ctxt { +pub enum crate_ctxt { crate_ctxt_(crate_ctxt__) } diff --git a/src/librustc/middle/typeck/rscope.rs b/src/librustc/middle/typeck/rscope.rs index ecd73b4783a..f1655f2a363 100644 --- a/src/librustc/middle/typeck/rscope.rs +++ b/src/librustc/middle/typeck/rscope.rs @@ -8,12 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use middle::ty; use core::result::Result; use core::result; use syntax::ast; +use syntax::codemap::span; use syntax::parse::token::special_idents; trait region_scope { diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index cd71bb099fe..1a556c32bf3 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use syntax::ast; use syntax::codemap::{span}; diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 071f12a92d4..ebb75de8626 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; use middle::ty; use middle::ty::{arg, canon_mode}; diff --git a/src/librustdoc/astsrv.rs b/src/librustdoc/astsrv.rs index 83516a589b5..99cf301f182 100644 --- a/src/librustdoc/astsrv.rs +++ b/src/librustdoc/astsrv.rs @@ -17,6 +17,8 @@ non-sendableness. */ +use core::prelude::*; + use parse; use util; diff --git a/src/librustdoc/attr_parser.rs b/src/librustdoc/attr_parser.rs index e47bdbb00da..aa6e40ab1d1 100644 --- a/src/librustdoc/attr_parser.rs +++ b/src/librustdoc/attr_parser.rs @@ -15,6 +15,8 @@ an AST's attributes. */ +use core::prelude::*; + use core::str; use core::tuple; use core::vec; @@ -29,12 +31,12 @@ #[cfg(test)] mod test { - #[legacy_exports]; - use syntax::ast; use syntax; - fn parse_attributes(+source: ~str) -> ~[ast::attribute] { + use core::option::None; + + pub fn parse_attributes(+source: ~str) -> ~[ast::attribute] { use syntax::parse; use syntax::parse::parser; use syntax::parse::attr::parser_attr; diff --git a/src/librustdoc/attr_pass.rs b/src/librustdoc/attr_pass.rs index 8e52fb25a94..530f9f22666 100644 --- a/src/librustdoc/attr_pass.rs +++ b/src/librustdoc/attr_pass.rs @@ -16,6 +16,8 @@ of the natural-language documentation for a crate. */ +use core::prelude::*; + use astsrv; use attr_parser; use doc::ItemUtils; @@ -23,6 +25,7 @@ use extract::to_str; use fold::Fold; use fold; +use pass::Pass; use core::option; use core::vec; @@ -38,7 +41,7 @@ pub fn mk_pass() -> Pass { } } -fn run( +pub fn run( srv: astsrv::Srv, +doc: doc::Doc ) -> doc::Doc { @@ -309,13 +312,12 @@ fn f(a: bool) -> bool { }\ #[cfg(test)] mod test { - #[legacy_exports]; - use astsrv; + use attr_pass::run; use doc; use extract; - fn mk_doc(source: ~str) -> doc::Doc { + pub fn mk_doc(source: ~str) -> doc::Doc { do astsrv::from_str(source) |srv| { let doc = extract::from_srv(srv, ~""); run(srv, doc) diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 94b3a966184..ebd5c047df3 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use core::cmp; use core::os; use core::result; @@ -56,7 +58,7 @@ impl OutputStyle : cmp::Eq { pandoc_cmd: Option<~str> }; -impl Config: Clone { +pub impl Config: Clone { fn clone(&self) -> Config { copy *self } } @@ -105,7 +107,7 @@ pub fn default_config(input_crate: &Path) -> Config { type ProgramOutput = fn~((&str), (&[~str])) -> {status: int, out: ~str, err: ~str}; -fn mock_program_output(_prog: &str, _args: &[~str]) -> { +pub fn mock_program_output(_prog: &str, _args: &[~str]) -> { status: int, out: ~str, err: ~str } { { @@ -119,7 +121,7 @@ pub fn parse_config(args: &[~str]) -> Result { parse_config_(args, run::program_output) } -fn parse_config_( +pub fn parse_config_( args: &[~str], +program_output: ProgramOutput ) -> Result { @@ -288,8 +290,11 @@ fn should_error_with_no_pandoc() { #[cfg(test)] mod test { - #[legacy_exports]; - fn parse_config(args: &[~str]) -> Result { + use config::{Config, mock_program_output, parse_config_}; + + use core::result::Result; + + pub fn parse_config(args: &[~str]) -> Result { parse_config_(args, mock_program_output) } } diff --git a/src/librustdoc/demo.rs b/src/librustdoc/demo.rs index d7b50595580..bb8f37dc7ad 100644 --- a/src/librustdoc/demo.rs +++ b/src/librustdoc/demo.rs @@ -21,6 +21,8 @@ * tests on this file */ +use core::prelude::*; + /// The base price of a muffin on a non-holiday const price_of_a_muffin: float = 70f; diff --git a/src/librustdoc/desc_to_brief_pass.rs b/src/librustdoc/desc_to_brief_pass.rs index 2c3998cecee..97caa71d692 100644 --- a/src/librustdoc/desc_to_brief_pass.rs +++ b/src/librustdoc/desc_to_brief_pass.rs @@ -15,11 +15,14 @@ is interpreted as the brief description. */ +use core::prelude::*; + use astsrv; use doc::ItemUtils; use doc; use fold::Fold; use fold; +use pass::Pass; use core::str; use core::vec; @@ -32,7 +35,7 @@ pub fn mk_pass() -> Pass { } } -fn run( +pub fn run( _srv: astsrv::Srv, +doc: doc::Doc ) -> doc::Doc { @@ -98,15 +101,14 @@ fn should_promote_impl_method_desc() { } #[cfg(test)] -mod test { - #[legacy_exports]; - +pub mod test { use astsrv; use attr_pass; + use desc_to_brief_pass::run; use doc; use extract; - fn mk_doc(source: ~str) -> doc::Doc { + pub fn mk_doc(source: ~str) -> doc::Doc { do astsrv::from_str(source) |srv| { let doc = extract::from_srv(srv, ~""); let doc = (attr_pass::mk_pass().f)(srv, doc); diff --git a/src/librustdoc/doc.rs b/src/librustdoc/doc.rs index 4b5f82235dd..18742720b90 100644 --- a/src/librustdoc/doc.rs +++ b/src/librustdoc/doc.rs @@ -10,7 +10,10 @@ //! The document model +use core::prelude::*; + use doc; +use pass::Pass; use core::cmp; use core::option; diff --git a/src/librustdoc/escape_pass.rs b/src/librustdoc/escape_pass.rs index 46b21063774..6e000444865 100644 --- a/src/librustdoc/escape_pass.rs +++ b/src/librustdoc/escape_pass.rs @@ -10,6 +10,7 @@ //! Escapes text sequences +use pass::Pass; use text_pass; use core::str; diff --git a/src/librustdoc/extract.rs b/src/librustdoc/extract.rs index 8f2c61ba26e..444949cfb7f 100644 --- a/src/librustdoc/extract.rs +++ b/src/librustdoc/extract.rs @@ -10,6 +10,8 @@ //! Converts the Rust AST to the rustdoc document model +use core::prelude::*; + use astsrv; use doc::ItemUtils; use doc; @@ -346,6 +348,7 @@ mod test { use astsrv; use doc; + use extract::{extract, from_srv}; use parse; use core::vec; diff --git a/src/librustdoc/fold.rs b/src/librustdoc/fold.rs index deb6af224e5..29c53e0af25 100644 --- a/src/librustdoc/fold.rs +++ b/src/librustdoc/fold.rs @@ -8,10 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use astsrv; use doc; use extract; use parse; +use pass::Pass; use core::vec; use std::par; diff --git a/src/librustdoc/markdown_index_pass.rs b/src/librustdoc/markdown_index_pass.rs index 1408ae87416..881352c9c77 100644 --- a/src/librustdoc/markdown_index_pass.rs +++ b/src/librustdoc/markdown_index_pass.rs @@ -10,6 +10,8 @@ //! Build indexes as appropriate for the markdown pass +use core::prelude::*; + use astsrv; use config; use doc::ItemUtils; @@ -18,6 +20,7 @@ use fold; use markdown_pass; use markdown_writer; +use pass::Pass; use core::str; use std::par; @@ -31,7 +34,7 @@ pub fn mk_pass(+config: config::Config) -> Pass { } } -fn run( +pub fn run( _srv: astsrv::Srv, +doc: doc::Doc, +config: config::Config @@ -251,17 +254,19 @@ fn should_index_foreign_mod_contents() { #[cfg(test)] mod test { - #[legacy_exports]; - use astsrv; use attr_pass; use config; use desc_to_brief_pass; use doc; use extract; + use markdown_index_pass::run; use path_pass; - fn mk_doc(output_style: config::OutputStyle, +source: ~str) -> doc::Doc { + use core::path::Path; + + pub fn mk_doc(output_style: config::OutputStyle, +source: ~str) + -> doc::Doc { do astsrv::from_str(source) |srv| { let config = { output_style: output_style, diff --git a/src/librustdoc/markdown_pass.rs b/src/librustdoc/markdown_pass.rs index fd3cf86df27..ad100b9b4e8 100644 --- a/src/librustdoc/markdown_pass.rs +++ b/src/librustdoc/markdown_pass.rs @@ -10,6 +10,8 @@ //! Generate markdown from a document tree +use core::prelude::*; + use astsrv; use attr_pass; use config; @@ -25,6 +27,7 @@ use markdown_writer::WriterFactory; use markdown_writer; use page_pass; +use pass::Pass; use path_pass; use sectionalize_pass; use sort_pass; @@ -111,7 +114,7 @@ fn d() { }" w: Writer }; -fn write_markdown( +pub fn write_markdown( +doc: doc::Doc, +writer_factory: WriterFactory ) { @@ -838,6 +841,7 @@ mod test { use doc; use extract; use markdown_index_pass; + use markdown_pass::{mk_pass, write_markdown}; use markdown_writer; use path_pass; use sectionalize_pass; @@ -846,6 +850,7 @@ mod test { use unindent_pass; use core::oldcomm; + use core::path::Path; use core::str; fn render(+source: ~str) -> ~str { diff --git a/src/librustdoc/markdown_writer.rs b/src/librustdoc/markdown_writer.rs index f4e5db304e7..b701b674083 100644 --- a/src/librustdoc/markdown_writer.rs +++ b/src/librustdoc/markdown_writer.rs @@ -8,9 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use config; use doc::ItemUtils; use doc; +use pass::Pass; use core::io::ReaderUtil; use core::io; diff --git a/src/librustdoc/page_pass.rs b/src/librustdoc/page_pass.rs index 0709cc5dc55..e099beef7b6 100644 --- a/src/librustdoc/page_pass.rs +++ b/src/librustdoc/page_pass.rs @@ -15,12 +15,15 @@ individual modules, pages for the crate, indexes, etc. */ +use core::prelude::*; + use astsrv; use config; use doc::{ItemUtils, PageUtils}; use doc; use fold::Fold; use fold; +use pass::Pass; use sort_pass; use util::NominalOp; use util; @@ -39,7 +42,7 @@ pub fn mk_pass(output_style: config::OutputStyle) -> Pass { } } -fn run( +pub fn run( _srv: astsrv::Srv, +doc: doc::Doc, output_style: config::OutputStyle @@ -182,14 +185,13 @@ fn should_remove_foreign_mods_from_containing_mods() { #[cfg(test)] mod test { - #[legacy_exports]; - use astsrv; use config; use doc; use extract; + use page_pass::run; - fn mk_doc_( + pub fn mk_doc_( output_style: config::OutputStyle, source: ~str ) -> doc::Doc { @@ -199,7 +201,7 @@ fn mk_doc_( } } - fn mk_doc(source: ~str) -> doc::Doc { + pub fn mk_doc(source: ~str) -> doc::Doc { mk_doc_(config::DocPerMod, source) } } diff --git a/src/librustdoc/parse.rs b/src/librustdoc/parse.rs index db97f34f201..48eb3d47a16 100644 --- a/src/librustdoc/parse.rs +++ b/src/librustdoc/parse.rs @@ -10,6 +10,8 @@ //! AST-parsing helpers +use core::prelude::*; + use rustc::driver::driver::{file_input, str_input}; use rustc::driver::driver; use rustc::driver::session; diff --git a/src/librustdoc/pass.rs b/src/librustdoc/pass.rs index 967dcd8f49f..e6b85ca9d64 100644 --- a/src/librustdoc/pass.rs +++ b/src/librustdoc/pass.rs @@ -8,9 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use astsrv; use doc; use extract; +use time; use core::vec; diff --git a/src/librustdoc/path_pass.rs b/src/librustdoc/path_pass.rs index 4227ce23096..01ea26e1ad0 100644 --- a/src/librustdoc/path_pass.rs +++ b/src/librustdoc/path_pass.rs @@ -10,12 +10,15 @@ //! Records the full path to items +use core::prelude::*; + use astsrv; use doc::ItemUtils; use doc; use extract; use fold::Fold; use fold; +use pass::Pass; use syntax::ast; diff --git a/src/librustdoc/prune_hidden_pass.rs b/src/librustdoc/prune_hidden_pass.rs index da3c6bd7f2b..c87cc6f7d8c 100644 --- a/src/librustdoc/prune_hidden_pass.rs +++ b/src/librustdoc/prune_hidden_pass.rs @@ -16,6 +16,7 @@ use doc; use fold::Fold; use fold; +use pass::Pass; use core::vec; use std::map::HashMap; @@ -27,7 +28,7 @@ pub fn mk_pass() -> Pass { } } -fn run(srv: astsrv::Srv, +doc: doc::Doc) -> doc::Doc { +pub fn run(srv: astsrv::Srv, +doc: doc::Doc) -> doc::Doc { let fold = Fold { fold_mod: fold_mod, .. fold::default_any_fold(srv) @@ -69,14 +70,13 @@ fn should_prune_hidden_items() { } #[cfg(test)] -mod test { - #[legacy_exports]; - +pub mod test { use astsrv; use doc; use extract; + use prune_hidden_pass::run; - fn mk_doc(source: ~str) -> doc::Doc { + pub fn mk_doc(source: ~str) -> doc::Doc { do astsrv::from_str(source) |srv| { let doc = extract::from_srv(srv, ~""); run(srv, doc) diff --git a/src/librustdoc/prune_private_pass.rs b/src/librustdoc/prune_private_pass.rs index 5017f889d5a..25613acbb35 100644 --- a/src/librustdoc/prune_private_pass.rs +++ b/src/librustdoc/prune_private_pass.rs @@ -12,16 +12,20 @@ #[legacy_exports]; +use core::prelude::*; + use astsrv; use doc; use fold::Fold; use fold; +use pass::Pass; use core::util; use core::vec; use syntax::ast; export mk_pass; +export run; fn mk_pass() -> Pass { { @@ -30,7 +34,7 @@ fn mk_pass() -> Pass { } } -fn run(srv: astsrv::Srv, +doc: doc::Doc) -> doc::Doc { +pub fn run(srv: astsrv::Srv, +doc: doc::Doc) -> doc::Doc { let fold = Fold { fold_mod: fold_mod, .. fold::default_any_fold(srv) @@ -75,10 +79,11 @@ fn should_prune_items_without_pub_modifier() { } #[cfg(test)] -mod test { +pub mod test { use astsrv; use doc; use extract; + use prune_private_pass::run; pub fn mk_doc(source: ~str) -> doc::Doc { do astsrv::from_str(source) |srv| { diff --git a/src/librustdoc/sectionalize_pass.rs b/src/librustdoc/sectionalize_pass.rs index a2b66875220..a9cb8aa1e5d 100644 --- a/src/librustdoc/sectionalize_pass.rs +++ b/src/librustdoc/sectionalize_pass.rs @@ -10,6 +10,8 @@ //! Breaks rustdocs into sections according to their headers +use core::prelude::*; + use astsrv; use attr_pass; use doc::ItemUtils; @@ -17,6 +19,7 @@ use extract; use fold::Fold; use fold; +use pass::Pass; use core::str; use core::vec; @@ -29,7 +32,7 @@ pub fn mk_pass() -> Pass { } } -fn run(_srv: astsrv::Srv, +doc: doc::Doc) -> doc::Doc { +pub fn run(_srv: astsrv::Srv, +doc: doc::Doc) -> doc::Doc { let fold = Fold { fold_item: fold_item, fold_trait: fold_trait, @@ -249,15 +252,14 @@ fn should_sectionalize_impl_methods() { } #[cfg(test)] -mod test { - #[legacy_exports]; - +pub mod test { use astsrv; use attr_pass; use doc; use extract; + use sectionalize_pass::run; - fn mk_doc(source: ~str) -> doc::Doc { + pub fn mk_doc(source: ~str) -> doc::Doc { do astsrv::from_str(source) |srv| { let doc = extract::from_srv(srv, ~""); let doc = (attr_pass::mk_pass().f)(srv, doc); diff --git a/src/librustdoc/sort_item_name_pass.rs b/src/librustdoc/sort_item_name_pass.rs index 58349318bbb..9a777d79345 100644 --- a/src/librustdoc/sort_item_name_pass.rs +++ b/src/librustdoc/sort_item_name_pass.rs @@ -14,6 +14,7 @@ use doc::ItemUtils; use doc; use extract; +use pass::Pass; use sort_pass; pub fn mk_pass() -> Pass { diff --git a/src/librustdoc/sort_item_type_pass.rs b/src/librustdoc/sort_item_type_pass.rs index 4f69a307c20..332c2082e4b 100644 --- a/src/librustdoc/sort_item_type_pass.rs +++ b/src/librustdoc/sort_item_type_pass.rs @@ -10,10 +10,13 @@ //! Sorts items by type +use core::prelude::*; + use astsrv; use doc::ItemUtils; use doc; use extract; +use pass::Pass; use sort_pass; pub fn mk_pass() -> Pass { diff --git a/src/librustdoc/sort_pass.rs b/src/librustdoc/sort_pass.rs index fcf878dbf8d..c6d2ab0e9ad 100644 --- a/src/librustdoc/sort_pass.rs +++ b/src/librustdoc/sort_pass.rs @@ -10,12 +10,15 @@ //! A general sorting pass +use core::prelude::*; + use astsrv; use doc::ItemUtils; use doc; use extract; use fold::Fold; use fold; +use pass::Pass; use util::NominalOp; use std::sort; diff --git a/src/librustdoc/text_pass.rs b/src/librustdoc/text_pass.rs index ae205883902..975767727c5 100644 --- a/src/librustdoc/text_pass.rs +++ b/src/librustdoc/text_pass.rs @@ -10,11 +10,14 @@ //! Generic pass for performing an operation on all descriptions +use core::prelude::*; + use astsrv; use doc::ItemUtils; use doc; use fold::Fold; use fold; +use pass::Pass; use util::NominalOp; use std::par; @@ -288,18 +291,17 @@ fn should_execute_on_impl_method_section_bodies() { #[cfg(test)] mod test { - #[legacy_exports]; - use astsrv; use attr_pass; use desc_to_brief_pass; use doc; use extract; use sectionalize_pass; + use text_pass::mk_pass; use core::str; - fn mk_doc(source: ~str) -> doc::Doc { + pub fn mk_doc(source: ~str) -> doc::Doc { do astsrv::from_str(source) |srv| { let doc = extract::from_srv(srv, ~""); let doc = (attr_pass::mk_pass().f)(srv, doc); diff --git a/src/librustdoc/trim_pass.rs b/src/librustdoc/trim_pass.rs index 731a2bb7ad6..4ac8b51a6bc 100644 --- a/src/librustdoc/trim_pass.rs +++ b/src/librustdoc/trim_pass.rs @@ -17,8 +17,10 @@ use doc::ItemUtils; use doc; +use pass::Pass; use text_pass; +use core::option::Some; use core::str; pub fn mk_pass() -> Pass { @@ -35,14 +37,13 @@ mod m { #[cfg(test)] mod test { - #[legacy_exports]; - use astsrv; use attr_pass; use doc; use extract; + use trim_pass::mk_pass; - fn mk_doc(source: ~str) -> doc::Doc { + pub fn mk_doc(source: ~str) -> doc::Doc { do astsrv::from_str(source) |srv| { let doc = extract::from_srv(srv, ~""); let doc = (attr_pass::mk_pass().f)(srv, doc); diff --git a/src/librustdoc/tystr_pass.rs b/src/librustdoc/tystr_pass.rs index 92f2e0a5e8b..97d57569c73 100644 --- a/src/librustdoc/tystr_pass.rs +++ b/src/librustdoc/tystr_pass.rs @@ -10,6 +10,8 @@ //! Pulls type information out of the AST and attaches it to the document +use core::prelude::*; + use astsrv; use doc::ItemUtils; use doc; @@ -17,6 +19,7 @@ use extract; use fold::Fold; use fold; +use pass::Pass; use core::vec; use std::map::HashMap; @@ -32,7 +35,7 @@ pub fn mk_pass() -> Pass { } } -fn run( +pub fn run( srv: astsrv::Srv, +doc: doc::Doc ) -> doc::Doc { @@ -405,14 +408,13 @@ fn should_not_serialize_struct_attrs() { } #[cfg(test)] -mod test { - #[legacy_exports]; - +pub mod test { use astsrv; use doc; use extract; + use tystr_pass::run; - fn mk_doc(source: ~str) -> doc::Doc { + pub fn mk_doc(source: ~str) -> doc::Doc { do astsrv::from_str(source) |srv| { let doc = extract::from_srv(srv, ~""); run(srv, doc) diff --git a/src/librustdoc/unindent_pass.rs b/src/librustdoc/unindent_pass.rs index e18d1652a5b..87c249a7a18 100644 --- a/src/librustdoc/unindent_pass.rs +++ b/src/librustdoc/unindent_pass.rs @@ -19,6 +19,9 @@ middle of a line, and each of the following lines is indented. */ +use core::prelude::*; + +use pass::Pass; use text_pass; use core::str; diff --git a/src/librustdoc/util.rs b/src/librustdoc/util.rs index 998b64421d5..48ed77099c4 100644 --- a/src/librustdoc/util.rs +++ b/src/librustdoc/util.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use core::oldcomm; use core::task; diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index b38f756a2b5..3463b31c55c 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -20,6 +20,7 @@ use core::cast; use core::pipes; +use core::prelude::*; use core::private::{SharedMutableState, shared_mutable_state}; use core::private::{clone_shared_mutable_state, unwrap_shared_mutable_state}; use core::private::{get_shared_mutable_state, get_shared_immutable_state}; @@ -470,6 +471,9 @@ fn read(blk: fn(x: &T) -> U) -> U { mod tests { #[legacy_exports]; + use core::prelude::*; + + use arc::*; use arc; use core::oldcomm::*; diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs index e817e6e160f..6fee82521e8 100644 --- a/src/libstd/arena.rs +++ b/src/libstd/arena.rs @@ -42,6 +42,7 @@ use core::cast::reinterpret_cast; use core::cast; use core::libc::size_t; +use core::prelude::*; use core::ptr; use core::sys::TypeDesc; use core::sys; diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index 38ebe67898d..834edc3f464 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -11,6 +11,7 @@ #[forbid(deprecated_mode)]; use core::ops; +use core::prelude::*; use core::uint; use core::vec::{to_mut, from_elem}; use core::vec; @@ -578,6 +579,9 @@ impl Bitv: ops::Index { mod tests { #[legacy_exports]; + use core::prelude::*; + + use bitv::*; use bitv; use core::uint; diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs index aa9e864adfd..fe1bfa62fb1 100644 --- a/src/libstd/c_vec.rs +++ b/src/libstd/c_vec.rs @@ -40,6 +40,7 @@ use core::libc; use core::oldcomm; use core::option; +use core::prelude::*; use core::ptr; use core::task; @@ -152,6 +153,10 @@ pub unsafe fn ptr(t: CVec) -> *mut T { #[cfg(test)] mod tests { + use core::prelude::*; + + use c_vec::*; + use core::libc::*; use core::libc; diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs index 29c75e629e9..d4077e94617 100644 --- a/src/libstd/cell.rs +++ b/src/libstd/cell.rs @@ -11,6 +11,7 @@ #[forbid(deprecated_mode)]; use core::option; +use core::prelude::*; /// A dynamic, mutable location. /// diff --git a/src/libstd/comm.rs b/src/libstd/comm.rs index 850e53c2d48..3118a0c1ba5 100644 --- a/src/libstd/comm.rs +++ b/src/libstd/comm.rs @@ -20,6 +20,7 @@ use core::pipes::{GenericChan, GenericSmartChan, GenericPort}; use core::pipes::{Chan, Port, Selectable, Peekable}; use core::pipes; +use core::prelude::*; /// An extension of `pipes::stream` that allows both sending and receiving. pub struct DuplexStream { @@ -80,6 +81,8 @@ pub fn DuplexStream() #[cfg(test)] mod test { #[legacy_exports]; + use comm::DuplexStream; + #[test] fn DuplexStream1() { let (left, right) = DuplexStream(); diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index e7042ffa89f..71d8743a361 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -15,6 +15,7 @@ use core::cmp::Eq; use core::dvec::DVec; use core::dvec; +use core::prelude::*; use core::uint; use core::vec; @@ -131,6 +132,9 @@ fn get(i: int) -> T { #[cfg(test)] mod tests { + use core::prelude::*; + + use deque::*; use deque; #[test] diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs index 0f49507cea4..5a2fc2298ae 100644 --- a/src/libstd/ebml.rs +++ b/src/libstd/ebml.rs @@ -14,6 +14,7 @@ use core::io; use core::ops; +use core::prelude::*; use core::str; use core::vec; @@ -33,18 +34,18 @@ struct EbmlState { data_pos: uint, } -struct Doc { +pub struct Doc { data: @~[u8], start: uint, end: uint, } -struct TaggedDoc { +pub struct TaggedDoc { tag: uint, doc: Doc, } -enum EbmlEncoderTag { +pub enum EbmlEncoderTag { EsUint, EsU64, EsU32, EsU16, EsU8, EsInt, EsI64, EsI32, EsI16, EsI8, EsBool, @@ -60,11 +61,16 @@ enum EbmlEncoderTag { // -------------------------------------- pub mod reader { + use ebml::{Doc, EbmlEncoderTag, EsBool, EsEnum, EsEnumBody, EsEnumVid}; + use ebml::{EsF32, EsF64, EsFloat, EsI16, EsI32, EsI64, EsI8, EsInt}; + use ebml::{EsLabel, EsOpaque, EsStr, EsU16, EsU32, EsU64, EsU8, EsUint}; + use ebml::{EsVec, EsVecElt, EsVecLen, TaggedDoc}; use serialize; use core::int; use core::io; use core::ops; + use core::prelude::*; use core::str; use core::vec; @@ -398,6 +404,11 @@ fn read_tup_elt(&self, idx: uint, f: fn() -> T) -> T { } pub mod writer { + use ebml::{Doc, EbmlEncoderTag, EsBool, EsEnum, EsEnumBody, EsEnumVid}; + use ebml::{EsF32, EsF64, EsFloat, EsI16, EsI32, EsI64, EsI8, EsInt}; + use ebml::{EsLabel, EsOpaque, EsStr, EsU16, EsU32, EsU64, EsU8, EsUint}; + use ebml::{EsVec, EsVecElt, EsVecLen, TaggedDoc}; + use core::io; use core::str; use core::vec; @@ -668,6 +679,7 @@ mod tests { use serialize; use core::io; + use core::option::{None, Option, Some}; #[test] fn test_option_int() { diff --git a/src/libstd/flatpipes.rs b/src/libstd/flatpipes.rs index 8f239b2a130..07201a1180d 100644 --- a/src/libstd/flatpipes.rs +++ b/src/libstd/flatpipes.rs @@ -42,6 +42,7 @@ use core::pipes::GenericChan; use core::pipes::GenericPort; use core::pipes; +use core::prelude::*; use core::sys::size_of; use core::uint; use core::vec; @@ -160,15 +161,16 @@ pub fn pipe_stream */ pub mod pod { - - use core::io::{Reader, Writer}; - use core::pipes::{Port, Chan}; - use core::pipes; use flatpipes::flatteners::{PodUnflattener, PodFlattener}; use flatpipes::bytepipes::{ReaderBytePort, WriterByteChan}; use flatpipes::bytepipes::{PipeBytePort, PipeByteChan}; use flatpipes::{FlatPort, FlatChan}; + use core::io::{Reader, Writer}; + use core::pipes::{Port, Chan}; + use core::pipes; + use core::prelude::*; + pub type ReaderPort = FlatPort, ReaderBytePort>; pub type WriterChan = @@ -326,12 +328,14 @@ pub impl,C:ByteChan> FlatChan { pub mod flatteners { use ebml; + use flatpipes::{ByteChan, BytePort, Flattener, Unflattener}; use flatpipes::util::BufReader; use json; use serialize::{Encoder, Decoder, Encodable, Decodable}; use core::cast; use core::io::{Writer, Reader, BytesWriter, ReaderUtil}; + use core::prelude::*; use core::ptr; use core::sys::size_of; use core::vec; @@ -496,9 +500,12 @@ impl ebml::writer::Encoder: FromWriter { } pub mod bytepipes { + use flatpipes::{ByteChan, BytePort}; + use core::io::{Writer, Reader, ReaderUtil}; use core::pipes::{Port, Chan}; use core::pipes; + use core::prelude::*; pub struct ReaderBytePort { reader: R @@ -622,6 +629,7 @@ pub impl PipeByteChan { mod util { use core::io::{Reader, BytesReader}; use core::io; + use core::prelude::*; pub struct BufReader { buf: ~[u8], @@ -675,6 +683,7 @@ fn tell(&self) -> uint { #[cfg(test)] mod test { + use core::prelude::*; // XXX: json::Decoder doesn't work because of problems related to // its interior pointers @@ -688,6 +697,7 @@ mod test { use flatpipes::pod; use flatpipes::serial; use flatpipes::util::BufReader; + use flatpipes::{BytePort, FlatChan, FlatPort}; use net::ip; use net::tcp::TcpSocketBuf; @@ -695,6 +705,7 @@ mod test { use core::int; use core::io::BytesReader; use core::io; + use core::prelude::*; use core::result; use core::sys; use core::task; @@ -918,6 +929,10 @@ fn test_some_tcp_stream, F: Flattener>( // Tests that the different backends behave the same when the // binary streaming protocol is broken mod broken_protocol { + use core::prelude::*; + + use flatpipes::{BytePort, FlatPort}; + use flatpipes::flatteners::PodUnflattener; use flatpipes::pod; use flatpipes::util::BufReader; diff --git a/src/libstd/fun_treemap.rs b/src/libstd/fun_treemap.rs index 6a24e1e5817..e0d4b95a7e4 100644 --- a/src/libstd/fun_treemap.rs +++ b/src/libstd/fun_treemap.rs @@ -23,6 +23,7 @@ use core::cmp::{Eq, Ord}; use core::option::{Some, None}; +use core::prelude::*; pub type Treemap = @TreeNode; diff --git a/src/libstd/future.rs b/src/libstd/future.rs index 7cbd42f217d..6a34c29b516 100644 --- a/src/libstd/future.rs +++ b/src/libstd/future.rs @@ -26,6 +26,7 @@ use core::either::Either; use core::option; use core::pipes::{recv, oneshot, ChanOne, PortOne, send_one, recv_one}; +use core::prelude::*; use core::task; #[doc = "The future type"] @@ -145,6 +146,10 @@ pub fn spawn(blk: fn~() -> A) -> Future { #[allow(non_implicitly_copyable_typarams)] pub mod test { + use core::prelude::*; + + use future::*; + use core::pipes::oneshot; use core::task; diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs index 3d9ee0d3d12..93eb2095c5e 100644 --- a/src/libstd/getopts.rs +++ b/src/libstd/getopts.rs @@ -75,6 +75,7 @@ #[forbid(deprecated_mode)]; use core::cmp::Eq; +use core::prelude::*; use core::result::{Err, Ok}; use core::result; use core::option; @@ -83,16 +84,16 @@ use core::vec; #[deriving_eq] -enum Name { +pub enum Name { Long(~str), Short(char), } #[deriving_eq] -enum HasArg { Yes, No, Maybe, } +pub enum HasArg { Yes, No, Maybe, } #[deriving_eq] -enum Occur { Req, Optional, Multi, } +pub enum Occur { Req, Optional, Multi, } /// A description of a possible option #[deriving_eq] @@ -453,8 +454,10 @@ enum FailType { * groups of short and long option names, together. */ pub mod groups { - use getopts::Result; + use getopts::{HasArg, Long, Maybe, Multi, No, Occur, Opt, Optional, Req}; + use getopts::{Result, Short, Yes}; + use core::prelude::*; use core::str; use core::vec; @@ -569,7 +572,7 @@ pub fn long_to_short(lopt: &OptGroup) -> ~[Opt] { /* * Parse command line args with the provided long format options */ - pub fn getopts(args: &[~str], opts: &[OptGroup]) -> Result { + pub fn getopts(args: &[~str], opts: &[OptGroup]) -> ::getopts::Result { ::getopts::getopts(args, vec::flat_map(opts, long_to_short)) } @@ -633,9 +636,11 @@ pub fn usage(brief: &str, opts: &[OptGroup]) -> ~str { #[cfg(test)] mod tests { #[legacy_exports]; + use core::prelude::*; + use opt = getopts; use getopts::groups::OptGroup; - use getopts::groups; + use getopts::*; use core::result::{Err, Ok}; use core::result; diff --git a/src/libstd/json.rs b/src/libstd/json.rs index 44cd4fe4449..f29e2b5e2ca 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -23,6 +23,7 @@ use core::float; use core::io::{WriterUtil, ReaderUtil}; use core::io; +use core::prelude::*; use core::send_map::linear; use core::str; use core::to_str; @@ -1193,6 +1194,10 @@ impl Error: to_str::ToStr { #[cfg(test)] mod tests { + use core::prelude::*; + + use json::*; + use core::result; use core::send_map::linear; diff --git a/src/libstd/list.rs b/src/libstd/list.rs index 4a7574afd9f..2d9c96b28a9 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -14,6 +14,7 @@ use core::cmp::Eq; use core::option; use core::option::*; +use core::prelude::*; use core::vec; #[deriving_eq] @@ -162,6 +163,7 @@ pub fn has(ls: @List, elt: T) -> bool { mod tests { #[legacy_exports]; + use list::*; use list; use core::option; diff --git a/src/libstd/map.rs b/src/libstd/map.rs index e4f38496f1d..c7d59aa18cb 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -18,6 +18,7 @@ use core::ops; use core::to_str::ToStr; use core::mutable::Mut; +use core::prelude::*; use core::send_map::linear::LinearMap; use core::to_bytes::IterBytes; use core::uint; @@ -120,11 +121,12 @@ pub mod util { // FIXME (#2344): package this up and export it as a datatype usable for // external code that doesn't want to pay the cost of a box. pub mod chained { - use map::util; + use map::{Map, util}; use core::io; use core::ops; use core::option; + use core::prelude::*; use core::uint; use core::vec; @@ -615,6 +617,7 @@ fn clear() { mod tests { use map; + use core::option::None; use core::option; use core::uint; diff --git a/src/libstd/net_ip.rs b/src/libstd/net_ip.rs index 96bd6367e56..fad583a668b 100644 --- a/src/libstd/net_ip.rs +++ b/src/libstd/net_ip.rs @@ -13,6 +13,7 @@ use core::libc; use core::oldcomm; +use core::prelude::*; use core::ptr; use core::result; use core::str; @@ -47,7 +48,7 @@ pub enum IpAddr { } /// Human-friendly feedback on why a parse_addr attempt failed -type ParseAddrErr = { +pub type ParseAddrErr = { err_msg: ~str }; @@ -147,8 +148,12 @@ pub fn get_addr(node: &str, iotask: iotask) } pub mod v4 { + use net::ip::{IpAddr, Ipv4, Ipv6, ParseAddrErr}; use uv::ll; + use uv_ip4_addr = uv::ll::ip4_addr; + use uv_ip4_name = uv::ll::ip4_name; + use core::prelude::*; use core::ptr; use core::result; use core::str; @@ -241,6 +246,11 @@ pub fn try_parse_addr(ip: &str) -> result::Result { } } pub mod v6 { + use net::ip::{IpAddr, Ipv6, ParseAddrErr}; + use uv_ip6_addr = uv::ll::ip6_addr; + use uv_ip6_name = uv::ll::ip6_name; + + use core::prelude::*; use core::result; use core::str; @@ -350,6 +360,9 @@ pub fn try_parse_addr(ip: &str) -> result::Result { #[cfg(test)] mod test { + use core::prelude::*; + + use net_ip::*; use net_ip::v4; use net_ip::v6; use uv; diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs index ca365e2a7d3..64e779fb996 100644 --- a/src/libstd/net_tcp.rs +++ b/src/libstd/net_tcp.rs @@ -24,6 +24,7 @@ use core::libc::size_t; use core::libc; use core::oldcomm; +use core::prelude::*; use core::ptr; use core::result::{Result}; use core::result; @@ -86,7 +87,7 @@ pub fn TcpSocketBuf(data: @TcpBufferedSocketData) -> TcpSocketBuf { err_msg: ~str }; /// Details returned as part of a `result::err` result from `tcp::listen` -enum TcpListenErrData { +pub enum TcpListenErrData { /** * Some unplanned-for error. The first and second fields correspond * to libuv's `err_name` and `err_msg` fields, respectively. @@ -374,7 +375,7 @@ pub fn read_stop(sock: &TcpSocket, * * `timeout_msecs` - a `uint` value, in msecs, to wait before dropping the * read attempt. Pass `0u` to wait indefinitely */ -fn read(sock: &TcpSocket, timeout_msecs: uint) +pub fn read(sock: &TcpSocket, timeout_msecs: uint) -> result::Result<~[u8],TcpErrData> { let socket_data = ptr::addr_of(&(*(sock.socket_data))); read_common_impl(socket_data, timeout_msecs) @@ -1270,12 +1271,16 @@ enum ConnAttempt { //#[cfg(test)] mod test { - use net; use net::ip; + use net::tcp::{GenericListenErr, TcpConnectErrData, TcpListenErrData}; + use net::tcp::{TcpSocket, accept, connect, listen, read, socket_buf}; + use net; + use uv::iotask::IoTask; use uv; use core::io; use core::oldcomm; + use core::prelude::*; use core::result; use core::str; use core::task; diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs index 5fc20351793..cd683dcf8d0 100644 --- a/src/libstd/net_url.rs +++ b/src/libstd/net_url.rs @@ -19,6 +19,7 @@ use core::from_str::FromStr; use core::io::{Reader, ReaderUtil}; use core::io; +use core::prelude::*; use core::send_map::linear::LinearMap; use core::send_map; use core::str; @@ -735,6 +736,10 @@ impl Url: to_bytes::IterBytes { #[cfg(test)] mod tests { #[legacy_exports]; + + use core::prelude::*; + + use net_url::*; use net_url::UserInfo; use core::result; diff --git a/src/libstd/par.rs b/src/libstd/par.rs index d88d298ef18..04d88af1100 100644 --- a/src/libstd/par.rs +++ b/src/libstd/par.rs @@ -11,6 +11,7 @@ #[forbid(deprecated_mode)]; use core::cast; +use core::prelude::*; use core::ptr; use core::sys; use core::uint; diff --git a/src/libstd/priority_queue.rs b/src/libstd/priority_queue.rs index 42818676359..4d341d737f6 100644 --- a/src/libstd/priority_queue.rs +++ b/src/libstd/priority_queue.rs @@ -2,6 +2,7 @@ //! A priority queue implemented with a binary heap use core::cmp::Ord; +use core::prelude::*; use core::ptr::addr_of; use core::vec; diff --git a/src/libstd/rl.rs b/src/libstd/rl.rs index f384cceb41b..f0168607adb 100644 --- a/src/libstd/rl.rs +++ b/src/libstd/rl.rs @@ -12,6 +12,7 @@ // state without mutexes. use core::libc::{c_char, c_int}; +use core::prelude::*; use core::str; use core::task; diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs index 1513e621fcb..153f3956884 100644 --- a/src/libstd/rope.rs +++ b/src/libstd/rope.rs @@ -38,6 +38,7 @@ use core::cast; use core::char; use core::option; +use core::prelude::*; use core::str; use core::uint; use core::vec; @@ -448,7 +449,9 @@ pub fn loop_leaves(rope: Rope, it: fn(node::Leaf) -> bool) -> bool{ pub mod iterator { pub mod leaf { - use rope::node; + use rope::{Rope, node}; + + use core::prelude::*; pub fn start(rope: Rope) -> node::leaf_iterator::T { match (rope) { @@ -461,7 +464,9 @@ pub fn next(it: &node::leaf_iterator::T) -> Option { } } pub mod char { - use rope::node; + use rope::{Rope, node}; + + use core::prelude::*; pub fn start(rope: Rope) -> node::char_iterator::T { match (rope) { @@ -560,6 +565,7 @@ pub mod node { use core::cast; use core::char; use core::option; + use core::prelude::*; use core::str; use core::uint; use core::vec; @@ -1135,7 +1141,10 @@ pub fn loop_leaves(node: @Node, it: fn(Leaf) -> bool) -> bool{ } pub mod leaf_iterator { + use rope::node::{Concat, Leaf, Node, height}; + use core::option; + use core::prelude::*; use core::vec; pub type T = { @@ -1175,9 +1184,11 @@ pub fn next(it: &T) -> Option { } pub mod char_iterator { + use rope::node::{Leaf, Node}; use rope::node::leaf_iterator; use core::option; + use core::prelude::*; use core::str; pub type T = { @@ -1259,8 +1270,7 @@ pub fn get_next_char_in_leaf(it: &T) -> Option { #[cfg(test)] mod tests { - use rope::iterator; - use rope::node; + use rope::*; use core::option; use core::str; diff --git a/src/libstd/serialize.rs b/src/libstd/serialize.rs index 97d5ad18780..aa4ed82bbe9 100644 --- a/src/libstd/serialize.rs +++ b/src/libstd/serialize.rs @@ -18,6 +18,7 @@ #[forbid(non_camel_case_types)]; use core::at_vec; +use core::prelude::*; use core::vec; pub trait Encoder { diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index a6c14516af2..dbcb0c6aeec 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -21,6 +21,7 @@ use core::ops; use core::option::{Some, None}; use core::option; +use core::prelude::*; // FIXME (#2347): Should not be @; there's a bug somewhere in rustc that // requires this to be. @@ -168,6 +169,8 @@ pub fn as_map(s: SmallIntMap) -> map::Map { #[cfg(test)] mod tests { + use smallintmap::{mk, SmallIntMap}; + use core::option::None; use core::option; diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs index 505b2526741..d83568ddd94 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -13,6 +13,7 @@ use core::cmp::{Eq, Ord}; use core::dvec::DVec; +use core::prelude::*; use core::util; use core::vec::{len, push}; use core::vec; @@ -715,6 +716,10 @@ fn copy_vec(dest: &[mut T], s1: uint, mod test_qsort3 { #[legacy_exports]; + use core::prelude::*; + + use sort::*; + use core::vec; fn check_sort(v1: &[mut int], v2: &[mut int]) { @@ -758,6 +763,10 @@ fn test() { mod test_qsort { #[legacy_exports]; + use core::prelude::*; + + use sort::*; + use core::int; use core::vec; @@ -822,6 +831,10 @@ fn test_simple() { mod tests { #[legacy_exports]; + use core::prelude::*; + + use sort::*; + use core::vec; fn check_sort(v1: &[int], v2: &[int]) { @@ -887,6 +900,10 @@ fn test_merge_sort_stability() #[cfg(test)] mod test_tim_sort { + use core::prelude::*; + + use sort::tim_sort; + use core::rand; use core::vec; @@ -980,6 +997,10 @@ fn test_bad_Ord_impl() { #[cfg(test)] mod big_tests { + use core::prelude::*; + + use sort::*; + use core::rand; use core::task; use core::uint; diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index d957a7ee2ab..a883062c4b9 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -19,6 +19,7 @@ use core::option; use core::pipes; +use core::prelude::*; use core::private::{Exclusive, exclusive}; use core::ptr; use core::task; @@ -709,6 +710,10 @@ fn read(blk: fn() -> U) -> U { blk() } mod tests { #[legacy_exports]; + use core::prelude::*; + + use sync::*; + use core::cast; use core::option; use core::pipes; diff --git a/src/libstd/task_pool.rs b/src/libstd/task_pool.rs index 68bf2612f9a..5ed2195d2d2 100644 --- a/src/libstd/task_pool.rs +++ b/src/libstd/task_pool.rs @@ -14,6 +14,7 @@ use core::io; use core::pipes::{Chan, Port}; use core::pipes; +use core::prelude::*; use core::task::{SchedMode, SingleThreaded}; use core::task; use core::vec; diff --git a/src/libstd/tempfile.rs b/src/libstd/tempfile.rs index afb9290f6cf..bbe1e5c7ccd 100644 --- a/src/libstd/tempfile.rs +++ b/src/libstd/tempfile.rs @@ -13,6 +13,7 @@ #[forbid(deprecated_mode)]; use core::os; +use core::prelude::*; use core::rand; use core::str; diff --git a/src/libstd/test.rs b/src/libstd/test.rs index 176953663eb..8b4c53604bc 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -29,6 +29,7 @@ use core::libc::size_t; use core::oldcomm; use core::option; +use core::prelude::*; use core::result; use core::str; use core::task::TaskBuilder; @@ -79,7 +80,7 @@ pub fn test_main(args: &[~str], tests: &[TestDesc]) { type OptRes = Either; // Parses command line arguments into test options -fn parse_opts(args: &[~str]) -> OptRes { +pub fn parse_opts(args: &[~str]) -> OptRes { let args_ = vec::tail(args); let opts = ~[getopts::optflag(~"ignored"), getopts::optopt(~"logfile")]; let matches = @@ -283,9 +284,9 @@ enum TestEvent { type MonitorMsg = (TestDesc, TestResult); -fn run_tests(opts: &TestOpts, tests: &[TestDesc], +fn run_tests(opts: &TestOpts, + tests: &[TestDesc], callback: fn@(e: TestEvent)) { - let mut filtered_tests = filter_tests(opts, tests); callback(TeFiltered(copy filtered_tests)); @@ -340,8 +341,9 @@ fn get_concurrency() -> uint { } #[allow(non_implicitly_copyable_typarams)] -fn filter_tests(opts: &TestOpts, - tests: &[TestDesc]) -> ~[TestDesc] { +pub fn filter_tests(opts: &TestOpts, + tests: &[TestDesc]) + -> ~[TestDesc] { let mut filtered = vec::slice(tests, 0, tests.len()); // Remove tests that don't match the test filter @@ -393,7 +395,7 @@ fn filter(test: &TestDesc) -> Option { type TestFuture = {test: TestDesc, wait: fn@() -> TestResult}; -fn run_test(test: TestDesc, monitor_ch: oldcomm::Chan) { +pub fn run_test(test: TestDesc, monitor_ch: oldcomm::Chan) { if test.ignore { oldcomm::send(monitor_ch, (copy test, TrIgnored)); return; @@ -425,6 +427,8 @@ fn calc_result(test: &TestDesc, task_succeeded: bool) -> TestResult { mod tests { #[legacy_exports]; + use test::{TrFailed, TrIgnored, TrOk, filter_tests, parse_opts, run_test}; + use core::either; use core::oldcomm; use core::option; diff --git a/src/libstd/time.rs b/src/libstd/time.rs index 7c586c3fd4e..575f49c73fb 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -16,6 +16,7 @@ use core::i32; use core::io::{Reader, ReaderUtil}; use core::io; +use core::prelude::*; use core::result::{Result, Ok, Err}; use core::str; @@ -857,6 +858,8 @@ fn parse_type(ch: char, tm: &Tm) -> ~str { mod tests { #[legacy_exports]; + use time::*; + use core::float; use core::os; use core::result; diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index 038486f2b90..18c623c2bd8 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -19,6 +19,7 @@ use core::either; use core::libc; use core::oldcomm; +use core::prelude::*; use core::ptr; use core; @@ -164,6 +165,9 @@ pub fn recv_timeout(iotask: IoTask, mod test { #[legacy_exports]; + use core::prelude::*; + + use timer::*; use uv; use core::iter; diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index caccb763ee9..af3ab4b88eb 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -18,8 +18,8 @@ #[forbid(deprecated_mode)]; use core::cmp::{Eq, Ord}; -use core::option::{Some, None}; -use Option = core::Option; +use core::option::{Option, Some, None}; +use core::prelude::*; pub type TreeMap = @mut TreeEdge; @@ -107,6 +107,9 @@ pub fn equals(t1: &const TreeEdge, mod tests { #[legacy_exports]; + use treemap::*; + + use core::option::{None, Option, Some}; use core::str; #[test] diff --git a/src/libstd/uv_global_loop.rs b/src/libstd/uv_global_loop.rs index 43ed58aa0c1..f65c8ce3875 100644 --- a/src/libstd/uv_global_loop.rs +++ b/src/libstd/uv_global_loop.rs @@ -123,8 +123,11 @@ fn spawn_loop() -> IoTask { #[cfg(test)] mod test { + use core::prelude::*; + use uv::iotask; use uv::ll; + use uv_global_loop::*; use core::iter; use core::libc; diff --git a/src/libstd/uv_iotask.rs b/src/libstd/uv_iotask.rs index 7853f1cd9f7..409d73c2539 100644 --- a/src/libstd/uv_iotask.rs +++ b/src/libstd/uv_iotask.rs @@ -21,6 +21,7 @@ use core::libc::c_void; use core::libc; use core::oldcomm::{Port, Chan, listen}; +use core::prelude::*; use core::ptr::addr_of; use core::task::TaskBuilder; use core::task; @@ -176,7 +177,10 @@ fn begin_teardown(data: *IoTaskLoopData) unsafe { #[cfg(test)] mod test { + use core::prelude::*; + use uv::ll; + use uv_iotask::*; use core::iter; use core::libc; diff --git a/src/libstd/uv_ll.rs b/src/libstd/uv_ll.rs index 46574ced2e5..4446e1388e6 100644 --- a/src/libstd/uv_ll.rs +++ b/src/libstd/uv_ll.rs @@ -34,6 +34,7 @@ use core::libc::size_t; use core::libc; +use core::prelude::*; use core::ptr::to_unsafe_ptr; use core::ptr; use core::str; @@ -319,6 +320,9 @@ pub mod addrinfo_impl { }; pub mod uv_ll_struct_stubgen { + use uv_ll::{uv_async_t, uv_connect_t, uv_getaddrinfo_t, uv_tcp_t}; + use uv_ll::{uv_timer_t, uv_write_t}; + use core::ptr; pub fn gen_stub_uv_tcp_t() -> uv_tcp_t { @@ -1040,6 +1044,10 @@ pub unsafe fn addrinfo_as_sockaddr_in6(input: *addrinfo) -> *sockaddr_in6 { #[cfg(test)] pub mod test { + use core::prelude::*; + + use uv_ll::*; + use core::libc; use core::oldcomm; use core::ptr; diff --git a/src/libstd/workcache.rs b/src/libstd/workcache.rs index 3631556c2ba..c8898ccd9c7 100644 --- a/src/libstd/workcache.rs +++ b/src/libstd/workcache.rs @@ -16,6 +16,7 @@ use core::io; use core::option; use core::pipes::{recv, oneshot, PortOne, send_one}; +use core::prelude::*; use core::result; use core::run; use core::send_map::linear::LinearMap; diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index c7c8c77c70f..42e722f8d53 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -12,10 +12,10 @@ use ast; use codemap::{span, FileName}; -use parse::token; use core::cast; use core::cmp; +use core::option::{None, Option, Some}; use core::ptr; use core::task; use core::to_bytes; @@ -29,7 +29,8 @@ /* can't import macros yet, so this is copied from token.rs. See its comment * there. */ macro_rules! interner_key ( - () => (cast::transmute::<(uint, uint), &fn(+v: @@token::ident_interner)>( + () => (cast::transmute::<(uint, uint), + &fn(+v: @@::parse::token::ident_interner)>( (-3 as uint, 0u))) ) @@ -768,10 +769,10 @@ enum expr_ { #[auto_decode] #[doc="For macro invocations; parsing is delegated to the macro"] enum token_tree { - tt_tok(span, token::Token), + tt_tok(span, ::parse::token::Token), tt_delim(~[token_tree]), // These only make sense for right-hand-sides of MBE macros - tt_seq(span, ~[token_tree], Option, bool), + tt_seq(span, ~[token_tree], Option<::parse::token::Token>, bool), tt_nonterminal(span, ident) } @@ -833,10 +834,10 @@ enum token_tree { #[auto_decode] enum matcher_ { // match one token - match_tok(token::Token), + match_tok(::parse::token::Token), // match repetitions of a sequence: body, separator, zero ok?, // lo, hi position-in-match-array used: - match_seq(~[matcher], Option, bool, uint, uint), + match_seq(~[matcher], Option<::parse::token::Token>, bool, uint, uint), // parse a Rust NT: name to bind, name of NT, position in match array: match_nonterminal(ident, ident, uint) } @@ -1149,7 +1150,7 @@ impl Ty : to_bytes::IterBytes { #[auto_encode] #[auto_decode] -enum purity { +pub enum purity { pure_fn, // declared with "pure fn" unsafe_fn, // declared with "unsafe fn" impure_fn, // declared with "fn" diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index f35d8c4e1c4..f56f0c545bf 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast::*; use ast; use ast_util::{path_to_ident, stmt_id}; diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index eaa61b304cd..3cab2151fde 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -8,10 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast::*; use ast; use ast_util; use codemap::{span, BytePos}; +use parse::token; use visit; use core::cmp; diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 73c14e2d00c..985e0951794 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -10,6 +10,8 @@ // Functions dealing with attributes and meta_items +use core::prelude::*; + use ast; use ast_util::{spanned, dummy_spanned}; use attr; diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 1f26711abb9..1e4a40405fd 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -21,6 +21,8 @@ */ +use core::prelude::*; + use ast_util; use core::cmp; diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index ddffa04622f..7e9d257a742 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use codemap::span; use codemap; diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs index b8fe00e246c..152c49461b8 100644 --- a/src/libsyntax/ext/auto_encode.rs +++ b/src/libsyntax/ext/auto_encode.rs @@ -88,10 +88,14 @@ impl< */ +use core::prelude::*; + +use ast; use ast_util; use attr; use codemap::span; use ext::base::*; +use parse; use core::vec; use std::map; @@ -421,7 +425,7 @@ fn mk_impl( @{ // This is a new-style impl declaration. // XXX: clownshoes - ident: ast::token::special_idents::clownshoes_extensions, + ident: parse::token::special_idents::clownshoes_extensions, attrs: ~[], id: cx.next_id(), node: ast::item_impl(trait_tps, opt_trait, ty, ~[f(ty)]), diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index dc774805ed3..7b69084a827 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast; use ast_util::dummy_sp; use codemap; diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index d63f14b5774..4a3c8ee2259 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast; use codemap; use codemap::span; diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs index 4f88ffeeb04..d847cfee053 100644 --- a/src/libsyntax/ext/concat_idents.rs +++ b/src/libsyntax/ext/concat_idents.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ext::base::*; use ext::base; diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs index 3cbc8f3834f..41804b1022a 100644 --- a/src/libsyntax/ext/deriving.rs +++ b/src/libsyntax/ext/deriving.rs @@ -11,6 +11,8 @@ /// The compiler code necessary to implement the #[deriving_eq] and /// #[deriving_iter_bytes] extensions. +use core::prelude::*; + use ast::{Ty, and, bind_by_ref, binop, deref, enum_def, enum_variant_kind}; use ast::{expr, expr_match, ident, item, item_, item_struct, item_enum}; use ast::{item_impl, m_imm, meta_item, method, named_field, or, pat}; diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 27565b44c6d..8faeb167191 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast::{crate, expr_, expr_mac, mac_invoc_tt}; use ast::{tt_delim, tt_tok, item_mac, stmt_, stmt_mac, stmt_expr, stmt_semi}; use ast; diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index b8a27096f73..0eaa983ccad 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -16,6 +16,8 @@ * compiler syntax extension plugin interface. */ +use core::prelude::*; + use ast; use codemap::span; use ext::base::*; diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index 7a87d909fe6..56ace4aac1b 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -13,13 +13,15 @@ // To start with, it will be use dummy spans, but it might someday do // something smarter. +use core::prelude::*; + use ast::{ident, node_id}; use ast; use ast_util::{ident_to_path, respan, dummy_sp}; use ast_util; use attr; use codemap::span; -use ext::base::mk_ctxt; +use ext::base::{ext_ctxt, mk_ctxt}; use ext::quote::rt::*; use core::vec; @@ -112,9 +114,11 @@ fn item_ty_poly(name: ident, impl ext_ctxt: ext_ctxt_ast_builder { fn ty_option(ty: @ast::Ty) -> @ast::Ty { - self.ty_path_ast_builder(path(~[self.ident_of(~"Option")], - dummy_sp()) - .add_ty(ty)) + self.ty_path_ast_builder(path_global(~[ + self.ident_of(~"core"), + self.ident_of(~"option"), + self.ident_of(~"Option") + ], dummy_sp()).add_ty(ty)) } fn block_expr(b: ast::blk) -> @ast::expr { @@ -283,10 +287,37 @@ fn variant(name: ident, fn item_mod(name: ident, span: span, +items: ~[@ast::item]) -> @ast::item { + // XXX: Total hack: import `core::kinds::Owned` to work around a + // parser bug whereby `fn f` doesn't parse. + let vi = ast::view_item_import(~[ + @{ + node: ast::view_path_simple( + self.ident_of(~"Owned"), + path( + ~[ + self.ident_of(~"core"), + self.ident_of(~"kinds"), + self.ident_of(~"Owned") + ], + ast_util::dummy_sp() + ), + ast::type_value_ns, + self.next_id() + ), + span: ast_util::dummy_sp() + } + ]); + let vi = @{ + node: vi, + attrs: ~[], + vis: ast::private, + span: ast_util::dummy_sp() + }; + self.item(name, span, ast::item_mod({ - view_items: ~[], + view_items: ~[vi], items: items})) } diff --git a/src/libsyntax/ext/pipes/check.rs b/src/libsyntax/ext/pipes/check.rs index 8eecafa8fa4..f2ba413dd38 100644 --- a/src/libsyntax/ext/pipes/check.rs +++ b/src/libsyntax/ext/pipes/check.rs @@ -29,7 +29,10 @@ */ +use core::prelude::*; + use ast; +use codemap::span; use ext::base::ext_ctxt; use ext::pipes::proto::{state, protocol, next_state}; use ext::pipes::proto; diff --git a/src/libsyntax/ext/pipes/liveness.rs b/src/libsyntax/ext/pipes/liveness.rs index 76749f6b2db..01e99594083 100644 --- a/src/libsyntax/ext/pipes/liveness.rs +++ b/src/libsyntax/ext/pipes/liveness.rs @@ -37,6 +37,11 @@ */ +use core::prelude::*; + +use ext::base::ext_ctxt; +use ext::pipes::protocol; + use core::str; use std::bitv::{Bitv}; diff --git a/src/libsyntax/ext/pipes/mod.rs b/src/libsyntax/ext/pipes/mod.rs index 67b5c81ad2d..cb17e56e990 100644 --- a/src/libsyntax/ext/pipes/mod.rs +++ b/src/libsyntax/ext/pipes/mod.rs @@ -53,6 +53,8 @@ use parse::lexer::{new_tt_reader, reader}; use parse::parser::Parser; +use core::option::None; + #[legacy_exports] mod ast_builder; #[legacy_exports] diff --git a/src/libsyntax/ext/pipes/parse_proto.rs b/src/libsyntax/ext/pipes/parse_proto.rs index 0f6b9dbda28..6a6e895bd40 100644 --- a/src/libsyntax/ext/pipes/parse_proto.rs +++ b/src/libsyntax/ext/pipes/parse_proto.rs @@ -10,10 +10,11 @@ // Parsing pipes protocols from token trees. +use ext::pipes::pipec::*; use parse::parser; use parse::token; -use ext::pipes::pipec::*; +use core::prelude::*; trait proto_parser { fn parse_proto(id: ~str) -> protocol; diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index ef9c086e3f5..e88ddb841be 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -20,6 +20,7 @@ use util::interner; use core::dvec::DVec; +use core::prelude::*; use core::str; use core::to_str::ToStr; use core::vec; @@ -385,7 +386,8 @@ fn buffer_ty_path(cx: ext_ctxt) -> @ast::Ty { } } - cx.ty_path_ast_builder(path(~[cx.ident_of(~"__Buffer")], self.span) + cx.ty_path_ast_builder(path(~[cx.ident_of(~"super"), + cx.ident_of(~"__Buffer")], self.span) .add_tys(cx.ty_vars_global(params))) } diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs index a2673c481b1..9953b4de50d 100644 --- a/src/libsyntax/ext/pipes/proto.rs +++ b/src/libsyntax/ext/pipes/proto.rs @@ -8,7 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast; +use codemap::span; +use ext::base::ext_ctxt; use ext::pipes::ast_builder::{path, append_types}; use core::cmp; diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 184093715c6..4aed5b64747 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -18,6 +18,7 @@ use parse::token; use parse; +use core::prelude::*; use core::str; /** @@ -33,6 +34,7 @@ pub mod rt { use ast; + use ext::base::ext_ctxt; use parse; use print::pprust; diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 47c6ea8876e..3d012b393bb 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -16,6 +16,7 @@ use print::pprust; use core::io; +use core::prelude::*; use core::result; use core::str; use core::vec; diff --git a/src/libsyntax/ext/trace_macros.rs b/src/libsyntax/ext/trace_macros.rs index c202778d0df..d5031b97718 100644 --- a/src/libsyntax/ext/trace_macros.rs +++ b/src/libsyntax/ext/trace_macros.rs @@ -8,17 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use ast::tt_delim; use ast; use codemap::span; -use ext::base; use ext::base::ext_ctxt; -use ast::tt_delim; +use ext::base; use parse::lexer::{new_tt_reader, reader}; use parse::parser::Parser; +use core::option::None; + fn expand_trace_macros(cx: ext_ctxt, sp: span, - tt: ~[ast::token_tree]) -> base::mac_result -{ + tt: ~[ast::token_tree]) -> base::mac_result { let sess = cx.parse_sess(); let cfg = cx.cfg(); let tt_rdr = new_tt_reader(cx.parse_sess().span_diagnostic, diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 7386b3b67b9..1f1efdfe165 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast::{ident, matcher_, matcher, match_tok, match_nonterminal, match_seq}; use ast::{tt_delim}; use ast; diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index c1745fac710..47489034a0f 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast; use ast::{token_tree, tt_delim, tt_tok, tt_seq, tt_nonterminal,ident}; use ast_util; diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 6d32c73e1f7..7de4e3f1d5f 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast::*; use ast; use codemap::span; diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index a3fd069afbb..49197be4bb9 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -8,8 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast; use ast_util::spanned; +use codemap::BytePos; use parse::common::*; //resolve bug? use parse::token; diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index d5365d59041..0e101d54ba3 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -8,8 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast; -use codemap::{CodeMap, FileMap, CharPos}; +use codemap::{BytePos, CharPos, CodeMap, FileMap}; use diagnostic; use parse::lexer::{is_whitespace, get_str_from, reader}; use parse::lexer::{string_reader, bump, is_eof, nextch}; diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index ca0bbbb7369..1c6022130dc 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -8,12 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast; use ast_util::spanned; +use codemap::BytePos; use parse::lexer::reader; use parse::parser::Parser; use parse::token; +use core::option::{None, Option, Some}; use core::option; use std::map::HashMap; diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index c51f7e4dad6..573c36e619b 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -8,13 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast; use ast_util; use codemap::{span, CodeMap, CharPos, BytePos}; use codemap; use diagnostic::span_handler; use ext::tt::transcribe::{tt_next_token}; -use ext::tt::transcribe::{tt_reader, new_tt_reader, dup_tt_reader}; +use ext::tt::transcribe::{tt_reader, new_tt_reader, dup_tt_reader}; use parse::token; use core::char; diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index fb5c6250179..b14b60af134 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -10,8 +10,6 @@ //! The main parser interface -#[legacy_exports]; - use ast::node_id; use ast; use codemap::{span, CodeMap, FileMap, CharPos, BytePos}; @@ -24,70 +22,47 @@ use util::interner; use core::io; +use core::option::{None, Option, Some}; +use core::path::Path; +use core::result::{Err, Ok, Result}; use core::result; -export parser; -export common; -export lexer; -export token; -export comments; -export prec; -export classify; -export attr; -export obsolete; - -export parse_sess; -export new_parse_sess, new_parse_sess_special_handler; -export next_node_id; -export new_parser_from_file, new_parser_etc_from_file; -export new_parser_from_source_str; -export new_parser_from_tts; -export new_sub_parser_from_file; -export parse_crate_from_file, parse_crate_from_crate_file; -export parse_crate_from_source_str; -export parse_expr_from_source_str, parse_item_from_source_str; -export parse_stmt_from_source_str; -export parse_tts_from_source_str; -export parse_from_source_str; - - #[legacy_exports] -mod lexer; +pub mod lexer; #[legacy_exports] -mod parser; +pub mod parser; #[legacy_exports] -mod token; +pub mod token; #[legacy_exports] -mod comments; +pub mod comments; #[legacy_exports] -mod attr; +pub mod attr; #[legacy_exports] /// Common routines shared by parser mods #[legacy_exports] -mod common; +pub mod common; /// Functions dealing with operator precedence #[legacy_exports] -mod prec; +pub mod prec; /// Routines the parser uses to classify AST nodes #[legacy_exports] -mod classify; +pub mod classify; /// Reporting obsolete syntax #[legacy_exports] -mod obsolete; - +pub mod obsolete; -type parse_sess = @{ +pub type parse_sess = @{ cm: @codemap::CodeMap, mut next_id: node_id, span_diagnostic: span_handler, interner: @ident_interner, }; -fn new_parse_sess(demitter: Option) -> parse_sess { +pub fn new_parse_sess(demitter: Option) -> parse_sess { let cm = @CodeMap::new(); return @{cm: cm, mut next_id: 1, @@ -96,7 +71,7 @@ fn new_parse_sess(demitter: Option) -> parse_sess { }; } -fn new_parse_sess_special_handler(sh: span_handler, cm: @codemap::CodeMap) +pub fn new_parse_sess_special_handler(sh: span_handler, cm: @codemap::CodeMap) -> parse_sess { return @{cm: cm, mut next_id: 1, @@ -105,15 +80,17 @@ fn new_parse_sess_special_handler(sh: span_handler, cm: @codemap::CodeMap) }; } -fn parse_crate_from_file(input: &Path, cfg: ast::crate_cfg, +pub fn parse_crate_from_file(input: &Path, cfg: ast::crate_cfg, sess: parse_sess) -> @ast::crate { let p = new_crate_parser_from_file(sess, cfg, input); let r = p.parse_crate_mod(cfg); return r; } -fn parse_crate_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, - sess: parse_sess) -> @ast::crate { +pub fn parse_crate_from_source_str(name: ~str, + source: @~str, + cfg: ast::crate_cfg, + sess: parse_sess) -> @ast::crate { let p = new_parser_from_source_str(sess, cfg, name, codemap::FssNone, source); let r = p.parse_crate_mod(cfg); @@ -121,8 +98,10 @@ fn parse_crate_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, return r; } -fn parse_expr_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, - sess: parse_sess) -> @ast::expr { +pub fn parse_expr_from_source_str(name: ~str, + source: @~str, + cfg: ast::crate_cfg, + sess: parse_sess) -> @ast::expr { let p = new_parser_from_source_str(sess, cfg, name, codemap::FssNone, source); let r = p.parse_expr(); @@ -130,9 +109,12 @@ fn parse_expr_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, return r; } -fn parse_item_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, - +attrs: ~[ast::attribute], - sess: parse_sess) -> Option<@ast::item> { +pub fn parse_item_from_source_str(name: ~str, + source: @~str, + cfg: ast::crate_cfg, + +attrs: ~[ast::attribute], + sess: parse_sess) + -> Option<@ast::item> { let p = new_parser_from_source_str(sess, cfg, name, codemap::FssNone, source); let r = p.parse_item(attrs); @@ -140,9 +122,11 @@ fn parse_item_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, return r; } -fn parse_stmt_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, - +attrs: ~[ast::attribute], - sess: parse_sess) -> @ast::stmt { +pub fn parse_stmt_from_source_str(name: ~str, + source: @~str, + cfg: ast::crate_cfg, + +attrs: ~[ast::attribute], + sess: parse_sess) -> @ast::stmt { let p = new_parser_from_source_str(sess, cfg, name, codemap::FssNone, source); let r = p.parse_stmt(attrs); @@ -150,8 +134,10 @@ fn parse_stmt_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, return r; } -fn parse_tts_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, - sess: parse_sess) -> ~[ast::token_tree] { +pub fn parse_tts_from_source_str(name: ~str, + source: @~str, + cfg: ast::crate_cfg, + sess: parse_sess) -> ~[ast::token_tree] { let p = new_parser_from_source_str(sess, cfg, name, codemap::FssNone, source); p.quote_depth += 1u; @@ -160,7 +146,7 @@ fn parse_tts_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, return r; } -fn parse_from_source_str(f: fn (p: Parser) -> T, +pub fn parse_from_source_str(f: fn (p: Parser) -> T, name: ~str, ss: codemap::FileSubstr, source: @~str, cfg: ast::crate_cfg, sess: parse_sess) @@ -176,7 +162,7 @@ fn parse_from_source_str(f: fn (p: Parser) -> T, move r } -fn next_node_id(sess: parse_sess) -> node_id { +pub fn next_node_id(sess: parse_sess) -> node_id { let rv = sess.next_id; sess.next_id += 1; // ID 0 is reserved for the crate and doesn't actually exist in the AST @@ -184,7 +170,7 @@ fn next_node_id(sess: parse_sess) -> node_id { return rv; } -fn new_parser_from_source_str(sess: parse_sess, cfg: ast::crate_cfg, +pub fn new_parser_from_source_str(sess: parse_sess, cfg: ast::crate_cfg, +name: ~str, +ss: codemap::FileSubstr, source: @~str) -> Parser { let filemap = sess.cm.new_filemap_w_substr(name, ss, source); @@ -193,7 +179,7 @@ fn new_parser_from_source_str(sess: parse_sess, cfg: ast::crate_cfg, return Parser(sess, cfg, srdr as reader); } -fn new_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, +pub fn new_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, path: &Path) -> Result { match io::read_whole_file_str(path) { result::Ok(move src) => { @@ -211,7 +197,7 @@ fn new_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, /// Create a new parser for an entire crate, handling errors as appropriate /// if the file doesn't exist -fn new_crate_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, +pub fn new_crate_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, path: &Path) -> Parser { match new_parser_from_file(sess, cfg, path) { Ok(move parser) => move parser, @@ -223,7 +209,7 @@ fn new_crate_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, /// Create a new parser based on a span from an existing parser. Handles /// error messages correctly when the file does not exist. -fn new_sub_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, +pub fn new_sub_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, path: &Path, sp: span) -> Parser { match new_parser_from_file(sess, cfg, path) { Ok(move parser) => move parser, @@ -233,7 +219,7 @@ fn new_sub_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, } } -fn new_parser_from_tts(sess: parse_sess, cfg: ast::crate_cfg, +pub fn new_parser_from_tts(sess: parse_sess, cfg: ast::crate_cfg, tts: ~[ast::token_tree]) -> Parser { let trdr = lexer::new_tt_reader(sess.span_diagnostic, sess.interner, None, tts); diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index 6b73cf308a2..15905c090db 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -17,10 +17,13 @@ removed. */ +use core::prelude::*; + use ast::{expr, expr_lit, lit_nil}; use ast; use ast_util::{respan}; use codemap::span; +use parse::parser::Parser; use parse::token::Token; use parse::token; diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index f32a782622a..80fd04f0e10 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast::{ProtoBox, ProtoUniq, provided, public, pure_fn, purity, re_static}; use ast::{_mod, add, arg, arm, attribute, bind_by_ref, bind_infer}; use ast::{bind_by_value, bind_by_move, bitand, bitor, bitxor, blk}; @@ -33,23 +35,24 @@ use ast::{lit_int_unsuffixed, lit_nil, lit_str, lit_uint, local, m_const}; use ast::{m_imm, m_mutbl, mac_, mac_invoc_tt, matcher, match_nonterminal}; use ast::{match_seq, match_tok, method, mode, module_ns, mt, mul, mutability}; -use ast::{named_field, neg, noreturn, not, pat, pat_box, pat_enum, pat_ident}; -use ast::{pat_lit, pat_range, pat_rec, pat_region, pat_struct, pat_tup}; -use ast::{pat_uniq, pat_wild, path, private, Proto, ProtoBare, ProtoBorrowed}; -use ast::{re_self, re_anon, re_named, region, rem, required, ret_style}; -use ast::{return_val, self_ty, shl, shr, stmt, stmt_decl, stmt_expr}; -use ast::{stmt_semi, stmt_mac, struct_def, struct_field, struct_immutable}; -use ast::{struct_mutable, struct_variant_kind, subtract, sty_box, sty_by_ref}; -use ast::{sty_region, sty_static, sty_uniq, sty_value, token_tree}; -use ast::{trait_method, trait_ref, tt_delim, tt_seq, tt_tok, tt_nonterminal}; -use ast::{tuple_variant_kind, Ty, ty_, ty_bot, ty_box, ty_field, ty_fn}; -use ast::{ty_fixed_length_vec, type_value_ns, uniq, unnamed_field}; -use ast::{ty_infer, ty_mac, ty_method, ty_nil, ty_param, ty_param_bound}; -use ast::{ty_path, ty_ptr, ty_rec, ty_rptr, ty_tup, ty_u32, ty_uniq, ty_vec}; -use ast::{unsafe_blk, unsafe_fn, variant, view_item, view_item_}; -use ast::{view_item_export, view_item_import, view_item_use, view_path}; -use ast::{view_path_glob, view_path_list, view_path_simple, visibility}; -use ast::{vstore, vstore_box, vstore_fixed, vstore_slice, vstore_uniq}; +use ast::{named_field, neg, node_id, noreturn, not, pat, pat_box, pat_enum}; +use ast::{pat_ident, pat_lit, pat_range, pat_rec, pat_region, pat_struct}; +use ast::{pat_tup, pat_uniq, pat_wild, path, private, Proto, ProtoBare}; +use ast::{ProtoBorrowed, re_self, re_anon, re_named, region, rem, required}; +use ast::{ret_style, return_val, self_ty, shl, shr, stmt, stmt_decl}; +use ast::{stmt_expr, stmt_semi, stmt_mac, struct_def, struct_field}; +use ast::{struct_immutable, struct_mutable, struct_variant_kind, subtract}; +use ast::{sty_box, sty_by_ref, sty_region, sty_static, sty_uniq, sty_value}; +use ast::{token_tree, trait_method, trait_ref, tt_delim, tt_seq, tt_tok}; +use ast::{tt_nonterminal, tuple_variant_kind, Ty, ty_, ty_bot, ty_box}; +use ast::{ty_field, ty_fixed_length_vec, ty_fn, ty_infer, ty_mac, ty_method}; +use ast::{ty_nil, ty_param, ty_param_bound, ty_path, ty_ptr, ty_rec, ty_rptr}; +use ast::{ty_tup, ty_u32, ty_uniq, ty_vec, type_value_ns, uniq}; +use ast::{unnamed_field, unsafe_blk, unsafe_fn, variant, view_item}; +use ast::{view_item_, view_item_export, view_item_import, view_item_use}; +use ast::{view_path, view_path_glob, view_path_list, view_path_simple}; +use ast::{visibility, vstore, vstore_box, vstore_fixed, vstore_slice}; +use ast::{vstore_uniq}; use ast; use ast_util::{spanned, respan, mk_sp, ident_to_path, operator_prec}; use ast_util; @@ -69,6 +72,7 @@ use parse::token::{can_begin_expr, is_ident, is_ident_or_path}; use parse::token::{is_plain_ident, INTERPOLATED, special_idents}; use parse::token; +use parse::{new_sub_parser_from_file, next_node_id, parse_sess}; use print::pprust::expr_to_str; use util::interner::Interner; diff --git a/src/libsyntax/parse/prec.rs b/src/libsyntax/parse/prec.rs index 4663b875bb5..10754777129 100644 --- a/src/libsyntax/parse/prec.rs +++ b/src/libsyntax/parse/prec.rs @@ -12,9 +12,11 @@ export unop_prec; export token_to_binop; +use ast::*; use parse::token::*; use parse::token::Token; -use ast::*; + +use core::prelude::*; /// Unary operators have higher precedence than binary const unop_prec: uint = 100u; diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index f286b15c752..606247b8cbe 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast; use ast_util; use parse::token; diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index c9d2abfe0cb..b3b267027ce 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use core::cmp; use core::dvec::DVec; use core::io::WriterUtil; diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 239cff22cc0..c121bc30b96 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast::{required, provided}; use ast; use ast_util; @@ -16,9 +18,9 @@ use codemap::{CodeMap, BytePos}; use codemap; use diagnostic; -use parse::classify::*; +use parse::classify::{expr_is_simple_block, expr_requires_semi_to_be_stmt}; +use parse::classify::{stmt_ends_with_semi}; use parse::token::ident_interner; -use parse::token; use parse::{comments, lexer, token}; use parse; use print::pp::{break_offset, word, printer, space, zerobreak, hardbreak}; diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index cfa3a4224c5..fd759a32941 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -11,12 +11,12 @@ // An "interner" is a data structure that associates values with uint tags and // allows bidirectional lookup; i.e. given a value, one can easily find the // type, and vice versa. -use std::map; + +use core::prelude::*; + +use core::dvec::DVec; use std::map::HashMap; -use dvec::DVec; -use cmp::Eq; -use hash::Hash; -use to_bytes::IterBytes; +use std::map; type hash_interner = {map: HashMap, diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index b7d894a7e9f..3f7ba2dc37b 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast::*; use ast; use ast_util; diff --git a/src/test/bench/task-perf-word-count-generic.rs b/src/test/bench/task-perf-word-count-generic.rs index e24979a4e06..b0be34508b3 100644 --- a/src/test/bench/task-perf-word-count-generic.rs +++ b/src/test/bench/task-perf-word-count-generic.rs @@ -45,9 +45,9 @@ trait word_reader { fn read_word() -> Option<~str>; } -// These used to be in task, but they disappeard. -type joinable_task = Port<()>; -fn spawn_joinable(+f: fn~()) -> joinable_task { +// These used to be in task, but they disappeared. +pub type joinable_task = Port<()>; +pub fn spawn_joinable(+f: fn~()) -> joinable_task { let p = Port(); let c = Chan(&p); do task::spawn() |move f| { @@ -57,7 +57,7 @@ fn spawn_joinable(+f: fn~()) -> joinable_task { p } -fn join(t: joinable_task) { +pub fn join(t: joinable_task) { t.recv() } @@ -90,11 +90,11 @@ fn reduce(word: &~str, get: map_reduce::getter) { io::println(fmt!("%s\t%?", *word, count)); } -struct box { +pub struct box { mut contents: Option, } -impl box { +pub impl box { fn swap(f: fn(+v: T) -> T) { let mut tmp = None; self.contents <-> tmp; @@ -108,13 +108,16 @@ fn unwrap() -> T { } } -fn box(+x: T) -> box { +pub fn box(+x: T) -> box { box { contents: Some(move x) } } mod map_reduce { + use core::oldcomm::*; + + use std::map::HashMap; use std::map; pub type putter = fn(&K, V); @@ -126,7 +129,7 @@ mod map_reduce { pub type reducer = fn~(&K, getter); enum ctrl_proto { - find_reducer(K, Chan>>), + find_reducer(K, Chan>>), mapper_done } @@ -138,26 +141,32 @@ enum ctrl_proto { } reducer_response: recv { - reducer(Chan>) -> open + reducer(::core::oldcomm::Chan<::map_reduce::reduce_proto>) + -> open } ) - enum reduce_proto { emit_val(V), done, addref, release } + pub enum reduce_proto { + emit_val(V), + done, + addref, + release + } fn start_mappers( map: &mapper, ctrls: &mut ~[ctrl_proto::server::open], inputs: &~[K1]) - -> ~[joinable_task] + -> ~[::joinable_task] { let mut tasks = ~[]; for inputs.each |i| { let (ctrl, ctrl_server) = ctrl_proto::init(); - let ctrl = box(move ctrl); + let ctrl = ::box(move ctrl); let i = copy *i; let m = copy *map; - tasks.push(spawn_joinable(|move ctrl, move i| map_task(copy m, &ctrl, i))); + tasks.push(::spawn_joinable(|move ctrl, move i| map_task(copy m, &ctrl, i))); ctrls.push(move ctrl_server); } move tasks @@ -165,16 +174,16 @@ fn start_mappers( map: mapper, - ctrl: &box>, + ctrl: &::box>, input: K1) { // log(error, "map_task " + input); - let intermediates: HashMap>> + let intermediates: HashMap>> = map::HashMap(); do map(input) |key: &K2, val| { let mut c = None; - let found: Option>> + let found: Option>> = intermediates.find(*key); match found { Some(_c) => { c = Some(_c); } @@ -195,7 +204,8 @@ fn map_task(_k: K, v: Chan>) + fn finish( + _k: K, v: Chan<::map_reduce::reduce_proto>) { send(v, release); } @@ -206,7 +216,7 @@ fn finish(_k: K, v: Chan>) fn reduce_task( reduce: ~reducer, key: K, - out: Chan>>) + out: Chan>>) { let p = Port(); @@ -215,7 +225,7 @@ fn reduce_task( let mut ref_count = 0; let mut is_done = false; - fn get(p: Port>, + fn get(p: Port<::map_reduce::reduce_proto>, ref_count: &mut int, is_done: &mut bool) -> Option { while !*is_done || *ref_count > 0 { @@ -274,7 +284,7 @@ pub fn map_reduce (util::NonCopyable, - fn@() -> util::NonCopyable) { - let f = fn@(copy x) -> util::NonCopyable { +fn closure2(+x: core::util::NonCopyable) + -> (core::util::NonCopyable, fn@() -> core::util::NonCopyable) { + let f = fn@(copy x) -> core::util::NonCopyable { //~^ ERROR copying a noncopyable value //~^^ NOTE non-copyable value cannot be copied into a @fn closure copy x @@ -18,7 +18,7 @@ fn closure2(+x: util::NonCopyable) -> (util::NonCopyable, }; (move x,f) } -fn closure3(+x: util::NonCopyable) { +fn closure3(+x: core::util::NonCopyable) { do task::spawn |copy x| { //~^ ERROR copying a noncopyable value //~^^ NOTE non-copyable value cannot be copied into a ~fn closure diff --git a/src/test/compile-fail/issue-2718-a.rs b/src/test/compile-fail/issue-2718-a.rs index 8acabc6bdc1..2332d54037f 100644 --- a/src/test/compile-fail/issue-2718-a.rs +++ b/src/test/compile-fail/issue-2718-a.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct send_packet { +pub struct send_packet { p: T } mod pingpong { - #[legacy_exports]; - type ping = send_packet; - enum pong = send_packet; //~ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable + use send_packet; + pub type ping = send_packet; + pub enum pong = send_packet; //~ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable } fn main() {} diff --git a/src/test/run-pass/export-non-interference2.rs b/src/test/run-pass/export-non-interference2.rs index 464acfba934..25a4c29244c 100644 --- a/src/test/run-pass/export-non-interference2.rs +++ b/src/test/run-pass/export-non-interference2.rs @@ -9,16 +9,11 @@ // except according to those terms. mod foo { - #[legacy_exports]; - - export bar; - mod bar { - #[legacy_exports]; - fn y() { x(); } + pub fn y() { ::foo::x(); } } - fn x() { debug!("x"); } + pub fn x() { debug!("x"); } } fn main() { foo::bar::y(); } diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 577ac67dd6a..6232f0c6e06 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -20,16 +20,20 @@ use std::map; use std::map::HashMap; -use oldcomm::Chan; -use oldcomm::Port; -use oldcomm::send; -use oldcomm::recv; +use core::oldcomm::Chan; +use core::oldcomm::Port; +use core::oldcomm::send; +use core::oldcomm::recv; -fn map(filename: ~str, emit: map_reduce::putter) { emit(filename, ~"1"); } +pub fn map(filename: ~str, emit: map_reduce::putter) { emit(filename, ~"1"); } mod map_reduce { use std::map; use std::map::HashMap; + use core::oldcomm::Chan; + use core::oldcomm::Port; + use core::oldcomm::send; + use core::oldcomm::recv; pub type putter = fn@(~str, ~str); @@ -64,7 +68,7 @@ fn emit(im: map::HashMap<~str, int>, ctrl: Chan, key: ~str, } } - map(input, |a,b| emit(intermediates, ctrl, a, b) ); + ::map(input, |a,b| emit(intermediates, ctrl, a, b) ); send(ctrl, mapper_done); } diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index dc7d5b99d77..7c35c9e8cf1 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -250,7 +250,7 @@ pub mod client { pub fn do_ping(-c: ping) -> pong { let (sp, rp) = ::pipes::entangle(); - ::pipes::send(move c, ping(move sp)); + ::pipes::send(move c, pingpong::ping(move sp)); move rp } @@ -259,7 +259,7 @@ pub fn do_pong(-c: pong) -> (ping, ()) { if packet.is_none() { fail ~"sender closed the connection" } - (liberate_pong(option::unwrap(move packet)), ()) + (pingpong::liberate_pong(option::unwrap(move packet)), ()) } } @@ -274,12 +274,12 @@ pub fn do_ping(-c: ping) -> (pong, ()) { if packet.is_none() { fail ~"sender closed the connection" } - (liberate_ping(option::unwrap(move packet)), ()) + (pingpong::liberate_ping(option::unwrap(move packet)), ()) } pub fn do_pong(-c: pong) -> ping { let (sp, rp) = ::pipes::entangle(); - ::pipes::send(move c, pong(move sp)); + ::pipes::send(move c, pingpong::pong(move sp)); move rp } } diff --git a/src/test/run-pass/pipe-bank-proto.rs b/src/test/run-pass/pipe-bank-proto.rs index 487db85ad66..856057e10ae 100644 --- a/src/test/run-pass/pipe-bank-proto.rs +++ b/src/test/run-pass/pipe-bank-proto.rs @@ -17,14 +17,14 @@ use pipes::try_recv; -type username = ~str; -type password = ~str; -type money = float; -type amount = float; +pub type username = ~str; +pub type password = ~str; +pub type money = float; +pub type amount = float; proto! bank ( login:send { - login(username, password) -> login_response + login(::username, ::password) -> login_response } login_response:recv { @@ -33,12 +33,12 @@ } connected:send { - deposit(money) -> connected, - withdrawal(amount) -> withdrawal_response + deposit(::money) -> connected, + withdrawal(::amount) -> withdrawal_response } withdrawal_response:recv { - money(money) -> connected, + money(::money) -> connected, insufficient_funds -> connected } ) diff --git a/src/test/run-pass/pipe-pingpong-bounded.rs b/src/test/run-pass/pipe-pingpong-bounded.rs index 803f7f06b51..774e3544d89 100644 --- a/src/test/run-pass/pipe-pingpong-bounded.rs +++ b/src/test/run-pass/pipe-pingpong-bounded.rs @@ -43,6 +43,7 @@ pub fn init() -> (client::ping, server::ping) { pub enum ping = server::pong; pub enum pong = client::ping; pub mod client { + use core::pipes::*; use core::ptr; pub fn ping(+pipe: ping) -> pong { @@ -61,6 +62,7 @@ pub fn ping(+pipe: ping) -> pong { ::pingpong::packets>; } pub mod server { + use core::pipes::*; use core::ptr; pub type ping = pipes::RecvPacketBuffered<::pingpong::ping, diff --git a/src/test/run-pass/pipe-presentation-examples.rs b/src/test/run-pass/pipe-presentation-examples.rs index 173325834c0..0fe845dd1f9 100644 --- a/src/test/run-pass/pipe-presentation-examples.rs +++ b/src/test/run-pass/pipe-presentation-examples.rs @@ -75,12 +75,12 @@ ) // Types and protocols -struct Buffer { +pub struct Buffer { foo: (), } -impl Buffer : Drop { +pub impl Buffer : Drop { fn finalize(&self) {} } @@ -90,11 +90,11 @@ fn finalize(&self) {} } wait_buffer:recv { - give_buffer(Buffer) -> release + give_buffer(::Buffer) -> release } release:send { - release(Buffer) -> acquire + release(::Buffer) -> acquire } ) diff --git a/src/test/run-pass/reflect-visit-data.rs b/src/test/run-pass/reflect-visit-data.rs index cdc23aef944..3e66c18d58b 100644 --- a/src/test/run-pass/reflect-visit-data.rs +++ b/src/test/run-pass/reflect-visit-data.rs @@ -11,6 +11,7 @@ // xfail-fast #[legacy_modes]; +use core::bool; use intrinsic::{TyDesc, get_tydesc, visit_tydesc, TyVisitor}; use libc::c_void; use vec::UnboxedVecRepr; diff --git a/src/test/run-pass/static-impl.rs b/src/test/run-pass/static-impl.rs index 2003a12ea0c..6987dfab1b5 100644 --- a/src/test/run-pass/static-impl.rs +++ b/src/test/run-pass/static-impl.rs @@ -11,20 +11,18 @@ // xfail-fast #[legacy_modes]; -use a::*; - -trait plus { +pub trait plus { fn plus() -> int; } mod a { - #[legacy_exports]; - impl uint: plus { fn plus() -> int { self as int + 20 } } + use plus; + pub impl uint: plus { fn plus() -> int { self as int + 20 } } } mod b { - #[legacy_exports]; - impl ~str: plus { fn plus() -> int { 200 } } + use plus; + pub impl ~str: plus { fn plus() -> int { 200 } } } trait uint_utils { -- GitLab