From 57c599914a19861686030b238a0edc7ebb996068 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Sun, 23 Dec 2012 17:41:37 -0500 Subject: [PATCH] librustc: Terminate name searches at the nearest module scope for paths that contain at least two components. r=graydon --- src/driver/driver.rs | 12 +- src/libcargo/pgp.rs | 3 + src/libcore/at_vec.rs | 16 +- src/libcore/bool.rs | 1 + src/libcore/char.rs | 4 + src/libcore/condition.rs | 2 + src/libcore/core.rc | 2 +- src/libcore/dlist.rs | 4 + src/libcore/dvec.rs | 2 + src/libcore/either.rs | 3 + src/libcore/extfmt.rs | 12 +- src/libcore/f32.rs | 3 + src/libcore/f64.rs | 5 + src/libcore/flate.rs | 3 + src/libcore/float.rs | 9 +- src/libcore/gc.rs | 11 +- src/libcore/hash.rs | 7 +- src/libcore/int-template.rs | 6 + src/libcore/int-template/i16.rs | 4 +- src/libcore/int-template/i32.rs | 2 +- src/libcore/int-template/i64.rs | 4 +- src/libcore/int-template/i8.rs | 4 +- src/libcore/int-template/int.rs | 2 +- src/libcore/io.rs | 12 + src/libcore/iter-trait.rs | 1 + src/libcore/iter-trait/dlist.rs | 6 +- src/libcore/iter-trait/dvec.rs | 4 +- src/libcore/iter.rs | 1 + src/libcore/logging.rs | 4 + src/libcore/managed.rs | 1 + src/libcore/oldcomm.rs | 7 + src/libcore/option.rs | 2 + src/libcore/os.rs | 41 +- src/libcore/path.rs | 13 + src/libcore/pipes.rs | 7 + src/libcore/private.rs | 10 +- src/libcore/ptr.rs | 3 + src/libcore/rand.rs | 8 + src/libcore/reflect.rs | 2 + src/libcore/repr.rs | 23 +- src/libcore/result.rs | 3 + src/libcore/rt.rs | 7 +- src/libcore/run.rs | 13 +- src/libcore/send_map.rs | 6 + src/libcore/str.rs | 14 + src/libcore/sys.rs | 8 + src/libcore/task/local_data.rs | 8 +- src/libcore/task/local_data_priv.rs | 5 + src/libcore/task/mod.rs | 5 + src/libcore/task/rt.rs | 2 + src/libcore/task/spawn.rs | 8 + src/libcore/to_bytes.rs | 2 + src/libcore/to_str.rs | 35 +- src/libcore/tuple.rs | 1 + src/libcore/uint-template.rs | 5 + src/libcore/uint-template/uint.rs | 2 + src/libcore/vec.rs | 24 +- src/librustc/back/link.rs | 55 ++- src/librustc/back/rpath.rs | 13 +- src/librustc/back/x86.rs | 3 +- src/librustc/back/x86_64.rs | 3 +- src/librustc/driver/driver.rs | 56 ++- src/librustc/driver/session.rs | 9 +- src/librustc/front/config.rs | 3 + src/librustc/front/core_inject.rs | 74 ++-- src/librustc/front/intrinsic_inject.rs | 6 +- src/librustc/front/test.rs | 17 +- src/librustc/lib/llvm.rs | 21 +- src/librustc/metadata/creader.rs | 35 +- src/librustc/metadata/csearch.rs | 5 +- src/librustc/metadata/cstore.rs | 10 +- src/librustc/metadata/decoder.rs | 12 +- src/librustc/metadata/encoder.rs | 48 ++- src/librustc/metadata/filesearch.rs | 7 +- src/librustc/metadata/loader.rs | 22 +- src/librustc/metadata/tydecode.rs | 4 + src/librustc/metadata/tyencode.rs | 10 +- src/librustc/middle/astencode.rs | 5 +- src/librustc/middle/borrowck/check_loans.rs | 10 +- src/librustc/middle/borrowck/gather_loans.rs | 9 +- src/librustc/middle/borrowck/loan.rs | 6 +- src/librustc/middle/borrowck/mod.rs | 7 +- src/librustc/middle/borrowck/preserve.rs | 4 + src/librustc/middle/capture.rs | 11 +- src/librustc/middle/check_alt.rs | 9 +- src/librustc/middle/check_const.rs | 14 +- src/librustc/middle/check_loop.rs | 2 + src/librustc/middle/const_eval.rs | 7 + src/librustc/middle/freevars.rs | 11 +- src/librustc/middle/kind.rs | 11 +- src/librustc/middle/lang_items.rs | 1 + src/librustc/middle/lint.rs | 43 ++- src/librustc/middle/liveness.rs | 12 +- src/librustc/middle/mem_categorization.rs | 14 +- src/librustc/middle/pat_util.rs | 6 +- src/librustc/middle/privacy.rs | 13 +- src/librustc/middle/region.rs | 5 +- src/librustc/middle/resolve.rs | 353 +++++++++++++----- src/librustc/middle/trans/alt.rs | 11 +- src/librustc/middle/trans/base.rs | 23 ++ src/librustc/middle/trans/build.rs | 4 + src/librustc/middle/trans/callee.rs | 6 + src/librustc/middle/trans/closure.rs | 4 + src/librustc/middle/trans/common.rs | 56 ++- src/librustc/middle/trans/consts.rs | 4 + src/librustc/middle/trans/controlflow.rs | 3 + src/librustc/middle/trans/datum.rs | 11 +- src/librustc/middle/trans/debuginfo.rs | 6 + src/librustc/middle/trans/expr.rs | 8 + src/librustc/middle/trans/foreign.rs | 11 +- src/librustc/middle/trans/glue.rs | 8 + src/librustc/middle/trans/inline.rs | 5 + src/librustc/middle/trans/machine.rs | 6 +- src/librustc/middle/trans/meth.rs | 8 + src/librustc/middle/trans/monomorphize.rs | 11 + src/librustc/middle/trans/reachable.rs | 15 +- src/librustc/middle/trans/reflect.rs | 4 + src/librustc/middle/trans/shape.rs | 12 +- src/librustc/middle/trans/tvec.rs | 4 + src/librustc/middle/trans/type_of.rs | 5 +- src/librustc/middle/trans/type_use.rs | 5 + src/librustc/middle/trans/uniq.rs | 3 + src/librustc/middle/ty.rs | 85 +++-- src/librustc/middle/typeck/astconv.rs | 6 + src/librustc/middle/typeck/check/alt.rs | 10 +- src/librustc/middle/typeck/check/demand.rs | 5 + src/librustc/middle/typeck/check/method.rs | 8 + src/librustc/middle/typeck/check/mod.rs | 26 +- src/librustc/middle/typeck/check/regionck.rs | 4 + .../middle/typeck/check/regionmanip.rs | 2 + src/librustc/middle/typeck/check/vtable.rs | 9 + src/librustc/middle/typeck/check/writeback.rs | 8 +- src/librustc/middle/typeck/coherence.rs | 15 +- src/librustc/middle/typeck/collect.rs | 15 +- .../middle/typeck/infer/assignment.rs | 4 + src/librustc/middle/typeck/infer/combine.rs | 4 + src/librustc/middle/typeck/infer/floating.rs | 4 + src/librustc/middle/typeck/infer/glb.rs | 2 + src/librustc/middle/typeck/infer/integral.rs | 4 + src/librustc/middle/typeck/infer/lattice.rs | 1 + src/librustc/middle/typeck/infer/lub.rs | 3 + src/librustc/middle/typeck/infer/mod.rs | 2 + .../middle/typeck/infer/region_inference.rs | 6 + src/librustc/middle/typeck/infer/resolve.rs | 6 + src/librustc/middle/typeck/infer/sub.rs | 1 + src/librustc/middle/typeck/infer/to_str.rs | 6 +- src/librustc/middle/typeck/infer/unify.rs | 4 + src/librustc/middle/typeck/mod.rs | 7 +- src/librustc/middle/typeck/rscope.rs | 4 + src/librustc/rustc.rc | 8 +- src/librustc/util/common.rs | 7 +- src/librustc/util/ppaux.rs | 5 +- src/librustdoc/astsrv.rs | 5 + src/librustdoc/attr_parser.rs | 6 +- src/librustdoc/attr_pass.rs | 8 + src/librustdoc/config.rs | 7 +- src/librustdoc/desc_to_brief_pass.rs | 7 + src/librustdoc/doc.rs | 6 + src/librustdoc/escape_pass.rs | 4 + src/librustdoc/extract.rs | 10 +- src/librustdoc/fold.rs | 5 + src/librustdoc/markdown_index_pass.rs | 9 + src/librustdoc/markdown_pass.rs | 10 + src/librustdoc/markdown_writer.rs | 15 +- src/librustdoc/page_pass.rs | 12 +- src/librustdoc/pass.rs | 5 + src/librustdoc/path_pass.rs | 4 + src/librustdoc/prune_hidden_pass.rs | 6 + src/librustdoc/prune_private_pass.rs | 8 +- src/librustdoc/sectionalize_pass.rs | 6 + src/librustdoc/sort_item_name_pass.rs | 4 + src/librustdoc/sort_item_type_pass.rs | 4 + src/librustdoc/sort_pass.rs | 6 +- src/librustdoc/text_pass.rs | 5 + src/librustdoc/trim_pass.rs | 4 + src/librustdoc/tystr_pass.rs | 11 +- src/librustdoc/unindent_pass.rs | 7 + src/librustdoc/util.rs | 3 + src/libstd/arc.rs | 15 +- src/libstd/arena.rs | 14 +- src/libstd/base64.rs | 6 +- src/libstd/bitv.rs | 5 +- src/libstd/c_vec.rs | 6 + src/libstd/cell.rs | 3 + src/libstd/cmp.rs | 4 + src/libstd/comm.rs | 5 +- src/libstd/dbg.rs | 5 +- src/libstd/deque.rs | 8 +- src/libstd/ebml.rs | 20 +- src/libstd/flatpipes.rs | 54 +-- src/libstd/fun_treemap.rs | 3 +- src/libstd/future.rs | 9 +- src/libstd/getopts.rs | 7 + src/libstd/json.rs | 14 +- src/libstd/list.rs | 4 +- src/libstd/map.rs | 26 +- src/libstd/md4.rs | 4 + src/libstd/net_ip.rs | 19 + src/libstd/net_tcp.rs | 34 +- src/libstd/net_url.rs | 22 +- src/libstd/par.rs | 6 + src/libstd/prettyprint.rs | 14 +- src/libstd/priority_queue.rs | 3 +- src/libstd/rl.rs | 6 +- src/libstd/rope.rs | 29 +- src/libstd/serialize.rs | 3 + src/libstd/sha1.rs | 4 + src/libstd/smallintmap.rs | 7 +- src/libstd/sort.rs | 6 +- src/libstd/std.rc | 4 +- src/libstd/sync.rs | 8 +- src/libstd/task_pool.rs | 7 +- src/libstd/tempfile.rs | 5 +- src/libstd/term.rs | 7 +- src/libstd/test.rs | 23 +- src/libstd/time.rs | 10 +- src/libstd/timer.rs | 16 +- src/libstd/uv_global_loop.rs | 11 +- src/libstd/uv_iotask.rs | 11 +- src/libstd/uv_ll.rs | 10 +- src/libstd/workcache.rs | 14 +- src/libsyntax/ast.rs | 9 +- src/libsyntax/ast_map.rs | 17 +- src/libsyntax/ast_util.rs | 18 +- src/libsyntax/attr.rs | 18 +- src/libsyntax/codemap.rs | 9 +- src/libsyntax/diagnostic.rs | 11 +- src/libsyntax/ext/auto_encode.rs | 31 +- src/libsyntax/ext/base.rs | 16 +- src/libsyntax/ext/build.rs | 29 ++ src/libsyntax/ext/concat_idents.rs | 1 + src/libsyntax/ext/deriving.rs | 10 +- src/libsyntax/ext/env.rs | 6 + src/libsyntax/ext/expand.rs | 27 +- src/libsyntax/ext/fmt.rs | 23 +- src/libsyntax/ext/log_syntax.rs | 8 +- src/libsyntax/ext/pipes/ast_builder.rs | 19 + src/libsyntax/ext/pipes/check.rs | 3 +- src/libsyntax/ext/pipes/liveness.rs | 1 + src/libsyntax/ext/pipes/mod.rs | 11 +- src/libsyntax/ext/pipes/pipec.rs | 95 ++--- src/libsyntax/ext/pipes/proto.rs | 8 +- src/libsyntax/ext/quote.rs | 35 +- src/libsyntax/ext/source_util.rs | 11 +- src/libsyntax/ext/trace_macros.rs | 2 + src/libsyntax/ext/tt/macro_parser.rs | 26 +- src/libsyntax/ext/tt/macro_rules.rs | 29 +- src/libsyntax/ext/tt/transcribe.rs | 10 +- src/libsyntax/fold.rs | 6 +- src/libsyntax/parse/attr.rs | 5 +- src/libsyntax/parse/classify.rs | 1 + src/libsyntax/parse/comments.rs | 19 +- src/libsyntax/parse/common.rs | 8 +- src/libsyntax/parse/lexer.rs | 17 +- src/libsyntax/parse/mod.rs | 23 +- src/libsyntax/parse/obsolete.rs | 9 +- src/libsyntax/parse/parser.rs | 141 +++---- src/libsyntax/parse/token.rs | 13 +- src/libsyntax/print/pp.rs | 8 +- src/libsyntax/print/pprust.rs | 28 +- src/libsyntax/syntax.rc | 8 +- src/libsyntax/visit.rs | 7 +- src/test/run-pass/super.rs | 12 + 263 files changed, 2545 insertions(+), 795 deletions(-) create mode 100644 src/test/run-pass/super.rs diff --git a/src/driver/driver.rs b/src/driver/driver.rs index 5801c23f814..0c1cc566fe2 100644 --- a/src/driver/driver.rs +++ b/src/driver/driver.rs @@ -12,18 +12,18 @@ extern mod core(vers = "0.6"); #[cfg(cargo)] -extern mod self(name = "cargo", vers = "0.6"); +extern mod this(name = "cargo", vers = "0.6"); #[cfg(fuzzer)] -extern mod self(name = "fuzzer", vers = "0.6"); +extern mod this(name = "fuzzer", vers = "0.6"); #[cfg(rustdoc)] -extern mod self(name = "rustdoc", vers = "0.6"); +extern mod this(name = "rustdoc", vers = "0.6"); #[cfg(rusti)] -extern mod self(name = "rusti", vers = "0.6"); +extern mod this(name = "rusti", vers = "0.6"); #[cfg(rustc)] -extern mod self(name = "rustc", vers = "0.6"); +extern mod this(name = "rustc", vers = "0.6"); -fn main() { self::main() } \ No newline at end of file +fn main() { this::main() } diff --git a/src/libcargo/pgp.rs b/src/libcargo/pgp.rs index 6659ed031ca..e05260bace2 100644 --- a/src/libcargo/pgp.rs +++ b/src/libcargo/pgp.rs @@ -8,6 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::os; +use core::run; + fn gpgv(args: ~[~str]) -> { status: int, out: ~str, err: ~str } { return run::program_output(~"gpgv", args); } diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs index dc5faf49ea4..0aa4fd68d57 100644 --- a/src/libcore/at_vec.rs +++ b/src/libcore/at_vec.rs @@ -15,13 +15,18 @@ #[forbid(deprecated_pattern)]; use cast::transmute; +use iter; +use libc; use ptr::addr_of; +use sys; +use uint; +use vec; /// Code for dealing with @-vectors. This is pretty incomplete, and /// contains a bunch of duplication from the code for ~-vectors. #[abi = "cdecl"] -extern mod rustrt { +pub extern mod rustrt { #[legacy_exports]; fn vec_reserve_shared_actual(++t: *sys::TypeDesc, ++v: **vec::raw::VecRepr, @@ -29,7 +34,7 @@ extern mod rustrt { } #[abi = "rust-intrinsic"] -extern mod rusti { +pub extern mod rusti { #[legacy_exports]; fn move_val_init(dst: &mut T, -src: T); } @@ -157,6 +162,13 @@ pub mod traits { pub mod traits {} pub mod raw { + use at_vec::{rusti, rustrt}; + use libc; + use ptr; + use sys; + use uint; + use vec; + pub type VecRepr = vec::raw::VecRepr; pub type SliceRepr = vec::raw::SliceRepr; diff --git a/src/libcore/bool.rs b/src/libcore/bool.rs index 6d2ed9b423e..370c9bb4404 100644 --- a/src/libcore/bool.rs +++ b/src/libcore/bool.rs @@ -16,6 +16,7 @@ //! Boolean logic +use cmp; use cmp::Eq; /// Negation / inverse diff --git a/src/libcore/char.rs b/src/libcore/char.rs index f16268c3458..79ce8d35858 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -15,6 +15,10 @@ #[forbid(deprecated_pattern)]; use cmp::Eq; +use str; +use u32; +use uint; +use unicode; /* Lu Uppercase_Letter an uppercase letter diff --git a/src/libcore/condition.rs b/src/libcore/condition.rs index df8063772a6..1d934b9af14 100644 --- a/src/libcore/condition.rs +++ b/src/libcore/condition.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use task; + // helper for transmutation, shown below. type RustClosure = (int,int); pub struct Handler { diff --git a/src/libcore/core.rc b/src/libcore/core.rc index bac6bae90a0..8806f31c66a 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -235,7 +235,7 @@ mod stackwalk; // 'core' so that macro-expanded references to core::error and such // can be resolved within libcore. #[doc(hidden)] // FIXME #3538 -mod core { +pub mod core { pub const error : u32 = 1_u32; pub const warn : u32 = 2_u32; pub const info : u32 = 3_u32; diff --git a/src/libcore/dlist.rs b/src/libcore/dlist.rs index 35ff98ac17d..e4b18646b32 100644 --- a/src/libcore/dlist.rs +++ b/src/libcore/dlist.rs @@ -22,6 +22,10 @@ Do not use ==, !=, <, etc on doubly-linked lists -- it may not terminate. #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; +use managed; +use option; +use vec; + type DListLink = Option>; enum DListNode = @{ diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs index 236d6bce9f0..dd6b0721121 100644 --- a/src/libcore/dvec.rs +++ b/src/libcore/dvec.rs @@ -23,8 +23,10 @@ Note that recursive use is not permitted. #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; +use cast; use cast::reinterpret_cast; use ptr::null; +use vec; /** * A growable, modifiable vector type that accumulates elements into a diff --git a/src/libcore/either.rs b/src/libcore/either.rs index 6c0254ff779..866232dc49c 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -14,8 +14,11 @@ //! A type that represents one of two alternatives +use cmp; use cmp::Eq; +use result; use result::Result; +use vec; /// The either type #[deriving_eq] diff --git a/src/libcore/extfmt.rs b/src/libcore/extfmt.rs index 1c9ad6ba81a..5d7e0306b06 100644 --- a/src/libcore/extfmt.rs +++ b/src/libcore/extfmt.rs @@ -82,7 +82,7 @@ debug!("hello, %s!", "world"); use cmp::Eq; use option::{Some, None}; - +use str; /* * We have a 'ct' (compile-time) module that parses format strings into a @@ -98,6 +98,10 @@ use option::{Some, None}; // Functions used by the fmt extension at compile time #[doc(hidden)] pub mod ct { + use char; + use str; + use vec; + pub enum Signedness { Signed, Unsigned, } pub enum Caseness { CaseUpper, CaseLower, } pub enum Ty { @@ -332,6 +336,12 @@ pub mod ct { // implement it 0this way, I think. #[doc(hidden)] pub mod rt { + use float; + use str; + use sys; + use uint; + use vec; + pub const flag_none : u32 = 0u32; pub const flag_left_justify : u32 = 0b00000000000001u32; pub const flag_left_zero_pad : u32 = 0b00000000000010u32; diff --git a/src/libcore/f32.rs b/src/libcore/f32.rs index 5e34c7c5530..ce90f757769 100644 --- a/src/libcore/f32.rs +++ b/src/libcore/f32.rs @@ -14,6 +14,9 @@ //! Operations and constants for `f32` +use cmp; +use num; + pub use cmath::c_float_utils::*; pub use cmath::c_float_targ_consts::*; diff --git a/src/libcore/f64.rs b/src/libcore/f64.rs index 2e35d0360b6..97d9e8e7584 100644 --- a/src/libcore/f64.rs +++ b/src/libcore/f64.rs @@ -14,6 +14,11 @@ //! Operations and constants for `f64` +use cmath; +use cmp; +use libc; +use num; + pub use cmath::c_double_utils::*; pub use cmath::c_double_targ_consts::*; diff --git a/src/libcore/flate.rs b/src/libcore/flate.rs index 506937f053f..a6d568c5892 100644 --- a/src/libcore/flate.rs +++ b/src/libcore/flate.rs @@ -18,7 +18,10 @@ Simple compression #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; +use libc; use libc::{c_void, size_t, c_int}; +use ptr; +use vec; extern mod rustrt { fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void, diff --git a/src/libcore/float.rs b/src/libcore/float.rs index 02ba4419bcc..2f8422fa4f7 100644 --- a/src/libcore/float.rs +++ b/src/libcore/float.rs @@ -26,6 +26,13 @@ use m_float = f64; +use cmp::{Eq, Ord}; +use f64; +use num; +use num::Num::from_int; +use str; +use uint; + pub use f64::{add, sub, mul, div, rem, lt, le, eq, ne, ge, gt}; pub use f64::logarithm; pub use f64::{acos, asin, atan2, cbrt, ceil, copysign, cosh, floor}; @@ -35,8 +42,6 @@ pub use f64::{lgamma, ln, log_radix, ln1p, log10, log2, ilog_radix}; pub use f64::{modf, pow, round, sinh, tanh, tgamma, trunc}; pub use f64::signbit; pub use f64::{j0, j1, jn, y0, y1, yn}; -use cmp::{Eq, Ord}; -use num::Num::from_int; pub const NaN: float = 0.0/0.0; diff --git a/src/libcore/gc.rs b/src/libcore/gc.rs index 81936d17774..89f5a4eb8f0 100644 --- a/src/libcore/gc.rs +++ b/src/libcore/gc.rs @@ -39,10 +39,15 @@ with destructors. #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; -pub use stackwalk::Word; -use libc::size_t; -use libc::uintptr_t; +use cast; +use io; +use libc::{size_t, uintptr_t}; +use ptr; use send_map::linear::LinearMap; +use stackwalk; +use sys; + +pub use stackwalk::Word; // Mirrors rust_stack.h stk_seg struct StackSegment { diff --git a/src/libcore/hash.rs b/src/libcore/hash.rs index 5331019e5f3..d3d6c5ae242 100644 --- a/src/libcore/hash.rs +++ b/src/libcore/hash.rs @@ -23,9 +23,12 @@ * CPRNG like rand::rng. */ -use io::Writer; -use io::WriterUtil; +use io; +use io::{Writer, WriterUtil}; +use os; use to_bytes::IterBytes; +use uint; +use vec; /** * Types that can meaningfully be hashed should implement this. diff --git a/src/libcore/int-template.rs b/src/libcore/int-template.rs index c3fe24fff32..3d65c65221e 100644 --- a/src/libcore/int-template.rs +++ b/src/libcore/int-template.rs @@ -14,9 +14,15 @@ use T = self::inst::T; +use char; use cmp::{Eq, Ord}; use from_str::FromStr; +use iter; +use num; use num::Num::from_int; +use str; +use uint; +use vec; pub const bits : uint = inst::bits; pub const bytes : uint = (inst::bits / 8); diff --git a/src/libcore/int-template/i16.rs b/src/libcore/int-template/i16.rs index 3effa40bd16..da60b567f66 100644 --- a/src/libcore/int-template/i16.rs +++ b/src/libcore/int-template/i16.rs @@ -12,5 +12,5 @@ mod inst { pub type T = i16; - pub const bits: uint = u16::bits; -} \ No newline at end of file + pub const bits: uint = ::u16::bits; +} diff --git a/src/libcore/int-template/i32.rs b/src/libcore/int-template/i32.rs index 710868fcb8d..1bc45bb71af 100644 --- a/src/libcore/int-template/i32.rs +++ b/src/libcore/int-template/i32.rs @@ -12,5 +12,5 @@ mod inst { pub type T = i32; - pub const bits: uint = u32::bits; + pub const bits: uint = ::u32::bits; } diff --git a/src/libcore/int-template/i64.rs b/src/libcore/int-template/i64.rs index 0612322dab6..83d15aa857d 100644 --- a/src/libcore/int-template/i64.rs +++ b/src/libcore/int-template/i64.rs @@ -12,5 +12,5 @@ mod inst { pub type T = i64; - pub const bits: uint = u64::bits; -} \ No newline at end of file + pub const bits: uint = ::u64::bits; +} diff --git a/src/libcore/int-template/i8.rs b/src/libcore/int-template/i8.rs index 37d7e610566..740442ed725 100644 --- a/src/libcore/int-template/i8.rs +++ b/src/libcore/int-template/i8.rs @@ -12,5 +12,5 @@ mod inst { pub type T = i8; - pub const bits: uint = u8::bits; -} \ No newline at end of file + pub const bits: uint = ::u8::bits; +} diff --git a/src/libcore/int-template/int.rs b/src/libcore/int-template/int.rs index 61a7c3bd07a..9e06cc95270 100644 --- a/src/libcore/int-template/int.rs +++ b/src/libcore/int-template/int.rs @@ -14,7 +14,7 @@ pub use self::inst::pow; mod inst { pub type T = int; - pub const bits: uint = uint::bits; + pub const bits: uint = ::uint::bits; /// Returns `base` raised to the power of `exponent` pub pure fn pow(base: int, exponent: uint) -> int { diff --git a/src/libcore/io.rs b/src/libcore/io.rs index e76eb9f2f99..1d25adb1e31 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -21,9 +21,18 @@ use result::Result; use cmp::Eq; use dvec::DVec; +use int; +use libc; use libc::{c_int, c_long, c_uint, c_void, size_t, ssize_t}; use libc::consts::os::posix88::*; use libc::consts::os::extra::*; +use option; +use os; +use ptr; +use result; +use str; +use uint; +use vec; #[allow(non_camel_case_types)] // not sure what to do about this type fd_t = c_int; @@ -1019,6 +1028,9 @@ pub fn read_whole_file(file: &Path) -> Result<~[u8], ~str> { // fsync related pub mod fsync { + use libc; + use option; + use os; pub enum Level { // whatever fsync does on that platform diff --git a/src/libcore/iter-trait.rs b/src/libcore/iter-trait.rs index 644a0fd76b7..59eb9fbae8e 100644 --- a/src/libcore/iter-trait.rs +++ b/src/libcore/iter-trait.rs @@ -16,6 +16,7 @@ #[forbid(deprecated_pattern)]; use cmp::{Eq, Ord}; +use iter; 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 ce5f775878c..42ed4b5f73c 100644 --- a/src/libcore/iter-trait/dlist.rs +++ b/src/libcore/iter-trait/dlist.rs @@ -9,6 +9,10 @@ // except according to those terms. mod inst { + use dlist; + use managed; + use option; + #[allow(non_camel_case_types)] pub type IMPL_T = dlist::DList; @@ -45,4 +49,4 @@ mod inst { pub pure fn SIZE_HINT(self: &IMPL_T) -> Option { Some(self.len()) } -} \ No newline at end of file +} diff --git a/src/libcore/iter-trait/dvec.rs b/src/libcore/iter-trait/dvec.rs index 9b7016c17d5..f338578d143 100644 --- a/src/libcore/iter-trait/dvec.rs +++ b/src/libcore/iter-trait/dvec.rs @@ -9,6 +9,8 @@ // except according to those terms. mod inst { + use dvec; + #[allow(non_camel_case_types)] pub type IMPL_T = dvec::DVec; @@ -29,4 +31,4 @@ mod inst { pub pure fn SIZE_HINT(self: &IMPL_T) -> Option { Some(self.len()) } -} \ No newline at end of file +} diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index a9b3401aa6f..aa966070980 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -18,6 +18,7 @@ The iteration traits and common implementation #[forbid(deprecated_pattern)]; use cmp::{Eq, Ord}; +use vec; /// A function used to initialize the elements of a sequence pub type InitOp = &fn(uint) -> T; diff --git a/src/libcore/logging.rs b/src/libcore/logging.rs index d8bcab62b8f..cb8f2b70886 100644 --- a/src/libcore/logging.rs +++ b/src/libcore/logging.rs @@ -15,6 +15,10 @@ #[forbid(deprecated_pattern)]; use cast::transmute; +use io; +use libc; +use repr; +use vec; #[nolink] extern mod rustrt { diff --git a/src/libcore/managed.rs b/src/libcore/managed.rs index bc6a56868a5..5bbb5f6bec2 100644 --- a/src/libcore/managed.rs +++ b/src/libcore/managed.rs @@ -16,6 +16,7 @@ use cmp::{Eq, Ord}; use intrinsic::TyDesc; +use ptr; pub mod raw { pub struct BoxHeaderRepr { diff --git a/src/libcore/oldcomm.rs b/src/libcore/oldcomm.rs index a5b0336ab60..9206f78b915 100644 --- a/src/libcore/oldcomm.rs +++ b/src/libcore/oldcomm.rs @@ -46,8 +46,15 @@ will once again be the preferred module for intertask communication. #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; +use cast; +use either; use either::Either; +use libc; use libc::size_t; +use ptr; +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 a4f385ea12c..747b0a45501 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -45,6 +45,8 @@ let unwrapped_msg = match move msg { #[forbid(deprecated_pattern)]; use cmp::Eq; +use option; +use util; /// The option type #[deriving_eq] diff --git a/src/libcore/os.rs b/src/libcore/os.rs index b5e0983a420..4fe2050574d 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -30,14 +30,24 @@ * to write OS-ignorant code by default. */ -use libc::{c_char, c_void, c_int, c_uint, size_t, ssize_t, - mode_t, pid_t, FILE}; -pub use libc::{close, fclose}; - +use cast; +use either; +use io; +use libc; +use libc::{c_char, c_void, c_int, c_uint, size_t, ssize_t}; +use libc::{mode_t, pid_t, FILE}; +use option; use option::{Some, None}; - -pub use os::consts::*; +use private; +use ptr; +use str; +use task; use task::TaskBuilder; +use uint; +use vec; + +pub use libc::{close, fclose}; +pub use os::consts::*; // FIXME: move these to str perhaps? #2620 @@ -127,6 +137,12 @@ pub fn env() -> ~[(~str,~str)] { mod global_env { //! Internal module for serializing access to getenv/setenv + use either; + use libc; + use oldcomm; + use private; + use str; + use task; extern mod rustrt { fn rust_global_env_chan_ptr() -> *libc::uintptr_t; @@ -142,7 +158,7 @@ mod global_env { let env_ch = get_global_env_chan(); let po = oldcomm::Port(); oldcomm::send(env_ch, MsgGetEnv(str::from_slice(n), - oldcomm::Chan(&po))); + oldcomm::Chan(&po))); oldcomm::recv(po) } @@ -150,8 +166,8 @@ mod global_env { let env_ch = get_global_env_chan(); let po = oldcomm::Port(); oldcomm::send(env_ch, MsgSetEnv(str::from_slice(n), - str::from_slice(v), - oldcomm::Chan(&po))); + str::from_slice(v), + oldcomm::Chan(&po))); oldcomm::recv(po) } @@ -195,6 +211,13 @@ mod global_env { } mod impl_ { + use cast; + use libc; + use option; + use ptr; + use str; + use vec; + extern mod rustrt { fn rust_env_pairs() -> ~[~str]; } diff --git a/src/libcore/path.rs b/src/libcore/path.rs index 65ed3515931..7b745c477b1 100644 --- a/src/libcore/path.rs +++ b/src/libcore/path.rs @@ -19,6 +19,9 @@ Cross-platform file path handling #[forbid(deprecated_pattern)]; use cmp::Eq; +use libc; +use ptr; +use str; #[deriving_eq] pub struct WindowsPath { @@ -87,6 +90,8 @@ pub pure fn Path(s: &str) -> Path { mod stat { #[cfg(target_arch = "x86")] pub mod arch { + use libc; + pub fn default_stat() -> libc::stat { libc::stat { st_dev: 0, @@ -115,6 +120,8 @@ mod stat { #[cfg(target_arch = "x86_64")] pub mod arch { + use libc; + pub fn default_stat() -> libc::stat { libc::stat { st_dev: 0, @@ -144,6 +151,8 @@ mod stat { mod stat { #[cfg(target_arch = "x86_64")] pub mod arch { + use libc; + pub fn default_stat() -> libc::stat { libc::stat { st_dev: 0, @@ -176,6 +185,8 @@ mod stat { #[cfg(target_os = "macos")] mod stat { pub mod arch { + use libc; + pub fn default_stat() -> libc::stat { libc::stat { st_dev: 0, @@ -738,6 +749,8 @@ pub pure fn normalize(components: &[~str]) -> ~[~str] { // Various windows helpers, and tests for the impl. mod windows { + use libc; + #[inline(always)] pub pure fn is_sep(u: u8) -> bool { u == '/' as u8 || u == '\\' as u8 diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 59d59d33518..12c01b307d5 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -90,7 +90,14 @@ bounded and unbounded protocols allows for less code duplication. use cmp::Eq; use cast::{forget, reinterpret_cast, transmute}; use either::{Either, Left, Right}; +use libc; +use option; use option::unwrap; +use pipes; +use ptr; +use private; +use task; +use vec; #[doc(hidden)] const SPIN_COUNT: uint = 0; diff --git a/src/libcore/private.rs b/src/libcore/private.rs index 2d597bfb1b5..c9fda4b69ec 100644 --- a/src/libcore/private.rs +++ b/src/libcore/private.rs @@ -15,8 +15,14 @@ #[doc(hidden)]; -use task::TaskBuilder; -use task::atomically; +use cast; +use libc; +use oldcomm; +use option; +use pipes; +use ptr; +use task; +use task::{TaskBuilder, atomically}; extern mod rustrt { #[legacy_exports]; diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index c838af700f6..f7faeb2b573 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -13,8 +13,11 @@ #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; +use cast; use cmp::{Eq, Ord}; +use libc; use libc::{c_void, size_t}; +use sys; #[nolink] #[abi = "cdecl"] diff --git a/src/libcore/rand.rs b/src/libcore/rand.rs index 8ee857ef927..651b62d3412 100644 --- a/src/libcore/rand.rs +++ b/src/libcore/rand.rs @@ -14,6 +14,14 @@ #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; +use int; +use str; +use task; +use u32; +use uint; +use util; +use vec; + #[allow(non_camel_case_types)] // runtime type enum rctx {} diff --git a/src/libcore/reflect.rs b/src/libcore/reflect.rs index 268d5e1baa6..55eb53bc026 100644 --- a/src/libcore/reflect.rs +++ b/src/libcore/reflect.rs @@ -19,6 +19,8 @@ Runtime type reflection use intrinsic::{TyDesc, get_tydesc, visit_tydesc, TyVisitor}; use libc::c_void; +use sys; +use vec; /** * Trait for visitor that wishes to reflect on data. To use this, create a diff --git a/src/libcore/repr.rs b/src/libcore/repr.rs index 111070e5b24..9a597bd814c 100644 --- a/src/libcore/repr.rs +++ b/src/libcore/repr.rs @@ -17,16 +17,31 @@ More runtime type reflection #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; +use cast::transmute; +use cast; +use char; +use dvec::DVec; +use intrinsic; +use intrinsic::{TyDesc, TyVisitor, visit_tydesc}; +use io; use io::{Writer, WriterUtil}; use libc::c_void; -use to_str::ToStr; -use cast::transmute; -use intrinsic::{TyDesc, TyVisitor, visit_tydesc}; +use managed; +use managed::raw::BoxHeaderRepr; +use ptr; +use reflect; use reflect::{MovePtr, MovePtrAdaptor, align}; +use repr; +use str; +use sys; +use sys::TypeDesc; +use to_str::ToStr; +use uint; use vec::UnboxedVecRepr; use vec::raw::{VecRepr, SliceRepr}; +use vec; + pub use managed::raw::BoxRepr; -use dvec::DVec; /// Helpers diff --git a/src/libcore/result.rs b/src/libcore/result.rs index e93d186049e..539c8394fdf 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -15,8 +15,11 @@ #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; +use cmp; use cmp::Eq; +use either; use either::Either; +use vec; /// The result type #[deriving_eq] diff --git a/src/libcore/rt.rs b/src/libcore/rt.rs index 120103bd656..5ad2da48241 100644 --- a/src/libcore/rt.rs +++ b/src/libcore/rt.rs @@ -15,10 +15,9 @@ #[forbid(deprecated_pattern)]; //! Runtime calls emitted by the compiler. -use libc::c_char; -use libc::c_void; -use libc::size_t; -use libc::uintptr_t; +use libc::{c_char, c_void, size_t, uintptr_t}; +use str; +use sys; use gc::{cleanup_stack_for_failure, gc, Word}; diff --git a/src/libcore/run.rs b/src/libcore/run.rs index 3af854236e1..faa01519032 100644 --- a/src/libcore/run.rs +++ b/src/libcore/run.rs @@ -13,9 +13,18 @@ #[forbid(deprecated_pattern)]; //! Process spawning -use option::{Some, None}; -use libc::{pid_t, c_void, c_int}; +use io; use io::ReaderUtil; +use libc; +use libc::{pid_t, c_void, c_int}; +use oldcomm; +use option::{Some, None}; +use os; +use ptr; +use run; +use str; +use task; +use vec; #[abi = "cdecl"] extern mod rustrt { diff --git a/src/libcore/send_map.rs b/src/libcore/send_map.rs index af6b2c16377..9159fee30d1 100644 --- a/src/libcore/send_map.rs +++ b/src/libcore/send_map.rs @@ -45,6 +45,12 @@ pub trait SendMap { /// Open addressing with linear probing. pub mod linear { + use cmp; + use option; + use rand; + use uint; + use vec; + const INITIAL_CAPACITY: uint = 32u; // 2^5 struct Bucket { diff --git a/src/libcore/str.rs b/src/libcore/str.rs index e68966945ca..5ba6c708001 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -20,10 +20,19 @@ #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; +use at_vec; +use cast; +use char; use cmp::{Eq, Ord}; +use libc; use libc::size_t; use io::WriterUtil; +use ptr; +use str; use to_str::ToStr; +use u8; +use uint; +use vec; /* Section: Creating a string @@ -1936,6 +1945,11 @@ pub pure fn escape_unicode(s: &str) -> ~str { /// Unsafe operations pub mod raw { + use cast; + use libc; + use ptr; + use str::raw; + use vec; /// Create a Rust string from a null-terminated *u8 buffer pub unsafe fn from_buf(buf: *u8) -> ~str { diff --git a/src/libcore/sys.rs b/src/libcore/sys.rs index 62ced601951..1d1a3778ef7 100644 --- a/src/libcore/sys.rs +++ b/src/libcore/sys.rs @@ -14,8 +14,16 @@ #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; +use cast; use cmp::{Eq, Ord}; +use gc; +use io; +use libc; use libc::{c_void, c_char, size_t}; +use ptr; +use repr; +use str; +use vec; pub type FreeGlue = fn(*TypeDesc, *c_void); diff --git a/src/libcore/task/local_data.rs b/src/libcore/task/local_data.rs index d321966ac5e..b1bf2965919 100644 --- a/src/libcore/task/local_data.rs +++ b/src/libcore/task/local_data.rs @@ -26,12 +26,8 @@ magic. */ -use task::local_data_priv::{ - local_pop, - local_get, - local_set, - local_modify -}; +use rt; +use task::local_data_priv::{local_get, local_pop, local_modify, local_set}; /** * Indexes a task-local data slot. The function's code pointer is used for diff --git a/src/libcore/task/local_data_priv.rs b/src/libcore/task/local_data_priv.rs index 634101ea717..c6b3cfa6626 100644 --- a/src/libcore/task/local_data_priv.rs +++ b/src/libcore/task/local_data_priv.rs @@ -10,6 +10,11 @@ #[doc(hidden)]; // FIXME #3538 +use cast; +use dvec; +use libc; +use option; +use task::rt; use task::local_data::LocalDataKey; #[cfg(notest)] diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index 3cd12a5ba66..2b7da541b1c 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -38,11 +38,16 @@ * ~~~ */ +use cmp; use cmp::Eq; +use oldcomm; +use option; use result::Result; use pipes::{stream, Chan, Port}; +use result; use task::local_data_priv::{local_get, local_set}; use task::rt::{task_id, rust_task}; +use util; use util::replace; mod local_data_priv; diff --git a/src/libcore/task/rt.rs b/src/libcore/task/rt.rs index be66e9e26b8..e95c6d90eee 100644 --- a/src/libcore/task/rt.rs +++ b/src/libcore/task/rt.rs @@ -16,6 +16,8 @@ The task interface to the runtime #[doc(hidden)]; // FIXME #3538 +use libc; + #[allow(non_camel_case_types)] // runtime type pub type sched_id = int; #[allow(non_camel_case_types)] // runtime type diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 77acf3967e8..3ae3eb2e8d4 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -73,8 +73,16 @@ #[doc(hidden)]; // FIXME #3538 #[warn(deprecated_mode)]; +use cast; +use option; +use private; +use ptr; +use send_map; +use task::rt; use task::rt::rust_task; use task::rt::rust_closure; +use uint; +use util; macro_rules! move_it ( { $x:expr } => ( unsafe { let y = move *ptr::addr_of(&($x)); move y } ) diff --git a/src/libcore/to_bytes.rs b/src/libcore/to_bytes.rs index 900cc97066c..edd69219c3f 100644 --- a/src/libcore/to_bytes.rs +++ b/src/libcore/to_bytes.rs @@ -18,7 +18,9 @@ The `ToBytes` and `IterBytes` traits #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; +use io; use io::Writer; +use str; pub type Cb = fn(buf: &[const u8]) -> bool; diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs index 55055470f10..963901c2c75 100644 --- a/src/libcore/to_str.rs +++ b/src/libcore/to_str.rs @@ -18,49 +18,52 @@ The `ToStr` trait for converting to strings #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; +use str; +use vec; + pub trait ToStr { pub pure fn to_str() -> ~str; } impl int: ToStr { - pure fn to_str() -> ~str { int::str(self) } + pure fn to_str() -> ~str { ::int::str(self) } } impl i8: ToStr { - pure fn to_str() -> ~str { i8::str(self) } + pure fn to_str() -> ~str { ::i8::str(self) } } impl i16: ToStr { - pure fn to_str() -> ~str { i16::str(self) } + pure fn to_str() -> ~str { ::i16::str(self) } } impl i32: ToStr { - pure fn to_str() -> ~str { i32::str(self) } + pure fn to_str() -> ~str { ::i32::str(self) } } impl i64: ToStr { - pure fn to_str() -> ~str { i64::str(self) } + pure fn to_str() -> ~str { ::i64::str(self) } } impl uint: ToStr { - pure fn to_str() -> ~str { uint::str(self) } + pure fn to_str() -> ~str { ::uint::str(self) } } impl u8: ToStr { - pure fn to_str() -> ~str { u8::str(self) } + pure fn to_str() -> ~str { ::u8::str(self) } } impl u16: ToStr { - pure fn to_str() -> ~str { u16::str(self) } + pure fn to_str() -> ~str { ::u16::str(self) } } impl u32: ToStr { - pure fn to_str() -> ~str { u32::str(self) } + pure fn to_str() -> ~str { ::u32::str(self) } } impl u64: ToStr { - pure fn to_str() -> ~str { u64::str(self) } + pure fn to_str() -> ~str { ::u64::str(self) } } impl float: ToStr { - pure fn to_str() -> ~str { float::to_str(self, 4u) } + pure fn to_str() -> ~str { ::float::to_str(self, 4u) } } impl f32: ToStr { - pure fn to_str() -> ~str { float::to_str(self as float, 4u) } + pure fn to_str() -> ~str { ::float::to_str(self as float, 4u) } } impl f64: ToStr { - pure fn to_str() -> ~str { float::to_str(self as float, 4u) } + pure fn to_str() -> ~str { ::float::to_str(self as float, 4u) } } impl bool: ToStr { - pure fn to_str() -> ~str { bool::to_str(self) } + pure fn to_str() -> ~str { ::bool::to_str(self) } } impl (): ToStr { pure fn to_str() -> ~str { ~"()" } @@ -69,10 +72,10 @@ impl ~str: ToStr { pure fn to_str() -> ~str { copy self } } impl &str: ToStr { - pure fn to_str() -> ~str { str::from_slice(self) } + pure fn to_str() -> ~str { ::str::from_slice(self) } } impl @str: ToStr { - pure fn to_str() -> ~str { str::from_slice(self) } + pure fn to_str() -> ~str { ::str::from_slice(self) } } impl (A, B): ToStr { diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs index 5ab013223c6..c602c193170 100644 --- a/src/libcore/tuple.rs +++ b/src/libcore/tuple.rs @@ -15,6 +15,7 @@ //! Operations on tuples use cmp::{Eq, Ord}; +use vec; pub trait CopyableTuple { pure fn first() -> T; diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs index 80b393a813c..1f3808fab1b 100644 --- a/src/libcore/uint-template.rs +++ b/src/libcore/uint-template.rs @@ -14,8 +14,13 @@ use T = self::inst::T; +use char; use cmp::{Eq, Ord}; use from_str::FromStr; +use iter; +use num; +use str; +use vec; pub const bits : uint = inst::bits; pub const bytes : uint = (inst::bits / 8); diff --git a/src/libcore/uint-template/uint.rs b/src/libcore/uint-template/uint.rs index b2ae1aa921b..fb1762ef300 100644 --- a/src/libcore/uint-template/uint.rs +++ b/src/libcore/uint-template/uint.rs @@ -16,6 +16,8 @@ pub use self::inst::{ }; mod inst { + use sys; + pub type T = uint; #[cfg(target_arch = "x86")] diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 5071fb903d9..2742e5f6e4f 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -14,20 +14,27 @@ #[forbid(deprecated_pattern)]; #[warn(non_camel_case_types)]; +use cast; use cmp::{Eq, Ord}; -use option::{Some, None}; -use ptr::addr_of; +use iter; +use libc; use libc::size_t; +use option::{Some, None}; +use ptr; +use ptr::addr_of; +use sys; +use uint; +use vec; #[abi = "cdecl"] -extern mod rustrt { +pub extern mod rustrt { fn vec_reserve_shared(++t: *sys::TypeDesc, ++v: **raw::VecRepr, ++n: libc::size_t); } #[abi = "rust-intrinsic"] -extern mod rusti { +pub extern mod rusti { fn move_val_init(dst: &mut T, -src: T); fn init() -> T; } @@ -1799,6 +1806,11 @@ pub struct UnboxedVecRepr { /// Unsafe operations pub mod raw { + use managed; + use option; + use ptr; + use sys; + use vec::rusti; /// The internal representation of a (boxed) vector pub struct VecRepr { @@ -1939,6 +1951,10 @@ pub mod raw { /// Operations on `[u8]` pub mod bytes { + use libc; + use uint; + use vec; + use vec::raw; /// Bytewise string comparison pub pure fn cmp(a: &~[u8], b: &~[u8]) -> int { diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index 52b94b76fe6..a2b67e8380b 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -8,24 +8,37 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use libc::{c_int, c_uint, c_char}; +use back::rpath; use driver::session; -use session::Session; use lib::llvm::llvm; -use syntax::attr; -use middle::ty; +use lib::llvm::{ModuleRef, mk_pass_manager, mk_target_data, True, False}; +use lib::llvm::{PassManagerRef, FileType}; +use lib; +use metadata::common::link_meta; +use metadata::filesearch; use metadata::{encoder, cstore}; use middle::trans::common::crate_ctxt; -use metadata::common::link_meta; +use middle::ty; +use session::Session; +use session; +use util::ppaux; + +use core::char; +use core::cmp; +use core::hash; +use core::io::{Writer, WriterUtil}; +use core::libc::{c_int, c_uint, c_char}; +use core::os; +use core::ptr; +use core::run; +use core::str; +use core::vec; use std::map::HashMap; use std::sha1::sha1; use syntax::ast; -use syntax::print::pprust; -use lib::llvm::{ModuleRef, mk_pass_manager, mk_target_data, True, False, - PassManagerRef, FileType}; -use metadata::filesearch; use syntax::ast_map::{path, path_mod, path_name}; -use io::{Writer, WriterUtil}; +use syntax::attr; +use syntax::print::pprust; enum output_type { output_type_none, @@ -65,8 +78,16 @@ fn WriteOutputFile(sess: Session, } } -mod jit { +pub mod jit { #[legacy_exports]; + + use lib::llvm::llvm; + use metadata::cstore; + + use core::cast; + use core::ptr; + use core::str; + #[nolink] #[abi = "rust-intrinsic"] extern mod rusti { @@ -133,6 +154,16 @@ mod jit { mod write { #[legacy_exports]; + + use back::link::jit; + use driver::session; + use lib::llvm::llvm; + use lib; + + use core::char; + use core::str; + use core::vec; + fn is_object_or_assembly_or_exe(ot: output_type) -> bool { if ot == output_type_assembly || ot == output_type_object || ot == output_type_exe { @@ -609,7 +640,7 @@ fn mangle_exported_name(ccx: @crate_ctxt, path: path, t: ty::t) -> ~str { fn mangle_internal_name_by_type_only(ccx: @crate_ctxt, t: ty::t, name: ~str) -> ~str { - let s = util::ppaux::ty_to_short_str(ccx.tcx, t); + let s = ppaux::ty_to_short_str(ccx.tcx, t); let hash = get_symbol_hash(ccx, t); return mangle(ccx.sess, ~[path_name(ccx.sess.ident_of(name)), diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs index c12458c3f28..04c653d4a13 100644 --- a/src/librustc/back/rpath.rs +++ b/src/librustc/back/rpath.rs @@ -8,12 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::map; -use std::map::HashMap; -use metadata::cstore; use driver::session; +use metadata::cstore; use metadata::filesearch; +use core::os; +use core::uint; +use core::util; +use core::vec; +use std::map::HashMap; +use std::map; + export get_rpath_flags; pure fn not_win32(os: session::os) -> bool { @@ -116,7 +121,7 @@ fn get_rpath_relative_to_output(os: session::os, let prefix = match os { session::os_linux | session::os_freebsd => "$ORIGIN", session::os_macos => "@executable_path", - session::os_win32 => core::util::unreachable() + session::os_win32 => util::unreachable() }; Path(prefix).push_rel(&get_relative_to(&os::make_absolute(output), diff --git a/src/librustc/back/x86.rs b/src/librustc/back/x86.rs index 5d8109b9c08..43f134702cb 100644 --- a/src/librustc/back/x86.rs +++ b/src/librustc/back/x86.rs @@ -8,9 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use back::target_strs; use driver::session; -use session::sess_os_to_meta_os; use metadata::loader::meta_section_name; +use session::sess_os_to_meta_os; fn get_target_strs(target_os: session::os) -> target_strs::t { return { diff --git a/src/librustc/back/x86_64.rs b/src/librustc/back/x86_64.rs index ffc598c3a07..1d459aaa6f3 100644 --- a/src/librustc/back/x86_64.rs +++ b/src/librustc/back/x86_64.rs @@ -8,9 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use back::target_strs; use driver::session; -use session::sess_os_to_meta_os; use metadata::loader::meta_section_name; +use session::sess_os_to_meta_os; fn get_target_strs(target_os: session::os) -> target_strs::t { return { diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index 91c0d036577..12cf35d2633 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -9,27 +9,49 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use metadata::{creader, cstore, filesearch}; -use session::{Session, Session_, OptLevel, No, Less, Default, Aggressive}; -use syntax::parse; -use syntax::{ast, codemap}; -use syntax::attr; -use middle::{trans, freevars, kind, ty, typeck, lint}; -use syntax::print::{pp, pprust}; -use util::ppaux; use back::link; -use result::{Ok, Err}; -use std::getopts; -use std::getopts::{opt_present}; -use std::getopts::groups; -use std::getopts::groups::{optopt, optmulti, optflag, optflagopt, getopts}; -use io::WriterUtil; use back::{x86, x86_64}; -use std::map::HashMap; +use front; use lib::llvm::llvm; +use metadata::{creader, cstore, filesearch}; +use metadata; +use middle::{trans, freevars, kind, ty, typeck, lint}; +use middle; +use session::{Session, Session_, OptLevel, No, Less, Default, Aggressive}; +use session; +use util::ppaux; -enum pp_mode {ppm_normal, ppm_expanded, ppm_typed, ppm_identified, - ppm_expanded_identified } +use core::cmp; +use core::int; +use core::io::WriterUtil; +use core::io; +use core::option; +use core::os; +use core::result::{Ok, Err}; +use core::str; +use core::vec; +use std::getopts::groups::{optopt, optmulti, optflag, optflagopt, getopts}; +use std::getopts::groups; +use std::getopts::{opt_present}; +use std::getopts; +use std::map::HashMap; +use std; +use syntax::ast; +use syntax::ast_map; +use syntax::attr; +use syntax::codemap; +use syntax::diagnostic; +use syntax::parse; +use syntax::print::{pp, pprust}; +use syntax; + +enum pp_mode { + ppm_normal, + ppm_expanded, + ppm_typed, + ppm_identified, + ppm_expanded_identified +} /** * The name used for source code that doesn't originate in a file diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index b2cb6da78dd..58391bbbdd4 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -11,15 +11,22 @@ use back::link; use back::target_strs; +use back; +use driver; +use driver::session; use metadata::filesearch; +use metadata; use middle::lint; +use core::cmp; +use core::option; use syntax::ast::node_id; use syntax::ast::{int_ty, uint_ty, float_ty}; use syntax::codemap::span; +use syntax::diagnostic; use syntax::parse::parse_sess; use syntax::{ast, codemap}; - +use syntax; enum os { os_win32, os_macos, os_linux, os_freebsd, } diff --git a/src/librustc/front/config.rs b/src/librustc/front/config.rs index 22054b6a8d2..fc1f8d06bb1 100644 --- a/src/librustc/front/config.rs +++ b/src/librustc/front/config.rs @@ -10,6 +10,9 @@ use syntax::{ast, fold, attr}; +use core::option; +use core::vec; + export strip_unconfigured_items; export metas_in_cfg; export strip_items; diff --git a/src/librustc/front/core_inject.rs b/src/librustc/front/core_inject.rs index 0d01bdbd336..9575c4695f8 100644 --- a/src/librustc/front/core_inject.rs +++ b/src/librustc/front/core_inject.rs @@ -9,13 +9,18 @@ // except according to those terms. use driver::session::Session; -use syntax::codemap; + +use core::vec; use syntax::ast; use syntax::ast_util::*; use syntax::attr; +use syntax::codemap; +use syntax::fold; export maybe_inject_libcore_ref; +const CORE_VERSION: &static/str = "0.6"; + fn maybe_inject_libcore_ref(sess: Session, crate: @ast::crate) -> @ast::crate { if use_core(crate) { @@ -31,29 +36,56 @@ fn use_core(crate: @ast::crate) -> bool { fn inject_libcore_ref(sess: Session, crate: @ast::crate) -> @ast::crate { - - fn spanned(x: T) -> @ast::spanned { - return @{node: x, - span: dummy_sp()}; + fn spanned(x: T) -> ast::spanned { + return {node: x, span: dummy_sp()}; } - let n1 = sess.next_node_id(); - let n2 = sess.next_node_id(); + let precursor = @{ + fold_crate: |crate, span, fld| { + let n1 = sess.next_node_id(); + let vi1 = @{node: ast::view_item_use(sess.ident_of(~"core"), + ~[], + n1), + attrs: ~[ + spanned({ + style: ast::attr_inner, + value: spanned(ast::meta_name_value( + ~"vers", + spanned(ast::lit_str( + @CORE_VERSION.to_str())) + )), + is_sugared_doc: false + }) + ], + vis: ast::private, + span: dummy_sp()}; - let vi1 = @{node: ast::view_item_use(sess.ident_of(~"core"), ~[], n1), - attrs: ~[], - vis: ast::private, - span: dummy_sp()}; - let vp = spanned(ast::view_path_glob( - ident_to_path(dummy_sp(), sess.ident_of(~"core")), - n2)); - let vi2 = @{node: ast::view_item_import(~[vp]), - attrs: ~[], - vis: ast::private, - span: dummy_sp()}; + let vis = vec::append(~[vi1], crate.module.view_items); + let mut new_module = { view_items: vis, ..crate.module }; + new_module = fld.fold_mod(new_module); - let vis = vec::append(~[vi1, vi2], crate.node.module.view_items); + let new_crate = { module: new_module, ..crate }; + (new_crate, span) + }, + fold_mod: |module, fld| { + let n2 = sess.next_node_id(); - return @{node: {module: { view_items: vis,.. crate.node.module }, - .. crate.node},.. *crate } + let vp = @spanned( + ast::view_path_glob(ident_to_path(dummy_sp(), + sess.ident_of(~"core")), + n2)); + let vi2 = @{node: ast::view_item_import(~[vp]), + attrs: ~[], + vis: ast::private, + span: dummy_sp()}; + + let vis = vec::append(~[vi2], module.view_items); + let new_module = { view_items: vis, ..module }; + fold::noop_fold_mod(new_module, fld) + }, + ..*fold::default_ast_fold() + }; + + let fold = fold::make_fold(precursor); + @fold.fold_crate(*crate) } diff --git a/src/librustc/front/intrinsic_inject.rs b/src/librustc/front/intrinsic_inject.rs index f8a94fff678..e8b15ac1c1f 100644 --- a/src/librustc/front/intrinsic_inject.rs +++ b/src/librustc/front/intrinsic_inject.rs @@ -12,11 +12,11 @@ use driver::session::Session; use syntax::parse; use syntax::ast; +use core::vec; + export inject_intrinsic; -fn inject_intrinsic(sess: Session, - crate: @ast::crate) -> @ast::crate { - +fn inject_intrinsic(sess: Session, crate: @ast::crate) -> @ast::crate { let intrinsic_module = @(include_str!("intrinsic.rs").to_owned()); let item = parse::parse_item_from_source_str(~"", diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs index 27e9e35b7ec..a699b91f444 100644 --- a/src/librustc/front/test.rs +++ b/src/librustc/front/test.rs @@ -10,16 +10,19 @@ // Code that generates a test runner to run all the tests in a crate -use syntax::{ast, ast_util}; +use driver::session; +use front::config; +use session::Session; + +use core::dvec::DVec; +use core::option; +use core::vec; use syntax::ast_util::*; -//import syntax::ast_util::dummy_sp; +use syntax::attr; +use syntax::codemap::span; use syntax::fold; use syntax::print::pprust; -use syntax::codemap::span; -use driver::session; -use session::Session; -use syntax::attr; -use dvec::DVec; +use syntax::{ast, ast_util}; export modify_for_testing; diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index 3f24d280437..dbfe3122388 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -8,12 +8,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::cast; +use core::cmp; +use core::int; +use core::io; +use core::libc::{c_char, c_int, c_uint, c_longlong, c_ulonglong}; +use core::option; +use core::ptr; +use core::str; +use core::uint; +use core::vec; use std::map::HashMap; -use libc::{c_char, c_int, c_uint, c_longlong, c_ulonglong}; - type Opcode = u32; type Bool = c_uint; + const True: Bool = 1 as Bool; const False: Bool = 0 as Bool; @@ -1058,8 +1067,8 @@ fn SetLinkage(Global: ValueRef, Link: Linkage) { /* Memory-managed object interface to type handles. */ -type type_names = @{type_names: std::map::HashMap, - named_types: std::map::HashMap<~str, TypeRef>}; +type type_names = @{type_names: HashMap, + named_types: HashMap<~str, TypeRef>}; fn associate_type(tn: type_names, s: ~str, t: TypeRef) { assert tn.type_names.insert(t, s); @@ -1075,8 +1084,8 @@ fn name_has_type(tn: type_names, s: ~str) -> Option { } fn mk_type_names() -> type_names { - @{type_names: std::map::HashMap(), - named_types: std::map::HashMap()} + @{type_names: HashMap(), + named_types: HashMap()} } fn type_to_str(names: type_names, ty: TypeRef) -> ~str { diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs index e9b820d30db..8a4aa78fe44 100644 --- a/src/librustc/metadata/creader.rs +++ b/src/librustc/metadata/creader.rs @@ -10,25 +10,36 @@ //! Validates all used crates and extern libraries and loads their metadata -use syntax::diagnostic::span_handler; -use syntax::{ast, ast_util}; -use syntax::attr; -use syntax::visit; -use syntax::codemap::span; -use std::map::HashMap; -use syntax::print::pprust; -use metadata::filesearch::FileSearch; +use metadata::cstore; use metadata::common::*; -use dvec::DVec; +use metadata::decoder; +use metadata::filesearch::FileSearch; +use metadata::loader; + +use core::dvec::DVec; +use core::either; +use core::option; +use core::vec; +use syntax::attr; +use syntax::codemap::span; +use syntax::diagnostic::span_handler; use syntax::parse::token::ident_interner; +use syntax::print::pprust; +use syntax::visit; +use syntax::{ast, ast_util}; +use std::map::HashMap; export read_crates; // Traverses an AST, reading all the information about use'd crates and extern // libraries necessary for later resolving, typechecking, linking, etc. -fn read_crates(diag: span_handler, crate: ast::crate, - cstore: cstore::CStore, filesearch: FileSearch, - os: loader::os, static: bool, intr: @ident_interner) { +fn read_crates(diag: span_handler, + crate: ast::crate, + cstore: cstore::CStore, + filesearch: FileSearch, + os: loader::os, + static: bool, + intr: @ident_interner) { let e = @{diag: diag, filesearch: filesearch, cstore: cstore, diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs index ae56cf45dbc..a497597796e 100644 --- a/src/librustc/metadata/csearch.rs +++ b/src/librustc/metadata/csearch.rs @@ -11,10 +11,13 @@ // Searching for information from the cstore use metadata::common::*; +use metadata::cstore; +use metadata::decoder; +use metadata; use middle::ty; use core::dvec::DVec; -use core::option::{Some, None}; +use core::vec; use reader = std::ebml::reader; use std::ebml; use std::map::HashMap; diff --git a/src/librustc/metadata/cstore.rs b/src/librustc/metadata/cstore.rs index 4f5046e4008..212f9558331 100644 --- a/src/librustc/metadata/cstore.rs +++ b/src/librustc/metadata/cstore.rs @@ -11,8 +11,16 @@ // The crate store - a central repo for information collected about external // crates and libraries -use std::map; +use metadata::creader; +use metadata::cstore; +use metadata::decoder; + +use core::option; +use core::str; +use core::vec; use std::map::HashMap; +use std::map; +use std; use syntax::{ast, attr}; use syntax::parse::token::ident_interner; diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index 726bc5f9590..294e34248bc 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -16,12 +16,22 @@ use hash::{Hash, HashUtil}; use io::WriterUtil; use metadata::common::*; use metadata::csearch::{ProvidedTraitMethodInfo, StaticMethodInfo}; +use metadata::csearch; +use metadata::cstore; +use metadata::decoder; use metadata::tydecode::{parse_ty_data, parse_def_id, parse_bounds_data}; use metadata::tydecode::{parse_ident}; use middle::ty; use util::ppaux::ty_to_str; -use reader = std::ebml::reader; +use core::cmp; +use core::dvec; +use core::int; +use core::io; +use core::option; +use core::str; +use core::vec; +use std::ebml::reader; use std::ebml; use std::map::HashMap; use std::map; diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index ab6992c1283..d44b47593ba 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -10,28 +10,42 @@ // Metadata encoding +use metadata::common::*; +use metadata::csearch; +use metadata::cstore; +use metadata::decoder; +use metadata::tyencode; +use middle::resolve; +use middle::ty::node_id_to_type; +use middle::ty; +use middle; use util::ppaux::ty_to_str; -use std::{ebml, map}; +use core::dvec; +use core::flate; +use core::float; +use core::hash::{Hash, HashUtil}; +use core::int; +use core::io::WriterUtil; +use core::io; +use core::str::to_bytes; +use core::str; +use core::to_bytes::IterBytes; +use core::uint; +use core::vec; use std::map::HashMap; -use io::WriterUtil; -use writer = std::ebml::writer; +use std::{ebml, map}; +use std; use syntax::ast::*; +use syntax::ast; +use syntax::ast_map; +use syntax::ast_util::*; +use syntax::attr; +use syntax::diagnostic::span_handler; use syntax::print::pprust; use syntax::{ast_util, visit}; -use syntax::ast_util::*; -use metadata::common::*; -use middle::ty; -use middle::ty::node_id_to_type; -use middle::resolve; -use syntax::ast_map; -use syntax::attr; -use str::to_bytes; -use syntax::ast; -use syntax::diagnostic::span_handler; - -use hash::{Hash, HashUtil}; -use to_bytes::IterBytes; +use syntax; +use writer = std::ebml::writer; export encode_parms; export encode_metadata; @@ -458,7 +472,7 @@ fn encode_info_for_ctor(ecx: @encode_ctxt, ebml_w: writer::Encoder, let its_ty = node_id_to_type(ecx.tcx, id); debug!("fn name = %s ty = %s its node id = %d", ecx.tcx.sess.str_of(ident), - util::ppaux::ty_to_str(ecx.tcx, its_ty), id); + ty_to_str(ecx.tcx, its_ty), id); encode_type(ecx, ebml_w, its_ty); encode_path(ecx, ebml_w, path, ast_map::path_name(ident)); match item { diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs index be4968636f1..a9f8a485c5c 100644 --- a/src/librustc/metadata/filesearch.rs +++ b/src/librustc/metadata/filesearch.rs @@ -12,7 +12,12 @@ // FIXME (#2658): I'm not happy how this module turned out. Should // probably just be folded into cstore. -use result::Result; +use core::option; +use core::os; +use core::result::Result; +use core::result; +use core::str; + export FileSearch; export mk_filesearch; export pick; diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index 5901e58aeb1..e75329340c2 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -10,14 +10,26 @@ //! Finds crate binaries and loads their metadata -use syntax::diagnostic::span_handler; -use syntax::{ast, attr}; -use syntax::print::pprust; -use syntax::codemap::span; use lib::llvm::{False, llvm, mk_object_file, mk_section_iter}; +use metadata::decoder; +use metadata::encoder; use metadata::filesearch::FileSearch; -use io::WriterUtil; +use metadata::filesearch; +use syntax::codemap::span; +use syntax::diagnostic::span_handler; use syntax::parse::token::ident_interner; +use syntax::print::pprust; +use syntax::{ast, attr}; + +use core::cast; +use core::flate; +use core::io::WriterUtil; +use core::io; +use core::option; +use core::ptr; +use core::str; +use core::uint; +use core::vec; export os; export os_macos, os_win32, os_linux, os_freebsd; diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index c7ee052147f..8c4eba2b75e 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -16,6 +16,10 @@ use middle::ty; use middle::ty::{FnTyBase, FnMeta, FnSig}; +use core::io; +use core::str; +use core::uint; +use core::vec; use syntax::ast; use syntax::ast::*; use syntax::ast_util; diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs index 6ceb592f6c9..07838bcb1aa 100644 --- a/src/librustc/metadata/tyencode.rs +++ b/src/librustc/metadata/tyencode.rs @@ -10,12 +10,16 @@ // Type encoding -use io::WriterUtil; +use middle::ty; +use middle::ty::vid; + +use core::io::WriterUtil; +use core::io; +use core::uint; +use core::vec; use std::map::HashMap; use syntax::ast::*; use syntax::diagnostic::span_handler; -use middle::ty; -use middle::ty::vid; use syntax::print::pprust::*; export ctxt; diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index 40d4bd61668..815b91f6e7c 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -20,10 +20,12 @@ use middle::freevars::freevar_entry; use middle::typeck::{method_origin, method_map_entry, vtable_res}; use middle::typeck::{vtable_origin}; use middle::{ty, typeck}; +use middle; use util::ppaux::ty_to_str; -use reader = std::ebml::reader; +use core::{dvec, option, vec}; use std::ebml::reader::get_doc; +use std::ebml::reader; use std::ebml::writer::Encoder; use std::ebml; use std::map::HashMap; @@ -41,6 +43,7 @@ use syntax::fold; use syntax::parse; use syntax::print::pprust; use syntax::visit; +use syntax; use writer = std::ebml::writer; export maps; diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs index 858cfb06d51..43a2c6edaba 100644 --- a/src/librustc/middle/borrowck/check_loans.rs +++ b/src/librustc/middle/borrowck/check_loans.rs @@ -18,8 +18,16 @@ // 4. moves to dnot affect things loaned out in any way use middle::ty::{CopyValue, MoveValue, ReadValue}; +use middle::ty; -use dvec::DVec; +use core::cmp; +use core::dvec::DVec; +use core::uint; +use core::vec; +use syntax::ast; +use syntax::ast_util; +use syntax::print::pprust; +use syntax::visit; export check_loans; diff --git a/src/librustc/middle/borrowck/gather_loans.rs b/src/librustc/middle/borrowck/gather_loans.rs index d5809a7389e..8cff25640cb 100644 --- a/src/librustc/middle/borrowck/gather_loans.rs +++ b/src/librustc/middle/borrowck/gather_loans.rs @@ -16,11 +16,18 @@ // their associated scopes. In phase two, checking loans, we will then make // sure that all of these loans are honored. -use middle::mem_categorization::{mem_categorization_ctxt, opt_deref_kind}; use middle::borrowck::preserve::{preserve_condition, pc_ok, pc_if_pure}; +use middle::mem_categorization::{mem_categorization_ctxt, opt_deref_kind}; +use middle::pat_util; use middle::ty::{ty_region}; +use middle::ty; +use core::dvec; use core::send_map::linear::LinearMap; +use core::vec; +use syntax::ast; +use syntax::print::pprust; +use syntax::visit; export gather_loans; diff --git a/src/librustc/middle/borrowck/loan.rs b/src/librustc/middle/borrowck/loan.rs index 7dc68fa0b4b..c79a733e92d 100644 --- a/src/librustc/middle/borrowck/loan.rs +++ b/src/librustc/middle/borrowck/loan.rs @@ -12,8 +12,12 @@ // 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 middle::ty; + +use core::result::{Result, Ok, Err}; +use syntax::ast; + export public_methods; -use result::{Result, Ok, Err}; impl borrowck_ctxt { fn loan(cmt: cmt, diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index 90de3281447..19b22931a1c 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -226,13 +226,18 @@ Borrowck results in two maps. #[legacy_exports]; +use middle::liveness; use middle::mem_categorization::*; +use middle::region; use middle::ty::to_str; +use middle::ty; use util::common::indenter; use util::ppaux::{expr_repr, note_and_explain_region}; use util::ppaux::{ty_to_str, region_to_str, explain_region}; +use core::cmp; use core::dvec::DVec; +use core::io; use core::result::{Result, Ok, Err}; use std::list::{List, Cons, Nil}; use std::list; @@ -333,7 +338,7 @@ type root_map_key = {id: ast::node_id, derefs: uint}; // set of ids of local vars / formal arguments that are modified / moved. // this is used in trans for optimization purposes. -type mutbl_map = std::map::HashMap; +type mutbl_map = HashMap; // Errors that can occur"] enum bckerr_code { diff --git a/src/librustc/middle/borrowck/preserve.rs b/src/librustc/middle/borrowck/preserve.rs index b1a34bbe256..af2832cf11e 100644 --- a/src/librustc/middle/borrowck/preserve.rs +++ b/src/librustc/middle/borrowck/preserve.rs @@ -13,6 +13,10 @@ // the scope S. // +use middle::ty; + +use syntax::ast; + export public_methods, preserve_condition, pc_ok, pc_if_pure; enum preserve_condition { diff --git a/src/librustc/middle/capture.rs b/src/librustc/middle/capture.rs index f9a7459c671..8a498c1935b 100644 --- a/src/librustc/middle/capture.rs +++ b/src/librustc/middle/capture.rs @@ -8,10 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use syntax::{ast, ast_util}; -use syntax::codemap::span; -use std::map; +use middle::freevars; +use middle::ty; + +use core::option; +use core::vec; use std::map::HashMap; +use std::map; +use syntax::codemap::span; +use syntax::{ast, ast_util}; export capture_mode; export capture_var; diff --git a/src/librustc/middle/check_alt.rs b/src/librustc/middle/check_alt.rs index ef192a0fda7..e87d83c9c15 100644 --- a/src/librustc/middle/check_alt.rs +++ b/src/librustc/middle/check_alt.rs @@ -16,13 +16,18 @@ use middle::ty; use middle::typeck::method_map; use util::ppaux::ty_to_str; +use core::cmp; +use core::option; +use core::uint; +use core::vec; use std::map::HashMap; +use std::sort; use syntax::ast::*; use syntax::ast_util::{variant_def_ids, dummy_sp, unguarded_pat, walk_pat}; +use syntax::ast_util; use syntax::codemap::span; use syntax::print::pprust::pat_to_str; use syntax::visit; -use std::sort; struct AltCheckCtxt { tcx: ty::ctxt, @@ -470,7 +475,7 @@ fn ctor_arity(cx: @AltCheckCtxt, ctor: ctor, ty: ty::t) -> uint { } fn wild() -> @pat { - @{id: 0, node: pat_wild, span: syntax::ast_util::dummy_sp()} + @{id: 0, node: pat_wild, span: ast_util::dummy_sp()} } fn specialize(cx: @AltCheckCtxt, r: ~[@pat], ctor_id: ctor, arity: uint, diff --git a/src/librustc/middle/check_const.rs b/src/librustc/middle/check_const.rs index 06dd18b3bf3..f7fa5c60b2f 100644 --- a/src/librustc/middle/check_const.rs +++ b/src/librustc/middle/check_const.rs @@ -8,11 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use driver::session::Session; +use middle::resolve; +use middle::ty; +use middle::typeck; +use util::ppaux; + +use core::dvec::DVec; +use core::option; +use std::map::HashMap; use syntax::ast::*; use syntax::{visit, ast_util, ast_map}; -use driver::session::Session; -use std::map::HashMap; -use dvec::DVec; fn check_crate(sess: Session, crate: @crate, ast_map: ast_map::map, def_map: resolve::DefMap, @@ -88,7 +94,7 @@ fn check_expr(sess: Session, def_map: resolve::DefMap, let ety = ty::expr_ty(tcx, e); if !ty::type_is_numeric(ety) { sess.span_err(e.span, ~"can not cast to `" + - util::ppaux::ty_to_str(tcx, ety) + + ppaux::ty_to_str(tcx, ety) + ~"` in a constant expression"); } } diff --git a/src/librustc/middle/check_loop.rs b/src/librustc/middle/check_loop.rs index 5ff186126fb..d96d29f6835 100644 --- a/src/librustc/middle/check_loop.rs +++ b/src/librustc/middle/check_loop.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use middle::ty; + use syntax::ast::*; use syntax::visit; diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index a51885b1fc7..ec498c18d89 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -8,6 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use middle::resolve; +use middle::ty; +use middle; + +use core::cmp; +use core::float; +use core::vec; use syntax::{ast, ast_map, ast_util, visit}; use syntax::ast::*; diff --git a/src/librustc/middle/freevars.rs b/src/librustc/middle/freevars.rs index 38ec7dd5eb0..3cd82a8ed2a 100644 --- a/src/librustc/middle/freevars.rs +++ b/src/librustc/middle/freevars.rs @@ -11,11 +11,16 @@ // A pass that annotates for each loops and functions with the free // variables that they contain. -use syntax::print::pprust::path_to_str; +use middle::resolve; +use middle::ty; + +use core::int; +use core::option::*; +use core::vec; use std::map::*; -use option::*; -use syntax::{ast, ast_util, visit}; use syntax::codemap::span; +use syntax::print::pprust::path_to_str; +use syntax::{ast, ast_util, visit}; export annotate_freevars; export freevar_map; diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs index e35377c5cdd..36a1fe62c58 100644 --- a/src/librustc/middle/kind.rs +++ b/src/librustc/middle/kind.rs @@ -9,11 +9,20 @@ // except according to those terms. use middle::freevars::freevar_entry; +use middle::freevars; use middle::lint::{non_implicitly_copyable_typarams, implicit_copies}; +use middle::liveness; +use middle::pat_util; use middle::ty::{CopyValue, MoveValue, ReadValue}; use middle::ty::{Kind, kind_copyable, kind_noncopyable, kind_const}; +use middle::ty; +use middle::typeck; +use middle; use util::ppaux::{ty_to_str, tys_to_str}; +use core::option; +use core::str; +use core::vec; use std::map::HashMap; use syntax::ast::*; use syntax::codemap::span; @@ -71,7 +80,7 @@ fn kind_to_str(k: Kind) -> ~str { str::connect(kinds, ~" ") } -type rval_map = std::map::HashMap; +type rval_map = HashMap; type ctx = {tcx: ty::ctxt, method_map: typeck::method_map, diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 1f65ee8ae83..9bfd87923a8 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -29,6 +29,7 @@ use syntax::ast_util::{local_def}; use syntax::visit::{default_simple_visitor, mk_simple_visitor}; use syntax::visit::{visit_crate, visit_item}; +use core::ptr; use std::map::HashMap; use str_eq = str::eq; diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index f2ab93478c4..ad15e07673e 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -8,19 +8,38 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use driver::session; use driver::session::Session; +use driver::session; +use middle::pat_util::{pat_bindings}; use middle::ty; -use syntax::{ast, ast_util, visit}; +use util::ppaux::{ty_to_str}; + +use core::char; +use core::cmp; +use core::either; +use core::i8; +use core::i16; +use core::i32; +use core::i64; +use core::int; +use core::io::WriterUtil; +use core::str; +use core::u8; +use core::u16; +use core::u32; +use core::u64; +use core::uint; +use core::vec; +use std::map::{Map, HashMap}; +use std::map; +use std::smallintmap::{Map, SmallIntMap}; +use std::smallintmap; +use syntax::ast_util::{path_to_ident}; use syntax::attr; use syntax::codemap::span; -use std::map::{Map,HashMap}; -use std::smallintmap::{Map,SmallIntMap}; -use io::WriterUtil; -use util::ppaux::{ty_to_str}; -use middle::pat_util::{pat_bindings}; -use syntax::ast_util::{path_to_ident}; use syntax::print::pprust::{expr_to_str, mode_to_str, pat_to_str}; +use syntax::{ast, ast_util, visit}; + export lint, ctypes, unused_imports, while_true, path_statement, old_vecs; export unrecognized_lint, non_implicitly_copyable_typarams; export vecs_implicitly_copyable, implicit_copies, legacy_modes; @@ -226,7 +245,7 @@ fn get_lint_dict() -> lint_dict { default: warn}), */ ]; - std::map::hash_from_vec(v) + map::hash_from_vec(v) } // This is a highly not-optimal set of data structure decisions. @@ -242,7 +261,7 @@ type lint_settings = { }; fn mk_lint_settings() -> lint_settings { - {default_settings: std::smallintmap::mk(), + {default_settings: smallintmap::mk(), settings_map: HashMap()} } @@ -266,7 +285,7 @@ fn get_lint_settings_level(settings: lint_settings, // This is kind of unfortunate. It should be somewhere else, or we should use // a persistent data structure... fn clone_lint_modes(modes: lint_modes) -> lint_modes { - std::smallintmap::SmallIntMap_(@{v: copy modes.v}) + smallintmap::SmallIntMap_(@{v: copy modes.v}) } type ctxt_ = {dict: lint_dict, @@ -386,7 +405,7 @@ fn build_settings_item(i: @ast::item, &&cx: ctxt, v: visit::vt) { fn build_settings_crate(sess: session::Session, crate: @ast::crate) { let cx = ctxt_({dict: get_lint_dict(), - curr: std::smallintmap::mk(), + curr: smallintmap::mk(), is_default: true, sess: sess}); diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index c481ef81477..da1f82a33b7 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -103,10 +103,20 @@ */ use middle::capture::{cap_move, cap_drop, cap_copy, cap_ref}; +use middle::capture; +use middle::pat_util; use middle::ty::MoveValue; +use middle::ty; +use middle::typeck; +use core::cmp; use core::dvec::DVec; use core::io::WriterUtil; +use core::io; +use core::ptr; +use core::to_str; +use core::uint; +use core::vec; use std::map::HashMap; use syntax::ast::*; use syntax::codemap::span; @@ -414,7 +424,7 @@ impl IrMaps { fn visit_fn(fk: visit::fn_kind, decl: fn_decl, body: blk, sp: span, id: node_id, &&self: @IrMaps, v: vt<@IrMaps>) { debug!("visit_fn: id=%d", id); - let _i = util::common::indenter(); + let _i = ::util::common::indenter(); // swap in a new set of IR maps for this function body: let fn_maps = @IrMaps(self.tcx, self.method_map, diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 8962a1494e5..04c57025157 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -46,13 +46,19 @@ * then an index to jump forward to the relevant item. */ -use syntax::ast; -use syntax::ast::{m_imm, m_const, m_mutbl}; -use syntax::codemap::span; -use syntax::print::pprust; +use middle::ty; +use middle::typeck; use util::ppaux::{ty_to_str, region_to_str}; use util::common::indenter; +use core::cmp; +use core::to_bytes; +use core::uint; +use syntax::ast::{m_imm, m_const, m_mutbl}; +use syntax::ast; +use syntax::codemap::span; +use syntax::print::pprust; + enum categorization { cat_rvalue, // result of eval'ing some misc expr cat_special(special_kind), // diff --git a/src/librustc/middle/pat_util.rs b/src/librustc/middle/pat_util.rs index b1bd42758f1..9677c517094 100644 --- a/src/librustc/middle/pat_util.rs +++ b/src/librustc/middle/pat_util.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use middle::resolve; use middle::ty::{CopyValue, MoveValue, ReadValue}; +use middle::ty; use syntax::ast::*; use syntax::ast_util; @@ -23,12 +25,12 @@ export pat_is_variant_or_struct, pat_is_binding, pat_is_binding_or_wild; export pat_is_const; export arms_have_by_move_bindings; -type PatIdMap = std::map::HashMap; +type PatIdMap = HashMap; // This is used because same-named variables in alternative patterns need to // use the node_id of their namesake in the first pattern. fn pat_id_map(dm: resolve::DefMap, pat: @pat) -> PatIdMap { - let map = std::map::HashMap(); + let map = HashMap(); do pat_bindings(dm, pat) |_bm, p_id, _s, n| { map.insert(path_to_ident(n), p_id); }; diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 5819db17f58..b9f70bd4d33 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -12,21 +12,22 @@ // outside their scopes. use middle::ty::{ty_struct, ty_enum}; +use middle::ty; use middle::typeck::{method_map, method_origin, method_param, method_self}; use middle::typeck::{method_static, method_trait}; -use /*mod*/ syntax::ast; -use /*mod*/ syntax::visit; -use syntax::ast_map; + +use core::dvec::DVec; +use core::util::ignore; use syntax::ast::{def_variant, expr_field, expr_method_call, expr_struct}; use syntax::ast::{expr_unary, ident, item_struct, item_enum, item_impl}; use syntax::ast::{item_trait, local_crate, node_id, pat_struct, private}; use syntax::ast::{provided, required}; +use syntax::ast; use syntax::ast_map::{node_item, node_method}; +use syntax::ast_map; use syntax::ast_util::{Private, Public, has_legacy_export_attr, is_local}; use syntax::ast_util::{visibility_to_privacy}; - -use core::util::ignore; -use dvec::DVec; +use syntax::visit; fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) { let privileged_items = @DVec(); diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index f746e023680..11dde31ab39 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -19,11 +19,14 @@ region parameterized. use driver::session::Session; use metadata::csearch; +use middle::resolve; use middle::ty::{region_variance, rv_covariant, rv_invariant}; use middle::ty::{rv_contravariant}; use middle::ty; +use core::cmp; use core::dvec::DVec; +use core::vec; use std::list; use std::list::list; use std::map::HashMap; @@ -564,7 +567,7 @@ impl determine_rp_ctxt { self.item_id = item_id; self.anon_implies_rp = anon_implies_rp; debug!("with_item_id(%d, %b)", item_id, anon_implies_rp); - let _i = util::common::indenter(); + let _i = ::util::common::indenter(); f(); self.item_id = old_item_id; self.anon_implies_rp = old_anon_implies_rp; diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index f8138dc6d32..acaf668969c 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -16,6 +16,10 @@ use metadata::decoder::{def_like, dl_def, dl_field, dl_impl}; use middle::lang_items::LanguageItems; use middle::lint::{deny, allow, forbid, level, unused_imports, warn}; use middle::pat_util::{pat_bindings}; + +use core::cmp; +use core::str; +use core::vec; use syntax::ast::{_mod, add, arm, binding_mode, bitand, bitor, bitxor, blk}; use syntax::ast::{capture_clause}; use syntax::ast::{crate, crate_num, decl_item, def, def_arg, def_binding}; @@ -35,16 +39,16 @@ use syntax::ast::{foreign_item, foreign_item_const, foreign_item_fn, ge}; use syntax::ast::{gt, ident, impure_fn, inherited, item, item_struct}; use syntax::ast::{item_const, item_enum, item_fn, item_foreign_mod}; use syntax::ast::{item_impl, item_mac, item_mod, item_trait, item_ty, le}; -use syntax::ast::{local, local_crate, lt, method, mode, module_ns, mul, ne}; -use syntax::ast::{neg, node_id, pat, pat_enum, pat_ident, path, prim_ty}; -use syntax::ast::{pat_box, pat_lit, pat_range, pat_rec, pat_struct}; -use syntax::ast::{pat_tup, pat_uniq, pat_wild, private, provided, public}; -use syntax::ast::{required, rem, self_ty_, shl, shr, stmt_decl, struct_dtor}; -use syntax::ast::{struct_field, struct_variant_kind, sty_by_ref, sty_static}; -use syntax::ast::{subtract, trait_ref, tuple_variant_kind, Ty, ty_bool}; -use syntax::ast::{ty_char, ty_f, ty_f32, ty_f64, ty_float, ty_i, ty_i16}; -use syntax::ast::{ty_i32, ty_i64, ty_i8, ty_int, ty_param, ty_path, ty_str}; -use syntax::ast::{ty_u, ty_u16, ty_u32, ty_u64, ty_u8, ty_uint}; +use syntax::ast::{local, local_crate, lt, method, mode, module_ns, mul}; +use syntax::ast::{named_field, ne, neg, node_id, pat, pat_enum, pat_ident}; +use syntax::ast::{path, pat_box, pat_lit, pat_range, pat_rec, pat_struct}; +use syntax::ast::{pat_tup, pat_uniq, pat_wild, prim_ty, private, provided}; +use syntax::ast::{public, required, rem, self_ty_, shl, shr, stmt_decl}; +use syntax::ast::{struct_dtor, struct_field, struct_variant_kind, sty_by_ref}; +use syntax::ast::{sty_static, subtract, trait_ref, tuple_variant_kind, Ty}; +use syntax::ast::{ty_bool, ty_char, ty_f, ty_f32, ty_f64, ty_float, ty_i}; +use syntax::ast::{ty_i16, ty_i32, ty_i64, ty_i8, ty_int, ty_param, ty_path}; +use syntax::ast::{ty_str, ty_u, ty_u16, ty_u32, ty_u64, ty_u8, ty_uint}; use syntax::ast::{type_value_ns, ty_param_bound, unnamed_field}; use syntax::ast::{variant, view_item, view_item_export, view_item_import}; use syntax::ast::{view_item_use, view_path_glob, view_path_list}; @@ -54,6 +58,8 @@ use syntax::ast_util::{path_to_ident, walk_pat, trait_method_to_ty_method}; use syntax::ast_util::{Privacy, Public, Private, visibility_to_privacy}; use syntax::ast_util::has_legacy_export_attr; use syntax::attr::{attr_metas, contains_name}; +use syntax::parse::token::ident_interner; +use syntax::parse::token::special_idents; use syntax::print::pprust::{pat_to_str, path_to_str}; use syntax::codemap::span; use syntax::visit::{default_visitor, fk_method, mk_vt, visit_block}; @@ -66,7 +72,6 @@ use dvec::DVec; use option::{Some, get, is_some, is_none}; use str::{connect, split_str}; use vec::pop; -use syntax::parse::token::ident_interner; use std::list::{Cons, List, Nil}; use std::map::HashMap; @@ -317,9 +322,14 @@ enum UseLexicalScopeFlag { UseLexicalScope } -struct ModulePrefixResult { - result: ResolveResult<@Module>, - prefix_len: uint +enum SearchThroughModulesFlag { + DontSearchThroughModules, + SearchThroughModules +} + +enum ModulePrefixResult { + NoPrefixFound, + PrefixFound(@Module, uint) } impl XrayFlag : cmp::Eq { @@ -475,10 +485,19 @@ enum ParentLink { BlockParentLink(@Module, node_id) } +/// The type of module this is. +enum ModuleKind { + NormalModuleKind, + ExternModuleKind, + TraitModuleKind, + AnonymousModuleKind, +} + /// One node in the tree of modules. struct Module { parent_link: ParentLink, mut def_id: Option, + kind: ModuleKind, children: HashMap, imports: DVec<@ImportDirective>, @@ -527,10 +546,12 @@ struct Module { fn Module(parent_link: ParentLink, def_id: Option, + kind: ModuleKind, legacy_exports: bool) -> Module { Module { parent_link: parent_link, def_id: def_id, + kind: kind, children: HashMap(), imports: DVec(), anonymous_children: HashMap(), @@ -589,10 +610,11 @@ impl NameBindings { fn define_module(privacy: Privacy, parent_link: ParentLink, def_id: Option, + kind: ModuleKind, legacy_exports: bool, sp: span) { // Merges the module with the existing type def or creates a new one. - let module_ = @Module(parent_link, def_id, legacy_exports); + let module_ = @Module(parent_link, def_id, kind, legacy_exports); match self.type_def { None => { self.type_def = Some(TypeNsDef { @@ -794,6 +816,7 @@ fn Resolver(session: Session, lang_items: LanguageItems, (*graph_root).define_module(Public, NoParentLink, Some({ crate: 0, node: 0 }), + NormalModuleKind, has_legacy_export_attr(crate.node.attrs), crate.span); @@ -824,7 +847,7 @@ fn Resolver(session: Session, lang_items: LanguageItems, xray_context: NoXray, current_trait_refs: None, - self_ident: syntax::parse::token::special_idents::self_, + self_ident: special_idents::self_, primitive_type_table: @PrimitiveTypeTable(session. parse_sess.interner), @@ -1111,8 +1134,12 @@ impl Resolver { let parent_link = self.get_parent_link(new_parent, ident); let def_id = { crate: 0, node: item.id }; - (*name_bindings).define_module(privacy, parent_link, - Some(def_id), legacy, sp); + (*name_bindings).define_module(privacy, + parent_link, + Some(def_id), + NormalModuleKind, + legacy, + sp); let new_parent = ModuleReducedGraphParent((*name_bindings).get_module()); @@ -1134,6 +1161,7 @@ impl Resolver { (*name_bindings).define_module(privacy, parent_link, Some(def_id), + ExternModuleKind, legacy, sp); @@ -1251,8 +1279,12 @@ impl Resolver { let parent_link = self.get_parent_link(new_parent, ident); let def_id = local_def(item.id); - name_bindings.define_module(privacy, parent_link, - Some(def_id), false, sp); + name_bindings.define_module(privacy, + parent_link, + Some(def_id), + TraitModuleKind, + false, + sp); let new_parent = ModuleReducedGraphParent( name_bindings.get_module()); @@ -1313,6 +1345,7 @@ impl Resolver { name_bindings.define_module(privacy, parent_link, Some(local_def(item.id)), + TraitModuleKind, false, sp); module_parent_opt = Some(ModuleReducedGraphParent( @@ -1568,6 +1601,7 @@ impl Resolver { (*child_name_bindings).define_module(privacy, parent_link, Some(def_id), + NormalModuleKind, false, view_item.span); self.build_reduced_graph_for_external_crate @@ -1626,7 +1660,9 @@ impl Resolver { let parent_module = self.get_module_from_parent(parent); let new_module = @Module(BlockParentLink(parent_module, block_id), - None, false); + None, + AnonymousModuleKind, + false); parent_module.anonymous_children.insert(block_id, new_module); new_parent = ModuleReducedGraphParent(new_module); } else { @@ -1660,6 +1696,7 @@ impl Resolver { child_name_bindings.define_module(Public, parent_link, Some(def_id), + NormalModuleKind, false, dummy_sp()); modules.insert(def_id, @@ -1791,6 +1828,7 @@ impl Resolver { (*child_name_bindings).define_module(Public, parent_link, None, + NormalModuleKind, false, dummy_sp()); } @@ -1804,6 +1842,7 @@ impl Resolver { (*child_name_bindings).define_module(Public, parent_link, None, + NormalModuleKind, false, dummy_sp()); } @@ -1874,6 +1913,7 @@ impl Resolver { Public, parent_link, Some(def), + NormalModuleKind, false, dummy_sp()); type_module = @@ -2722,23 +2762,13 @@ impl Resolver { self.idents_to_str((*module_path).get()), self.module_to_str(module_)); - // The first element of the module path must be in the current scope - // chain. - - let resolve_result = match use_lexical_scope { - DontUseLexicalScope => { - self.resolve_module_prefix(module_, module_path) - } - UseLexicalScope => { - let result = self.resolve_module_in_lexical_scope( - module_, - module_path.get_elt(0)); - ModulePrefixResult { result: result, prefix_len: 1 } - } - }; + // Resolve the module prefix, if any. + let module_prefix_result = self.resolve_module_prefix(module_, + module_path); let mut search_module; - match resolve_result.result { + let mut start_index; + match module_prefix_result { Failed => { self.session.span_err(span, ~"unresolved name"); return Failed; @@ -2748,21 +2778,61 @@ impl Resolver { bailing"); return Indeterminate; } - Success(resulting_module) => { - search_module = resulting_module; + Success(NoPrefixFound) => { + // There was no prefix, so we're considering the first element + // of the path. How we handle this depends on whether we were + // instructed to use lexical scope or not. + match use_lexical_scope { + DontUseLexicalScope => { + // This is a crate-relative path. We will start the + // resolution process at index zero. + search_module = self.graph_root.get_module(); + start_index = 0; + } + UseLexicalScope => { + // This is not a crate-relative path. We resolve the + // first component of the path in the current lexical + // scope and then proceed to resolve below that. + let result = self.resolve_module_in_lexical_scope( + module_, + module_path.get_elt(0)); + match result { + Failed => { + self.session.span_err(span, + ~"unresolved name"); + return Failed; + } + Indeterminate => { + debug!("(resolving module path for import) \ + indeterminate; bailing"); + return Indeterminate; + } + Success(containing_module) => { + search_module = containing_module; + start_index = 1; + } + } + } + } + } + Success(PrefixFound(containing_module, index)) => { + search_module = containing_module; + start_index = index; } } return self.resolve_module_path_from_root(search_module, module_path, - resolve_result.prefix_len, + start_index, xray, span); } fn resolve_item_in_lexical_scope(module_: @Module, name: ident, - namespace: Namespace) + namespace: Namespace, + search_through_modules: + SearchThroughModulesFlag) -> ResolveResult { debug!("(resolving item in lexical scope) resolving `%s` in \ @@ -2818,7 +2888,30 @@ impl Resolver { module"); return Failed; } - ModuleParentLink(parent_module_node, _) | + ModuleParentLink(parent_module_node, _) => { + match search_through_modules { + DontSearchThroughModules => { + match search_module.kind { + NormalModuleKind => { + // We stop the search here. + debug!("(resolving item in lexical \ + scope) unresolved module: not \ + searching through module \ + parents"); + return Failed; + } + ExternModuleKind | + TraitModuleKind | + AnonymousModuleKind => { + search_module = parent_module_node; + } + } + } + SearchThroughModules => { + search_module = parent_module_node; + } + } + } BlockParentLink(parent_module_node, _) => { search_module = parent_module_node; } @@ -2854,9 +2947,8 @@ impl Resolver { -> ResolveResult<@Module> { // If this module is an anonymous module, resolve the item in the // lexical scope. Otherwise, resolve the item from the crate root. - let resolve_result = self.resolve_item_in_lexical_scope(module_, - name, - TypeNS); + let resolve_result = self.resolve_item_in_lexical_scope( + module_, name, TypeNS, DontSearchThroughModules); match resolve_result { Success(target) => { match target.bindings.type_def { @@ -2894,46 +2986,102 @@ impl Resolver { } /** - * Resolves a "module prefix". A module prefix is one of (a) the name of a - * module; (b) "self::"; (c) some chain of "super::". + * Returns the nearest normal module parent of the given module. + */ + fn get_nearest_normal_module_parent(module_: @Module) -> Option<@Module> { + let mut module_ = module_; + loop { + match module_.parent_link { + NoParentLink => return None, + ModuleParentLink(new_module, _) | + BlockParentLink(new_module, _) => { + match new_module.kind { + NormalModuleKind => return Some(new_module), + ExternModuleKind | + TraitModuleKind | + AnonymousModuleKind => module_ = new_module, + } + } + } + } + } + + /** + * Returns the nearest normal module parent of the given module, or the + * module itself if it is a normal module. + */ + fn get_nearest_normal_module_parent_or_self(module_: @Module) -> @Module { + match module_.kind { + NormalModuleKind => return module_, + ExternModuleKind | TraitModuleKind | AnonymousModuleKind => { + match self.get_nearest_normal_module_parent(module_) { + None => module_, + Some(new_module) => new_module + } + } + } + } + + /** + * Resolves a "module prefix". A module prefix is one of (a) `self::`; + * (b) some chain of `super::`. */ fn resolve_module_prefix(module_: @Module, module_path: @DVec) - -> ModulePrefixResult { + -> ResolveResult { let interner = self.session.parse_sess.interner; - let mut containing_module = self.graph_root.get_module(); - let mut i = 0; - loop { - if *interner.get(module_path.get_elt(i)) == ~"self" { - containing_module = module_; - i += 1; - break; - } - if *interner.get(module_path.get_elt(i)) == ~"super" { - match containing_module.parent_link { - NoParentLink => { - return ModulePrefixResult { - result: Failed, - prefix_len: i - }; - } - BlockParentLink(new_module, _) | - ModuleParentLink(new_module, _) => { - containing_module = new_module; - } + // Start at the current module if we see `self` or `super`, or at the + // top of the crate otherwise. + let mut containing_module; + let mut i; + if *interner.get(module_path.get_elt(0)) == ~"self" { + containing_module = + self.get_nearest_normal_module_parent_or_self(module_); + i = 1; + } else if *interner.get(module_path.get_elt(0)) == ~"super" { + containing_module = + self.get_nearest_normal_module_parent_or_self(module_); + i = 0; // We'll handle `super` below. + } else { + return Success(NoPrefixFound); + } + + // Now loop through all the `super`s we find. + while i < module_path.len() && + *interner.get(module_path.get_elt(i)) == ~"super" { + debug!("(resolving module prefix) resolving `super` at %s", + self.module_to_str(containing_module)); + match self.get_nearest_normal_module_parent(containing_module) { + None => return Failed, + Some(new_module) => { + containing_module = new_module; + i += 1; } - i += 1; - } else { - break; } } + debug!("(resolving module prefix) finished resolving prefix at %s", + 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, @@ -2950,13 +3098,13 @@ impl Resolver { module!"); return ModulePrefixResult { result: Failed, - prefix_len: i + 1 + prefix_len: i }; } Some(module_def) => { return ModulePrefixResult { result: Success(module_def), - prefix_len: i + 1 + prefix_len: i }; } } @@ -2966,7 +3114,7 @@ impl Resolver { wasn't actually a module!"); return ModulePrefixResult { result: Failed, - prefix_len: i + 1 + prefix_len: i }; } } @@ -2976,17 +3124,18 @@ impl Resolver { bailing"); return ModulePrefixResult { result: Indeterminate, - prefix_len: i + 1 + prefix_len: i }; } Failed => { debug!("(resolving crate-relative module) failed to resolve"); return ModulePrefixResult { result: Failed, - prefix_len: i + 1 + prefix_len: i }; } } + */ } fn name_is_exported(module_: @Module, name: ident) -> bool { @@ -3109,7 +3258,8 @@ impl Resolver { debug!("(resolving one-level naming result) searching for module"); match self.resolve_item_in_lexical_scope(module_, source_name, - TypeNS) { + TypeNS, + SearchThroughModules) { Failed => { debug!("(resolving one-level renaming import) didn't find \ module result"); @@ -3135,8 +3285,9 @@ impl Resolver { } else { debug!("(resolving one-level naming result) searching for value"); match self.resolve_item_in_lexical_scope(module_, - source_name, - ValueNS) { + source_name, + ValueNS, + SearchThroughModules) { Failed => { debug!("(resolving one-level renaming import) didn't \ @@ -3157,8 +3308,9 @@ impl Resolver { debug!("(resolving one-level naming result) searching for type"); match self.resolve_item_in_lexical_scope(module_, - source_name, - TypeNS) { + source_name, + TypeNS, + SearchThroughModules) { Failed => { debug!("(resolving one-level renaming import) didn't \ @@ -3831,7 +3983,7 @@ impl Resolver { if !self.session.building_library && is_none(&self.session.main_fn) && - item.ident == syntax::parse::token::special_idents::main { + item.ident == special_idents::main { self.session.main_fn = Some((item.id, item.span)); } @@ -4571,7 +4723,8 @@ impl Resolver { -> BareIdentifierPatternResolution { match self.resolve_item_in_lexical_scope(self.current_module, name, - ValueNS) { + ValueNS, + SearchThroughModules) { Success(target) => { match target.bindings.value_def { None => { @@ -4608,10 +4761,11 @@ impl Resolver { * If `check_ribs` is true, checks the local definitions first; i.e. * doesn't skip straight to the containing module. */ - fn resolve_path(path: @path, namespace: Namespace, check_ribs: bool, + fn resolve_path(path: @path, + namespace: Namespace, + check_ribs: bool, visitor: ResolveVisitor) -> Option { - // First, resolve the types. for path.types.each |ty| { self.resolve_type(*ty, visitor); @@ -4625,8 +4779,8 @@ impl Resolver { if path.idents.len() > 1 { return self.resolve_module_relative_path(path, - self.xray_context, - namespace); + self.xray_context, + namespace); } return self.resolve_identifier(path.idents.last(), @@ -4797,10 +4951,10 @@ impl Resolver { let mut containing_module; match self.resolve_module_path_from_root(root_module, - module_path_idents, - 0, - xray, - path.span) { + module_path_idents, + 0, + xray, + path.span) { Failed => { self.session.span_err(path.span, @@ -4821,9 +4975,9 @@ impl Resolver { let name = path.idents.last(); match self.resolve_definition_of_name_in_module(containing_module, - name, - namespace, - xray) { + name, + namespace, + xray) { NoNameDefinition => { // We failed to resolve the name. Report an error. return None; @@ -4870,8 +5024,9 @@ impl Resolver { -> Option { // Check the items. match self.resolve_item_in_lexical_scope(self.current_module, - ident, - namespace) { + ident, + namespace, + SearchThroughModules) { Success(target) => { match (*target.bindings).def_for_namespace(namespace) { None => { @@ -4909,10 +5064,8 @@ impl Resolver { item_struct(class_def, _) => { for vec::each(class_def.fields) |field| { match field.node.kind { - syntax::ast::unnamed_field - => {}, - syntax::ast::named_field(ident, _, _) - => { + unnamed_field => {}, + named_field(ident, _, _) => { if str::eq_slice(self.session.str_of(ident), name) { return true @@ -5352,7 +5505,7 @@ impl Resolver { current_module = module_; } BlockParentLink(module_, _) => { - idents.push(syntax::parse::token::special_idents::opaque); + idents.push(special_idents::opaque); current_module = module_; } } diff --git a/src/librustc/middle/trans/alt.rs b/src/librustc/middle/trans/alt.rs index 922dc2363a0..7880babbd12 100644 --- a/src/librustc/middle/trans/alt.rs +++ b/src/librustc/middle/trans/alt.rs @@ -145,17 +145,24 @@ use back::abi; use lib::llvm::llvm; use lib::llvm::{ValueRef, BasicBlockRef}; +use middle::const_eval; use middle::pat_util::*; use middle::resolve::DefMap; use middle::trans::base::*; use middle::trans::build::*; +use middle::trans::callee; use middle::trans::common::*; +use middle::trans::consts; +use middle::trans::controlflow; use middle::trans::datum::*; use middle::trans::expr::Dest; +use middle::trans::expr; +use middle::trans::glue; use middle::ty::{CopyValue, MoveValue, ReadValue}; use util::common::indenter; use core::dvec::DVec; +use core::dvec; use std::map::HashMap; use syntax::ast::def_id; use syntax::ast; @@ -279,7 +286,7 @@ fn variant_opt(tcx: ty::ctxt, pat_id: ast::node_id) -> Opt { return var(v.disr_val, {enm: enum_id, var: var_id}); } } - core::util::unreachable(); + ::core::util::unreachable(); } ast::def_struct(_) => { return lit(UnitLikeStructLit(pat_id)); @@ -1543,7 +1550,7 @@ fn trans_alt_inner(scope_cx: block, // to an alloca() that will be the value for that local variable. // Note that we use the names because each binding will have many ids // from the various alternatives. - let bindings_map = std::map::HashMap(); + let bindings_map = HashMap(); do pat_bindings(tcx.def_map, arm.pats[0]) |bm, p_id, s, path| { let ident = path_to_ident(path); let variable_ty = node_id_type(bcx, p_id); diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 43d81c9f92b..68e25b58de2 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -34,20 +34,43 @@ use driver::session::Session; use lib::llvm::{ModuleRef, ValueRef, TypeRef, BasicBlockRef}; use lib::llvm::{True, False}; use lib::llvm::{llvm, mk_target_data, mk_type_names}; +use lib; use metadata::common::link_meta; use metadata::{csearch, cstore, decoder, encoder}; +use middle::astencode; use middle::pat_util::*; +use middle::resolve; +use middle::trans::alt; use middle::trans::build::*; +use middle::trans::callee; use middle::trans::common::*; +use middle::trans::consts; +use middle::trans::controlflow; +use middle::trans::datum; +use middle::trans::debuginfo; +use middle::trans::expr; +use middle::trans::foreign; +use middle::trans::glue; +use middle::trans::inline; +use middle::trans::meth; +use middle::trans::monomorphize; +use middle::trans::reachable; use middle::trans::shape::*; +use middle::trans::tvec; use middle::trans::type_of::*; use util::common::indenter; use util::common::is_main_name; use util::ppaux::{ty_to_str, ty_to_short_str}; use util::ppaux; +use core::either; +use core::hash; +use core::int; +use core::io; use core::libc::{c_uint, c_ulonglong}; use core::option::{is_none, is_some}; +use core::option; +use core::uint; use std::map::HashMap; use std::smallintmap; use std::{map, time, list}; diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs index 614a02a9700..e3ffd7a2f9a 100644 --- a/src/librustc/middle/trans/build.rs +++ b/src/librustc/middle/trans/build.rs @@ -16,6 +16,10 @@ use lib::llvm::{ValueRef, TypeRef, BasicBlockRef, BuilderRef, ModuleRef}; use libc::{c_uint, c_int}; use middle::trans::common::*; +use core::cast; +use core::libc; +use core::str; +use core::vec; use std::map::HashMap; use syntax::codemap; diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs index eb0d86b6d04..4c78c60f5b6 100644 --- a/src/librustc/middle/trans/callee.rs +++ b/src/librustc/middle/trans/callee.rs @@ -19,9 +19,15 @@ use lib::llvm::ValueRef; use middle::trans::base::{get_item_val, trans_external_path}; use middle::trans::build::*; +use middle::trans::callee; +use middle::trans::closure; use middle::trans::common::{block, node_id_type_params}; use middle::trans::datum::*; use middle::trans::datum::Datum; +use middle::trans::inline; +use middle::trans::meth; +use middle::trans::monomorphize; +use middle::typeck; use util::common::indenter; use syntax::ast; diff --git a/src/librustc/middle/trans/closure.rs b/src/librustc/middle/trans/closure.rs index 5110bc261f7..26ba1869c27 100644 --- a/src/librustc/middle/trans/closure.rs +++ b/src/librustc/middle/trans/closure.rs @@ -13,10 +13,14 @@ use back::link::{mangle_internal_name_by_path_and_seq}; use back::link::{mangle_internal_name_by_path}; use lib::llvm::llvm; use lib::llvm::{ValueRef, TypeRef}; +use middle::capture; use middle::trans::base::*; use middle::trans::build::*; +use middle::trans::callee; use middle::trans::common::*; use middle::trans::datum::{Datum, INIT, ByRef, ByValue, FromLvalue}; +use middle::trans::expr; +use middle::trans::glue; use middle::trans::type_of::*; use util::ppaux::ty_to_str; diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 25cd169c403..ff78021bfa7 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -13,26 +13,48 @@ */ -use libc::c_uint; -use vec::raw::to_ptr; -use std::map::{HashMap,Set}; -use syntax::{ast, ast_map}; -use driver::session; -use session::Session; -use middle::ty; use back::{link, abi, upcall}; -use syntax::codemap::span; -use lib::llvm::{llvm, target_data, type_names, associate_type, - name_has_type}; +use driver::session; +use driver::session::Session; use lib::llvm::{ModuleRef, ValueRef, TypeRef, BasicBlockRef, BuilderRef}; use lib::llvm::{True, False, Bool}; -use metadata::{csearch}; +use lib::llvm::{llvm, target_data, type_names, associate_type, name_has_type}; +use lib; use metadata::common::link_meta; -use syntax::ast_map::path; -use util::ppaux::ty_to_str; -use syntax::print::pprust::expr_to_str; -use syntax::parse::token::ident_interner; +use metadata::{csearch}; +use middle::astencode; +use middle::resolve; +use middle::trans::base; +use middle::trans::build; +use middle::trans::callee; +use middle::trans::datum; +use middle::trans::debuginfo; +use middle::trans::glue; +use middle::trans::meth; +use middle::trans::reachable; +use middle::trans::shape; +use middle::trans::type_of; +use middle::trans::type_use; +use middle::ty; +use middle::typeck; +use util::ppaux::{expr_repr, ty_to_str}; + +use core::cast; +use core::cmp; +use core::hash; +use core::libc::c_uint; +use core::ptr; +use core::str; +use core::to_bytes; +use core::vec::raw::to_ptr; +use core::vec; +use std::map::{HashMap, Set}; use syntax::ast::ident; +use syntax::ast_map::path; +use syntax::codemap::span; +use syntax::parse::token::ident_interner; +use syntax::print::pprust::expr_to_str; +use syntax::{ast, ast_map}; type namegen = fn@(~str) -> ident; fn new_namegen(intr: @ident_interner) -> namegen { @@ -633,7 +655,7 @@ impl block { } fn expr_to_str(e: @ast::expr) -> ~str { - util::ppaux::expr_repr(self.tcx(), e) + expr_repr(self.tcx(), e) } fn expr_is_lval(e: @ast::expr) -> bool { @@ -1196,7 +1218,7 @@ impl mono_param_id : to_bytes::IterBytes { } } -impl mono_id_ : core::to_bytes::IterBytes { +impl mono_id_ : to_bytes::IterBytes { pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { to_bytes::iter_bytes_2(&self.def, &self.params, lsb0, f); } diff --git a/src/librustc/middle/trans/consts.rs b/src/librustc/middle/trans/consts.rs index 355e7801480..94da557d39b 100644 --- a/src/librustc/middle/trans/consts.rs +++ b/src/librustc/middle/trans/consts.rs @@ -8,8 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use middle::const_eval; use middle::trans::base::get_insn_ctxt; use middle::trans::common::*; +use middle::trans::consts; +use middle::trans::expr; +use middle::ty; use syntax::{ast, ast_util, codemap, ast_map}; diff --git a/src/librustc/middle/trans/controlflow.rs b/src/librustc/middle/trans/controlflow.rs index 2a9cece231b..f23a07e5dbe 100644 --- a/src/librustc/middle/trans/controlflow.rs +++ b/src/librustc/middle/trans/controlflow.rs @@ -10,9 +10,12 @@ use lib::llvm::ValueRef; use middle::trans::base::*; +use middle::trans::callee; use middle::trans::common::*; use middle::trans::datum::*; +use core::str; + fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export. fn trans_block(bcx: block, b: ast::blk, dest: expr::Dest) -> block { diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs index e303b3611c5..1723c0bddd3 100644 --- a/src/librustc/middle/trans/datum.rs +++ b/src/librustc/middle/trans/datum.rs @@ -99,9 +99,18 @@ use lib::llvm::ValueRef; use middle::trans::base::*; use middle::trans::build::*; use middle::trans::common::*; +use middle::trans::common; +use middle::trans::tvec; +use middle::typeck; use util::common::indenter; use util::ppaux::ty_to_str; +use core::cmp; +use core::option; +use core::uint; +use core::vec; +use syntax::parse::token::special_idents; + enum CopyAction { INIT, DROP_EXISTING @@ -669,7 +678,7 @@ impl Datum { // Check whether this struct is a newtype struct. let fields = ty::struct_fields(ccx.tcx, did, substs); if fields.len() != 1 || fields[0].ident != - syntax::parse::token::special_idents::unnamed_field { + special_idents::unnamed_field { return None; } diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index b255b47bab3..ed188a7019e 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -15,9 +15,15 @@ use middle::pat_util::*; use middle::trans::base; use middle::trans::build::B; use middle::trans::common::*; +use middle::trans::shape; +use middle::trans::type_of; +use middle::trans; use middle::ty; use util::ppaux::ty_to_str; +use core::libc; +use core::option; +use core::sys; use std::map::HashMap; use std::map; use syntax::ast::Ty; diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index 66246965533..d3a1772a6b0 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -112,10 +112,18 @@ lvalues are *never* stored by value. */ use lib::llvm::ValueRef; +use middle::resolve; use middle::trans::base::*; use middle::trans::callee::{AutorefArg, DoAutorefArg, DontAutorefArg}; +use middle::trans::callee; +use middle::trans::closure; use middle::trans::common::*; +use middle::trans::consts; +use middle::trans::controlflow; use middle::trans::datum::*; +use middle::trans::machine; +use middle::trans::meth; +use middle::trans::tvec; use middle::ty::MoveValue; use middle::ty::struct_mutable_fields; use middle::ty::{AutoPtr, AutoBorrowVec, AutoBorrowVecRef, AutoBorrowFn}; diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs index e7cdf82fd15..b32d6ef6087 100644 --- a/src/librustc/middle/trans/foreign.rs +++ b/src/librustc/middle/trans/foreign.rs @@ -17,21 +17,26 @@ use lib::llvm::{SequentiallyConsistent, Acquire, Release, Xchg}; use lib::llvm::{Struct, Array, ModuleRef, CallConv, Attribute}; use lib::llvm::{StructRetAttribute, ByValAttribute}; use lib::llvm::{llvm, TypeRef, ValueRef, Integer, Pointer, Float, Double}; +use lib; use middle::trans::base::*; use middle::trans::build::*; use middle::trans::callee::*; use middle::trans::common::*; use middle::trans::datum::*; use middle::trans::expr::{Dest, Ignore}; +use middle::trans::glue; +use middle::trans::machine; +use middle::trans::shape; use middle::trans::type_of::*; +use middle::trans::type_of; use middle::ty::{FnTyBase, FnMeta, FnSig}; use util::ppaux::ty_to_str; use core::libc::c_uint; -use std::map::HashMap; use syntax::codemap::span; use syntax::{ast, ast_util}; use syntax::{attr, ast_map}; +use syntax::parse::token::special_idents; export link_name, trans_foreign_mod, register_foreign_fn, trans_foreign_fn, trans_intrinsic; @@ -1284,7 +1289,7 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl, let t = ty::node_id_to_type(ccx.tcx, id); let ps = link::mangle_internal_name_by_path( ccx, vec::append_one(path, ast_map::path_name( - syntax::parse::token::special_idents::clownshoe_abi + special_idents::clownshoe_abi ))); let llty = type_of_fn_from_ty(ccx, t); let llfndecl = decl_internal_cdecl_fn(ccx.llmod, ps, llty); @@ -1323,7 +1328,7 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl, let shim_name = link::mangle_internal_name_by_path( ccx, vec::append_one(path, ast_map::path_name( - syntax::parse::token::special_idents::clownshoe_stack_shim + special_idents::clownshoe_stack_shim ))); return build_shim_fn_(ccx, shim_name, llrustfn, tys, lib::llvm::CCallConv, diff --git a/src/librustc/middle/trans/glue.rs b/src/librustc/middle/trans/glue.rs index a42dee615e4..9396f64fdbe 100644 --- a/src/librustc/middle/trans/glue.rs +++ b/src/librustc/middle/trans/glue.rs @@ -14,9 +14,17 @@ use lib::llvm::{ValueRef, TypeRef}; use middle::trans::base::*; +use middle::trans::callee; +use middle::trans::closure; use middle::trans::common::*; use middle::trans::build::*; +use middle::trans::reflect; +use middle::trans::tvec; use middle::trans::type_of::type_of; +use middle::trans::uniq; + +use core::io; +use core::str; fn trans_free(cx: block, v: ValueRef) -> block { let _icx = cx.insn_ctxt("trans_free"); diff --git a/src/librustc/middle/trans/inline.rs b/src/librustc/middle/trans/inline.rs index 6f5aa792c47..d97272b0959 100644 --- a/src/librustc/middle/trans/inline.rs +++ b/src/librustc/middle/trans/inline.rs @@ -8,11 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use middle::astencode; use middle::trans::base::{get_insn_ctxt}; use middle::trans::base::{impl_owned_self, impl_self, no_self}; use middle::trans::base::{trans_item, get_item_val, self_arg, trans_fn}; use middle::trans::common::*; +use middle::trans::common; +use middle::trans::inline; +use middle::trans::monomorphize; +use core::vec; use syntax::ast; use syntax::ast_map::{path, path_mod, path_name}; use syntax::ast_util::local_def; diff --git a/src/librustc/middle/trans/machine.rs b/src/librustc/middle/trans/machine.rs index 1c6e500d806..b0573782054 100644 --- a/src/librustc/middle/trans/machine.rs +++ b/src/librustc/middle/trans/machine.rs @@ -11,6 +11,10 @@ // Information concerning the machine representation of various types. use middle::trans::common::*; +use middle::trans::type_of; +use middle::ty; + +use syntax::parse::token::special_idents; // Creates a simpler, size-equivalent type. The resulting type is guaranteed // to have (a) the same size as the type that was passed in; (b) to be non- @@ -39,7 +43,7 @@ pub fn simplify_type(tcx: ty::ctxt, typ: ty::t) -> ty::t { ty::ty_struct(did, ref substs) => { let simpl_fields = (if ty::ty_dtor(tcx, did).is_present() { // remember the drop flag - ~[{ident: syntax::parse::token::special_idents::dtor, + ~[{ident: special_idents::dtor, mt: {ty: ty::mk_u8(tcx), mutbl: ast::m_mutbl}}] } else { ~[] }) + diff --git a/src/librustc/middle/trans/meth.rs b/src/librustc/middle/trans/meth.rs index 1dd3ae0ef0e..c5f7fc02384 100644 --- a/src/librustc/middle/trans/meth.rs +++ b/src/librustc/middle/trans/meth.rs @@ -9,16 +9,24 @@ // except according to those terms. use back::{link, abi}; +use driver; use lib::llvm::llvm::LLVMGetParam; use lib::llvm::llvm; use lib::llvm::{ValueRef, TypeRef}; +use lib; use metadata::csearch; use middle::trans::base::*; use middle::trans::build::*; use middle::trans::callee::*; +use middle::trans::callee; use middle::trans::common::*; use middle::trans::expr::{SaveIn, Ignore}; +use middle::trans::expr; +use middle::trans::glue; +use middle::trans::inline; +use middle::trans::monomorphize; use middle::trans::type_of::*; +use middle::typeck; use util::ppaux::{ty_to_str, tys_to_str}; use core::libc::c_uint; diff --git a/src/librustc/middle/trans/monomorphize.rs b/src/librustc/middle/trans/monomorphize.rs index 9d662f87551..f74c4b96e02 100644 --- a/src/librustc/middle/trans/monomorphize.rs +++ b/src/librustc/middle/trans/monomorphize.rs @@ -14,10 +14,21 @@ use middle::trans::base::{set_inline_hint_if_appr, set_inline_hint}; use middle::trans::base::{trans_enum_variant, trans_struct_dtor}; use middle::trans::base::{trans_fn, impl_self, decl_internal_cdecl_fn}; use middle::trans::base::{trans_item, get_item_val, no_self, self_arg}; +use middle::trans::base; use middle::trans::common::*; +use middle::trans::datum; +use middle::trans::foreign; +use middle::trans::machine; +use middle::trans::meth; +use middle::trans::shape; use middle::trans::type_of::type_of_fn_from_ty; +use middle::trans::type_of; +use middle::trans::type_use; use middle::ty::{FnTyBase, FnMeta, FnSig}; +use middle::typeck; +use core::option; +use core::vec; use syntax::ast; use syntax::ast_map::{path, path_mod, path_name}; use syntax::ast_util::local_def; diff --git a/src/librustc/middle/trans/reachable.rs b/src/librustc/middle/trans/reachable.rs index fbaa038b4cc..d0363b97321 100644 --- a/src/librustc/middle/trans/reachable.rs +++ b/src/librustc/middle/trans/reachable.rs @@ -15,17 +15,22 @@ // makes all other generics or inline functions that it references // reachable as well. +use driver::session::*; +use middle::resolve; +use middle::ty; +use middle::typeck; + +use core::vec; +use std::map::HashMap; use syntax::ast::*; -use syntax::{visit, ast_util, ast_map}; use syntax::ast_util::def_id_of_def; use syntax::attr; use syntax::print::pprust::expr_to_str; -use std::map::HashMap; -use driver::session::*; +use syntax::{visit, ast_util, ast_map}; export map, find_reachable; -type map = std::map::HashMap; +type map = HashMap; type ctx = {exp_map2: resolve::ExportMap2, tcx: ty::ctxt, @@ -34,7 +39,7 @@ type ctx = {exp_map2: resolve::ExportMap2, fn find_reachable(crate_mod: _mod, exp_map2: resolve::ExportMap2, tcx: ty::ctxt, method_map: typeck::method_map) -> map { - let rmap = std::map::HashMap(); + let rmap = HashMap(); let cx = {exp_map2: exp_map2, tcx: tcx, method_map: method_map, rmap: rmap}; traverse_public_mod(cx, ast::crate_node_id, crate_mod); diff --git a/src/librustc/middle/trans/reflect.rs b/src/librustc/middle/trans/reflect.rs index d15a9c101b9..7f770899c50 100644 --- a/src/librustc/middle/trans/reflect.rs +++ b/src/librustc/middle/trans/reflect.rs @@ -13,9 +13,13 @@ use lib::llvm::{TypeRef, ValueRef}; use middle::trans::base::*; use middle::trans::build::*; use middle::trans::callee::{ArgVals, DontAutorefArg}; +use middle::trans::callee; use middle::trans::common::*; use middle::trans::datum::*; use middle::trans::expr::SaveIn; +use middle::trans::glue; +use middle::trans::meth; +use middle::trans::shape; use middle::trans::type_of::*; use util::ppaux::ty_to_str; diff --git a/src/librustc/middle/trans/shape.rs b/src/librustc/middle/trans/shape.rs index 51c3cb9362f..c6b8457bb95 100644 --- a/src/librustc/middle/trans/shape.rs +++ b/src/librustc/middle/trans/shape.rs @@ -17,12 +17,14 @@ use lib::llvm::{True, False, ModuleRef, TypeRef, ValueRef}; use middle::trans::base; use middle::trans::common::*; use middle::trans::machine::*; +use middle::trans; use middle::ty::field; use middle::ty; use util::ppaux::ty_to_str; use core::dvec::DVec; use core::option::is_some; +use core::vec; use std::map::HashMap; use syntax::ast; use syntax::ast_util::dummy_sp; @@ -36,13 +38,13 @@ type ctxt = {mut next_tag_id: u16, pad: u16, pad2: u32}; fn mk_global(ccx: @crate_ctxt, name: ~str, llval: ValueRef, internal: bool) -> ValueRef { let llglobal = do str::as_c_str(name) |buf| { - lib::llvm::llvm::LLVMAddGlobal(ccx.llmod, val_ty(llval), buf) + llvm::LLVMAddGlobal(ccx.llmod, val_ty(llval), buf) }; - lib::llvm::llvm::LLVMSetInitializer(llglobal, llval); - lib::llvm::llvm::LLVMSetGlobalConstant(llglobal, True); + llvm::LLVMSetInitializer(llglobal, llval); + llvm::LLVMSetGlobalConstant(llglobal, True); if internal { - lib::llvm::SetLinkage(llglobal, lib::llvm::InternalLinkage); + ::lib::llvm::SetLinkage(llglobal, ::lib::llvm::InternalLinkage); } return llglobal; @@ -51,7 +53,7 @@ fn mk_global(ccx: @crate_ctxt, name: ~str, llval: ValueRef, internal: bool) -> fn mk_ctxt(llmod: ModuleRef) -> ctxt { let llshapetablesty = trans::common::T_named_struct(~"shapes"); let _llshapetables = str::as_c_str(~"shapes", |buf| { - lib::llvm::llvm::LLVMAddGlobal(llmod, llshapetablesty, buf) + llvm::LLVMAddGlobal(llmod, llshapetablesty, buf) }); return {mut next_tag_id: 0u16, pad: 0u16, pad2: 0u32}; diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs index 2eaf15818d8..b6df2486af2 100644 --- a/src/librustc/middle/trans/tvec.rs +++ b/src/librustc/middle/trans/tvec.rs @@ -14,7 +14,11 @@ use middle::trans::build::*; use middle::trans::common::*; use middle::trans::datum::*; use middle::trans::expr::{Dest, Ignore, SaveIn}; +use middle::trans::expr; +use middle::trans::glue; use middle::trans::shape::llsize_of; +use middle::trans::type_of; +use middle::ty; use util::common::indenter; use util::ppaux::ty_to_str; diff --git a/src/librustc/middle/trans/type_of.rs b/src/librustc/middle/trans/type_of.rs index f146d556a9d..85830ca9277 100644 --- a/src/librustc/middle/trans/type_of.rs +++ b/src/librustc/middle/trans/type_of.rs @@ -11,6 +11,9 @@ use lib::llvm::llvm; use lib::llvm::{TypeRef}; use middle::trans::common::*; +use middle::trans::common; +use middle::trans::expr; +use util::ppaux; use std::map::HashMap; use syntax::ast; @@ -258,7 +261,7 @@ fn llvm_type_name(cx: @crate_ctxt, return fmt!( "%s %s[#%d]", name, - util::ppaux::parameterized( + ppaux::parameterized( cx.tcx, ty::item_path_str(cx.tcx, did), None, diff --git a/src/librustc/middle/trans/type_use.rs b/src/librustc/middle/trans/type_use.rs index 7f3b78359fe..ee2d4a84729 100644 --- a/src/librustc/middle/trans/type_use.rs +++ b/src/librustc/middle/trans/type_use.rs @@ -28,8 +28,13 @@ // invasive.) use metadata::csearch; +use middle::freevars; use middle::trans::common::*; +use middle::trans::inline; +use core::option; +use core::uint; +use core::vec; use std::list::{List, Cons, Nil}; use std::list; use std::map::HashMap; diff --git a/src/librustc/middle/trans/uniq.rs b/src/librustc/middle/trans/uniq.rs index 30d47d60e58..c4490dd86f3 100644 --- a/src/librustc/middle/trans/uniq.rs +++ b/src/librustc/middle/trans/uniq.rs @@ -8,11 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use back; use lib::llvm::ValueRef; use middle::trans::base::*; use middle::trans::build::*; use middle::trans::common::*; use middle::trans::datum::immediate_rvalue; +use middle::trans::datum; +use middle::trans::glue; use syntax::ast; diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index dc263215646..c072889c524 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -10,25 +10,43 @@ #[warn(deprecated_pattern)]; -use core::dvec::DVec; -use std::{map, smallintmap}; -use result::Result; -use std::map::HashMap; use driver::session; -use session::Session; -use syntax::{ast, ast_map}; -use syntax::ast_util; -use syntax::ast_util::{is_local, local_def}; -use syntax::codemap::span; use metadata::csearch; -use util::ppaux::{region_to_str, explain_region, vstore_to_str, - note_and_explain_region, bound_region_to_str}; -use middle::lint; +use metadata; +use middle::const_eval; +use middle::freevars; use middle::lint::{get_lint_level, allow}; -use syntax::ast::*; -use syntax::print::pprust::*; -use util::ppaux::{ty_to_str, proto_ty_to_str, tys_to_str}; +use middle::lint; use middle::resolve::{Impl, MethodInfo}; +use middle::resolve; +use middle::ty; +use middle::typeck; +use middle; +use session::Session; +use util::ppaux::{note_and_explain_region, bound_region_to_str}; +use util::ppaux::{region_to_str, explain_region, vstore_to_str}; +use util::ppaux::{ty_to_str, proto_ty_to_str, tys_to_str}; + +use core::cast; +use core::cmp; +use core::dvec::DVec; +use core::dvec; +use core::ops; +use core::option; +use core::result::Result; +use core::result; +use core::to_bytes; +use core::uint; +use core::vec; +use std::map::HashMap; +use std::{map, smallintmap}; +use syntax::ast::*; +use syntax::ast_util::{is_local, local_def}; +use syntax::ast_util; +use syntax::codemap::span; +use syntax::print::pprust::*; +use syntax::{ast, ast_map}; +use syntax; export ProvidedMethodSource; export ProvidedMethodInfo; @@ -1542,7 +1560,8 @@ fn substs_is_noop(substs: &substs) -> bool { fn substs_to_str(cx: ctxt, substs: &substs) -> ~str { fmt!("substs(self_r=%s, self_ty=%s, tps=%?)", substs.self_r.map_default(~"none", |r| region_to_str(cx, *r)), - substs.self_ty.map_default(~"none", |t| ty_to_str(cx, *t)), + substs.self_ty.map_default(~"none", + |t| ::util::ppaux::ty_to_str(cx, *t)), tys_to_str(cx, substs.tps)) } @@ -1552,7 +1571,7 @@ fn param_bound_to_str(cx: ctxt, pb: ¶m_bound) -> ~str { bound_durable => ~"durable", bound_owned => ~"owned", bound_const => ~"const", - bound_trait(t) => ty_to_str(cx, t) + bound_trait(t) => ::util::ppaux::ty_to_str(cx, t) } } @@ -1566,11 +1585,11 @@ fn subst(cx: ctxt, debug!("subst(substs=%s, typ=%s)", substs_to_str(cx, substs), - ty_to_str(cx, typ)); + ::util::ppaux::ty_to_str(cx, typ)); if substs_is_noop(substs) { return typ; } let r = do_subst(cx, substs, typ); - debug!(" r = %s", ty_to_str(cx, r)); + debug!(" r = %s", ::util::ppaux::ty_to_str(cx, r)); return r; fn do_subst(cx: ctxt, @@ -1588,7 +1607,8 @@ fn subst(cx: ctxt, re_bound(br_self) => substs.self_r.expect( fmt!("ty::subst: \ Reference to self region when given substs with no \ - self region, ty = %s", ty_to_str(cx, typ))), + self region, ty = %s", + ::util::ppaux::ty_to_str(cx, typ))), _ => r }, |t| do_subst(cx, substs, t), @@ -2351,8 +2371,8 @@ fn is_instantiable(cx: ctxt, r_ty: t) -> bool { fn type_requires(cx: ctxt, seen: @mut ~[def_id], r_ty: t, ty: t) -> bool { debug!("type_requires(%s, %s)?", - ty_to_str(cx, r_ty), - ty_to_str(cx, ty)); + ::util::ppaux::ty_to_str(cx, r_ty), + ::util::ppaux::ty_to_str(cx, ty)); let r = { get(r_ty).sty == get(ty).sty || @@ -2360,8 +2380,8 @@ fn is_instantiable(cx: ctxt, r_ty: t) -> bool { }; debug!("type_requires(%s, %s)? %b", - ty_to_str(cx, r_ty), - ty_to_str(cx, ty), + ::util::ppaux::ty_to_str(cx, r_ty), + ::util::ppaux::ty_to_str(cx, ty), r); return r; } @@ -2369,8 +2389,8 @@ fn is_instantiable(cx: ctxt, r_ty: t) -> bool { fn subtypes_require(cx: ctxt, seen: @mut ~[def_id], r_ty: t, ty: t) -> bool { debug!("subtypes_require(%s, %s)?", - ty_to_str(cx, r_ty), - ty_to_str(cx, ty)); + ::util::ppaux::ty_to_str(cx, r_ty), + ::util::ppaux::ty_to_str(cx, ty)); let r = match get(ty).sty { ty_nil | @@ -2447,8 +2467,8 @@ fn is_instantiable(cx: ctxt, r_ty: t) -> bool { }; debug!("subtypes_require(%s, %s)? %b", - ty_to_str(cx, r_ty), - ty_to_str(cx, ty), + ::util::ppaux::ty_to_str(cx, r_ty), + ::util::ppaux::ty_to_str(cx, ty), r); return r; @@ -2461,7 +2481,8 @@ fn is_instantiable(cx: ctxt, r_ty: t) -> bool { fn type_structurally_contains(cx: ctxt, ty: t, test: fn(x: &sty) -> bool) -> bool { let sty = &get(ty).sty; - debug!("type_structurally_contains: %s", ty_to_str(cx, ty)); + debug!("type_structurally_contains: %s", + ::util::ppaux::ty_to_str(cx, ty)); if test(sty) { return true; } match *sty { ty_enum(did, ref substs) => { @@ -3260,8 +3281,8 @@ fn occurs_check(tcx: ctxt, sp: span, vid: TyVid, rt: t) { tcx.sess.span_fatal (sp, ~"type inference failed because I \ could not find a type\n that's both of the form " - + ty_to_str(tcx, mk_var(tcx, vid)) + - ~" and of the form " + ty_to_str(tcx, rt) + + + ::util::ppaux::ty_to_str(tcx, mk_var(tcx, vid)) + + ~" and of the form " + ::util::ppaux::ty_to_str(tcx, rt) + ~" - such a type would have to be infinitely large."); } } @@ -3343,7 +3364,7 @@ fn ty_sort_str(cx: ctxt, t: t) -> ~str { ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) | ty_estr(_) | ty_type | ty_opaque_box | ty_opaque_closure_ptr(_) => { - ty_to_str(cx, t) + ::util::ppaux::ty_to_str(cx, t) } ty_enum(id, _) => fmt!("enum %s", item_path_str(cx, id)), diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 4c44642b325..82438f86e9f 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -53,11 +53,17 @@ */ use middle::ty::{FnTyBase, FnMeta, FnSig}; +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 core::result; +use core::vec; +use syntax::ast; + pub trait ast_conv { fn tcx() -> ty::ctxt; fn ccx() -> @crate_ctxt; diff --git a/src/librustc/middle/typeck/check/alt.rs b/src/librustc/middle/typeck/check/alt.rs index 95f44af48e1..b62b4d79712 100644 --- a/src/librustc/middle/typeck/check/alt.rs +++ b/src/librustc/middle/typeck/check/alt.rs @@ -10,8 +10,14 @@ use middle::pat_util::{pat_is_binding, pat_is_const}; use middle::pat_util::{pat_is_variant_or_struct}; +use middle::ty; +use middle::typeck::check::demand; +use core::vec; +use std::map::HashMap; +use syntax::ast; use syntax::ast_util::walk_pat; +use syntax::ast_util; use syntax::print::pprust; fn check_alt(fcx: @fn_ctxt, @@ -195,13 +201,13 @@ fn check_struct_pat_fields(pcx: pat_ctxt, let tcx = pcx.fcx.ccx.tcx; // Index the class fields. - let field_map = std::map::HashMap(); + let field_map = HashMap(); for class_fields.eachi |i, class_field| { field_map.insert(class_field.ident, i); } // Typecheck each field. - let found_fields = std::map::HashMap(); + let found_fields = HashMap(); for fields.each |field| { match field_map.find(field.ident) { Some(index) => { diff --git a/src/librustc/middle/typeck/check/demand.rs b/src/librustc/middle/typeck/check/demand.rs index 89726e22283..1f8c9c84550 100644 --- a/src/librustc/middle/typeck/check/demand.rs +++ b/src/librustc/middle/typeck/check/demand.rs @@ -8,7 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use middle::ty; use middle::typeck::check::fn_ctxt; +use middle::typeck::infer; + +use core::result; +use syntax::ast; // 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 765bf0cfdff..a3df14be9c6 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -80,14 +80,22 @@ obtained the type `Foo`, we would never match this method. */ use middle::resolve::{Impl, MethodInfo}; +use middle::resolve; use middle::ty::*; +use middle::ty; use middle::typeck::check; +use middle::typeck::check::vtable; use middle::typeck::coherence::get_base_type_def_id; +use middle::typeck::infer; use core::dvec::DVec; +use core::result; +use core::uint; +use core::vec; 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}; +use syntax::ast; use syntax::ast_map; use syntax::ast_map::node_id_to_str; use syntax::ast_util::dummy_sp; diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 93bdfd5ccda..70f7dbb4a4e 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -76,24 +76,44 @@ type parameter). */ +use middle::capture; +use middle::const_eval; +use middle::pat_util; use middle::ty::{TyVid, vid, FnTyBase, FnMeta, FnSig, VariantInfo_}; +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}; +use middle::typeck::astconv; 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::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 util::ppaux; +use core::either; +use core::option; +use core::ptr; use core::result::{Result, Ok, Err}; +use core::result; +use core::str; +use core::vec; use std::map::HashMap; +use std::map; use syntax::ast::ty_i; +use syntax::ast; +use syntax::ast_map; use syntax::ast_util::{is_local, visibility_to_privacy, Private, Public}; +use syntax::ast_util; +use syntax::codemap; use syntax::parse::token::special_idents; use syntax::print::pprust; +use syntax::visit; +use syntax; export alt; export vtable; @@ -1688,7 +1708,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, fn check_struct_constructor(fcx: @fn_ctxt, id: ast::node_id, - span: syntax::codemap::span, + span: codemap::span, class_id: ast::def_id, fields: ~[ast::field], base_expr: Option<@ast::expr>) -> bool { @@ -1769,7 +1789,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, fn check_struct_enum_variant(fcx: @fn_ctxt, id: ast::node_id, - span: syntax::codemap::span, + span: codemap::span, enum_id: ast::def_id, variant_id: ast::def_id, fields: ~[ast::field]) -> bool { @@ -2997,7 +3017,7 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::foreign_item) { (1u, ~[], ty::mk_nil_ptr(tcx)) } ~"visit_tydesc" => { - let tydesc_name = syntax::parse::token::special_idents::tydesc; + let tydesc_name = special_idents::tydesc; let ty_visitor_name = tcx.sess.ident_of(~"TyVisitor"); assert tcx.intrinsic_defs.contains_key(tydesc_name); assert ccx.tcx.intrinsic_defs.contains_key(ty_visitor_name); diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs index 5467eae8266..797a21c38e2 100644 --- a/src/librustc/middle/typeck/check/regionck.rs +++ b/src/librustc/middle/typeck/check/regionck.rs @@ -32,12 +32,16 @@ use middle::pat_util::pat_bindings; use middle::ty::{encl_region, re_scope}; 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 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::print::pprust; +use syntax::visit; enum rcx { rcx_({fcx: @fn_ctxt, mut errors_reported: uint}) } type rvt = visit::vt<@rcx>; diff --git a/src/librustc/middle/typeck/check/regionmanip.rs b/src/librustc/middle/typeck/check/regionmanip.rs index 0bcb032d825..dfba93f947f 100644 --- a/src/librustc/middle/typeck/check/regionmanip.rs +++ b/src/librustc/middle/typeck/check/regionmanip.rs @@ -11,8 +11,10 @@ // #[warn(deprecated_mode)]; // #[warn(deprecated_pattern)]; +use middle::ty; use util::ppaux; +use syntax::ast; use syntax::print::pprust::{expr_to_str}; // Helper functions related to manipulating region types. diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs index 5751a462760..53d2084acab 100644 --- a/src/librustc/middle/typeck/check/vtable.rs +++ b/src/librustc/middle/typeck/check/vtable.rs @@ -8,15 +8,24 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use middle::resolve; +use middle::ty; use middle::typeck::check::{fn_ctxt, impl_self_ty}; 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 util::common::indenter; use util::ppaux; +use core::result; +use core::uint; +use core::vec; use result::{Result, Ok, Err}; +use syntax::ast; +use syntax::ast_util; use syntax::codemap::span; use syntax::print::pprust; +use syntax::visit; // vtable resolution looks for places where trait bounds are // subsituted in and figures out which vtable is used. There is some diff --git a/src/librustc/middle/typeck/check/writeback.rs b/src/librustc/middle/typeck/check/writeback.rs index dd3f240f343..84d3eea1b35 100644 --- a/src/librustc/middle/typeck/check/writeback.rs +++ b/src/librustc/middle/typeck/check/writeback.rs @@ -12,12 +12,18 @@ // unresolved type variables and replaces "ty_var" types with their // substitutions. +use middle::pat_util; +use middle::ty; use middle::typeck::check::{fn_ctxt, lookup_local}; use middle::typeck::infer::{force_all, resolve_all, resolve_region}; use middle::typeck::infer::{resolve_type}; +use middle::typeck::infer; use util::ppaux; -use result::{Result, Ok, Err}; +use core::result::{Result, Ok, Err}; +use core::vec; +use syntax::ast; +use syntax::visit; export resolve_type_vars_in_fn; export resolve_type_vars_in_expr; diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs index 15edea52139..1dd10f61f1f 100644 --- a/src/librustc/middle/typeck/coherence.rs +++ b/src/librustc/middle/typeck/coherence.rs @@ -14,8 +14,10 @@ // has at most one implementation for each type. Then we build a mapping from // each trait in the system to its implementations. +use driver; use metadata::csearch::{ProvidedTraitMethodInfo, each_path, get_impl_traits}; use metadata::csearch::{get_impls_for_mod}; +use metadata::csearch; use metadata::cstore::{CStore, iter_crate_data}; use metadata::decoder::{dl_def, dl_field, dl_impl}; use middle::resolve::{Impl, MethodInfo}; @@ -27,6 +29,7 @@ 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_opaque_closure_ptr, ty_unboxed_vec, type_kind_ext}; use middle::ty::{type_is_ty_var}; +use middle::ty; 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}; @@ -35,10 +38,13 @@ use syntax::ast::{item, item_struct, item_const, item_enum, item_fn}; use syntax::ast::{item_foreign_mod, item_impl, item_mac, item_mod}; use syntax::ast::{item_trait, item_ty, local_crate, method, node_id}; use syntax::ast::{trait_ref}; +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::attr; use syntax::codemap::span; +use syntax::parse; use syntax::visit::{default_simple_visitor, default_visitor}; use syntax::visit::{mk_simple_visitor, mk_vt, visit_crate, visit_item}; use syntax::visit::{visit_mod}; @@ -46,9 +52,12 @@ use util::ppaux::ty_to_str; use core::dvec::DVec; use core::result::Ok; -use std::map::HashMap; +use core::send_map; use core::uint::range; +use core::uint; use core::vec::{len, push}; +use core::vec; +use std::map::HashMap; struct UniversalQuantificationResult { monotype: t, @@ -307,7 +316,7 @@ impl CoherenceChecker { for self.each_provided_trait_method(trait_did) |trait_method| { // Synthesize an ID. let tcx = self.crate_context.tcx; - let new_id = syntax::parse::next_node_id(tcx.sess.parse_sess); + let new_id = parse::next_node_id(tcx.sess.parse_sess); let new_did = local_def(new_id); // XXX: Perform substitutions. @@ -883,7 +892,7 @@ impl CoherenceChecker { // Create a new def ID for this provided method. let parse_sess = &self.crate_context.tcx.sess.parse_sess; - let new_did = local_def(syntax::parse::next_node_id(*parse_sess)); + let new_did = local_def(parse::next_node_id(*parse_sess)); let provided_method_info = @ProvidedMethodInfo { diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 45f1ad7470c..8a897e72664 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -30,15 +30,28 @@ are represented as `ty_param()` instances. */ +use metadata::csearch; use middle::ty::{FnMeta, FnSig, FnTyBase, InstantiatedTraitRef}; +use middle::ty; use middle::typeck::astconv::{ast_conv, ty_of_fn_decl, ty_of_arg}; use middle::typeck::astconv::{ast_ty_to_ty}; +use middle::typeck::astconv; +use middle::typeck::infer; use middle::typeck::rscope::*; +use middle::typeck::rscope; use util::common::pluralize; use util::ppaux; use util::ppaux::bound_to_str; +use core::dvec; +use core::option; +use core::vec; +use syntax::ast; +use syntax::ast_map; use syntax::ast_util::trait_method_to_ty_method; +use syntax::ast_util; +use syntax::codemap; +use syntax::visit; fn collect_item_types(ccx: @crate_ctxt, crate: @ast::crate) { @@ -47,7 +60,7 @@ fn collect_item_types(ccx: @crate_ctxt, crate: @ast::crate) { for crate.node.module.items.each |crate_item| { if crate_item.ident - == syntax::parse::token::special_idents::intrinsic { + == ::syntax::parse::token::special_idents::intrinsic { match crate_item.node { ast::item_mod(m) => { diff --git a/src/librustc/middle/typeck/infer/assignment.rs b/src/librustc/middle/typeck/infer/assignment.rs index 1abe2156a1e..a41c1efb6c3 100644 --- a/src/librustc/middle/typeck/infer/assignment.rs +++ b/src/librustc/middle/typeck/infer/assignment.rs @@ -58,9 +58,13 @@ // A. But this upper-bound might be stricter than what is truly // needed. +use middle::ty; use middle::typeck::infer::combine::combine_fields; use middle::typeck::infer::to_str::ToStr; +use core::option; +use syntax::ast; + fn to_ares(+c: cres) -> ares { match c { Ok(_) => Ok(None), diff --git a/src/librustc/middle/typeck/infer/combine.rs b/src/librustc/middle/typeck/infer/combine.rs index da66ecd922b..dc60ee9caee 100644 --- a/src/librustc/middle/typeck/infer/combine.rs +++ b/src/librustc/middle/typeck/infer/combine.rs @@ -54,10 +54,14 @@ // terms of error reporting, although we do not do that properly right // now. +use middle::ty; use middle::ty::{FnTyBase, FnMeta, FnSig}; +use middle::typeck::infer::sub::Sub; use middle::typeck::infer::to_str::ToStr; +use core::vec; use syntax::ast::Onceness; +use syntax::ast; 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 9537325c097..c5c19cd16e8 100644 --- a/src/librustc/middle/typeck/infer/floating.rs +++ b/src/librustc/middle/typeck/infer/floating.rs @@ -14,9 +14,13 @@ Code related to floating-point type inference. */ +use middle::ty; use middle::ty::ty_float; use middle::typeck::infer::to_str::ToStr; +use core::uint; +use syntax::ast; + // Bitvector to represent sets of floating-point types. pub enum float_ty_set = uint; diff --git a/src/librustc/middle/typeck/infer/glb.rs b/src/librustc/middle/typeck/infer/glb.rs index b6e179d27a9..6a6a817e97e 100644 --- a/src/librustc/middle/typeck/infer/glb.rs +++ b/src/librustc/middle/typeck/infer/glb.rs @@ -8,8 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use middle::ty; use middle::typeck::infer::combine::*; use middle::typeck::infer::lattice::*; +use middle::typeck::infer::sub::Sub; use middle::typeck::infer::to_str::ToStr; use syntax::ast::{Many, Once}; diff --git a/src/librustc/middle/typeck/infer/integral.rs b/src/librustc/middle/typeck/infer/integral.rs index f3e5e1ac73e..e6701182342 100644 --- a/src/librustc/middle/typeck/infer/integral.rs +++ b/src/librustc/middle/typeck/infer/integral.rs @@ -14,8 +14,12 @@ Code related to integral type inference. */ +use middle::ty; use middle::typeck::infer::to_str::ToStr; +use core::uint; +use syntax::ast; + // Bitvector to represent sets of integral types enum int_ty_set = uint; diff --git a/src/librustc/middle/typeck/infer/lattice.rs b/src/librustc/middle/typeck/infer/lattice.rs index b47dd206452..c8d63ea796e 100644 --- a/src/librustc/middle/typeck/infer/lattice.rs +++ b/src/librustc/middle/typeck/infer/lattice.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use middle::ty; use middle::typeck::infer::combine::*; 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 cfb93e93a65..7a402e2218d 100644 --- a/src/librustc/middle/typeck/infer/lub.rs +++ b/src/librustc/middle/typeck/infer/lub.rs @@ -8,10 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use middle::ty; use middle::typeck::infer::combine::*; use middle::typeck::infer::lattice::*; +use middle::typeck::infer::sub::Sub; use middle::typeck::infer::to_str::ToStr; +use std::list; use syntax::ast::{Many, Once}; 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 fb8ca563291..279318079b9 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -286,6 +286,8 @@ use util::ppaux::{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::map::HashMap; use std::smallintmap; use syntax::ast::{ret_style, purity}; diff --git a/src/librustc/middle/typeck/infer/region_inference.rs b/src/librustc/middle/typeck/infer/region_inference.rs index 99d636559db..0b903f13adb 100644 --- a/src/librustc/middle/typeck/infer/region_inference.rs +++ b/src/librustc/middle/typeck/infer/region_inference.rs @@ -454,13 +454,19 @@ write it) #[warn(deprecated_pattern)]; 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}; use middle::typeck::infer::to_str::ToStr; use syntax::codemap; use util::ppaux::note_and_explain_region; +use core::cmp; use core::dvec::DVec; +use core::to_bytes; +use core::uint; +use core::vec; use result::Result; use result::{Ok, Err}; use std::map::HashMap; diff --git a/src/librustc/middle/typeck/infer/resolve.rs b/src/librustc/middle/typeck/infer/resolve.rs index 91689ff06dd..2448a49444b 100644 --- a/src/librustc/middle/typeck/infer/resolve.rs +++ b/src/librustc/middle/typeck/infer/resolve.rs @@ -46,10 +46,16 @@ // future). If you want to resolve everything but one type, you are // probably better off writing `resolve_all - resolve_ivar`. +use middle::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 core::uint; +use core::vec; + const resolve_nested_tvar: uint = 0b00000001; const resolve_rvar: uint = 0b00000010; const resolve_ivar: uint = 0b00000100; diff --git a/src/librustc/middle/typeck/infer/sub.rs b/src/librustc/middle/typeck/infer/sub.rs index 1cec971f156..b87f42490e2 100644 --- a/src/librustc/middle/typeck/infer/sub.rs +++ b/src/librustc/middle/typeck/infer/sub.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use middle::ty; use middle::typeck::infer::combine::*; use middle::typeck::infer::to_str::ToStr; use middle::typeck::infer::unify::*; diff --git a/src/librustc/middle/typeck/infer/to_str.rs b/src/librustc/middle/typeck/infer/to_str.rs index 166907ba7a8..99b1dab6398 100644 --- a/src/librustc/middle/typeck/infer/to_str.rs +++ b/src/librustc/middle/typeck/infer/to_str.rs @@ -8,9 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use middle::ty; use middle::typeck::infer::integral::int_ty_set; use middle::typeck::infer::floating::float_ty_set; use middle::typeck::infer::unify::{redirect, root, var_value}; +use util::ppaux; + +use core::uint; trait ToStr { fn to_str(cx: infer_ctxt) -> ~str; @@ -30,7 +34,7 @@ impl ty::mt: ToStr { impl ty::Region: ToStr { fn to_str(cx: infer_ctxt) -> ~str { - util::ppaux::region_to_str(cx.tcx, self) + ppaux::region_to_str(cx.tcx, self) } } diff --git a/src/librustc/middle/typeck/infer/unify.rs b/src/librustc/middle/typeck/infer/unify.rs index 2ec356a6dc8..17464d8c13e 100644 --- a/src/librustc/middle/typeck/infer/unify.rs +++ b/src/librustc/middle/typeck/infer/unify.rs @@ -8,11 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use middle::ty; use middle::typeck::infer::combine::combine; 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 core::result; use std::smallintmap::SmallIntMap; enum var_value { diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs index 684ee4fa454..ae8d2112ab3 100644 --- a/src/librustc/middle/typeck/mod.rs +++ b/src/librustc/middle/typeck/mod.rs @@ -52,6 +52,7 @@ independently: use metadata::csearch; use middle::pat_util::{pat_id_map, PatIdMap}; +use middle::resolve; use middle::ty::{arg, field, node_type_table, mk_nil, ty_param_bounds_and_ty}; use middle::ty::{ty_param_substs_and_ty, vstore_uniq}; use middle::ty; @@ -62,6 +63,8 @@ use util::ppaux; use core::dvec::DVec; use core::result::Result; +use core::result; +use core::vec; use std::list::{List, Nil, Cons}; use std::list; use std::map::HashMap; @@ -390,8 +393,8 @@ fn check_crate(tcx: ty::ctxt, -> (method_map, vtable_map) { let ccx = @crate_ctxt_({trait_map: trait_map, - method_map: std::map::HashMap(), - vtable_map: std::map::HashMap(), + method_map: map::HashMap(), + vtable_map: map::HashMap(), coherence_info: @coherence::CoherenceInfo(), tcx: tcx }); diff --git a/src/librustc/middle/typeck/rscope.rs b/src/librustc/middle/typeck/rscope.rs index 5fba2b7e6fa..8a1a5672446 100644 --- a/src/librustc/middle/typeck/rscope.rs +++ b/src/librustc/middle/typeck/rscope.rs @@ -8,7 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use middle::ty; + use core::result::Result; +use core::result; +use syntax::ast; use syntax::parse::token::special_idents; trait region_scope { diff --git a/src/librustc/rustc.rc b/src/librustc/rustc.rc index 9331693bf0a..9f5866a210b 100644 --- a/src/librustc/rustc.rc +++ b/src/librustc/rustc.rc @@ -19,8 +19,6 @@ #[license = "MIT"]; #[crate_type = "lib"]; -#[no_core]; - #[legacy_modes]; #[legacy_exports]; @@ -29,12 +27,14 @@ #[allow(deprecated_mode)]; #[warn(deprecated_pattern)]; +#[no_core]; + extern mod core(vers = "0.6"); +use core::*; + extern mod std(vers = "0.6"); extern mod syntax(vers = "0.6"); -use core::*; - /* Alternate names for some modules. diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index c1a88cae13c..d32c2856ea4 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -8,11 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::map::HashMap; use syntax::ast; use syntax::codemap::{span}; use syntax::visit; use syntax::print; +use syntax; + +use core::option; +use core::str; +use core::vec; +use std::map::HashMap; fn indent(op: fn() -> R) -> R { // Use in conjunction with the log post-processor like `src/etc/indenter` diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 9e2f5a063ac..c8ecfb89004 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::map::HashMap; use middle::ty; use middle::ty::{arg, canon_mode}; use middle::ty::{bound_copy, bound_const, bound_durable, bound_owned, @@ -34,6 +33,10 @@ use syntax::print::pprust::{path_to_str, proto_to_str, use syntax::{ast, ast_util}; use syntax::ast_map; +use core::str; +use core::vec; +use std::map::HashMap; + fn note_and_explain_region(cx: ctxt, prefix: ~str, region: ty::Region, diff --git a/src/librustdoc/astsrv.rs b/src/librustdoc/astsrv.rs index 14b7b52e4d3..bdb92611454 100644 --- a/src/librustdoc/astsrv.rs +++ b/src/librustdoc/astsrv.rs @@ -17,6 +17,10 @@ query AST-related information, shielding the rest of Rustdoc from its non-sendableness. */ +use parse; +use util; + +use core::oldcomm; use rustc::back::link; use rustc::driver::driver; use rustc::driver::session::Session; @@ -30,6 +34,7 @@ use syntax::ast_map; use syntax::codemap; use syntax::diagnostic::handler; use syntax::diagnostic; +use syntax; pub type Ctxt = { ast: @ast::crate, diff --git a/src/librustdoc/attr_parser.rs b/src/librustdoc/attr_parser.rs index 1a46b924147..9acef45cc92 100644 --- a/src/librustdoc/attr_parser.rs +++ b/src/librustdoc/attr_parser.rs @@ -15,9 +15,13 @@ The attribute parser provides methods for pulling documentation out of an AST's attributes. */ +use core::str; +use core::tuple; +use core::vec; use syntax::ast; use syntax::attr; -use core::tuple; +use syntax::codemap; +use syntax; pub type CrateAttrs = { name: Option<~str> diff --git a/src/librustdoc/attr_pass.rs b/src/librustdoc/attr_pass.rs index 0180d18668d..7562016cf47 100644 --- a/src/librustdoc/attr_pass.rs +++ b/src/librustdoc/attr_pass.rs @@ -16,12 +16,20 @@ corresponding AST nodes. The information gathered here is the basis of the natural-language documentation for a crate. */ +use astsrv; +use attr_parser; use doc::ItemUtils; +use doc; use extract::to_str; use fold::Fold; +use fold; + +use core::option; +use core::vec; use syntax::ast; use syntax::ast_map; use std::map::HashMap; +use std::par; pub fn mk_pass() -> Pass { { diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index ec600860690..5bce6c8ffff 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -8,7 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use result::Result; +use core::cmp; +use core::os; +use core::result; +use core::run; +use core::vec; +use core::result::Result; use std::getopts; use std::cell::Cell; diff --git a/src/librustdoc/desc_to_brief_pass.rs b/src/librustdoc/desc_to_brief_pass.rs index fa21366d917..f9c0fb829d0 100644 --- a/src/librustdoc/desc_to_brief_pass.rs +++ b/src/librustdoc/desc_to_brief_pass.rs @@ -15,8 +15,15 @@ If the first paragraph of a long description is short enough then it is interpreted as the brief description. */ +use astsrv; use doc::ItemUtils; +use doc; use fold::Fold; +use fold; + +use core::str; +use core::vec; +use std::par; pub fn mk_pass() -> Pass { { diff --git a/src/librustdoc/doc.rs b/src/librustdoc/doc.rs index c7d52fb77d6..4b5f82235dd 100644 --- a/src/librustdoc/doc.rs +++ b/src/librustdoc/doc.rs @@ -10,6 +10,12 @@ //! The document model +use doc; + +use core::cmp; +use core::option; +use core::vec; + pub type AstId = int; pub type Doc_ = { diff --git a/src/librustdoc/escape_pass.rs b/src/librustdoc/escape_pass.rs index 9daf3347586..46b21063774 100644 --- a/src/librustdoc/escape_pass.rs +++ b/src/librustdoc/escape_pass.rs @@ -10,6 +10,10 @@ //! Escapes text sequences +use text_pass; + +use core::str; + pub fn mk_pass() -> Pass { text_pass::mk_pass(~"escape", escape) } diff --git a/src/librustdoc/extract.rs b/src/librustdoc/extract.rs index 717ae9d7fba..b4912f13983 100644 --- a/src/librustdoc/extract.rs +++ b/src/librustdoc/extract.rs @@ -10,9 +10,15 @@ //! Converts the Rust AST to the rustdoc document model -use syntax::ast; +use astsrv; use doc::ItemUtils; -use task::local_data::local_data_get; +use doc; + +use core::cast; +use core::task::local_data::local_data_get; +use core::vec; +use syntax::ast; +use syntax; /* can't import macros yet, so this is copied from token.rs. See its comment * there. */ diff --git a/src/librustdoc/fold.rs b/src/librustdoc/fold.rs index ba626f80ddb..85f218d8f16 100644 --- a/src/librustdoc/fold.rs +++ b/src/librustdoc/fold.rs @@ -8,6 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use doc; + +use core::vec; +use std::par; + pub struct Fold { ctxt: T, fold_doc: FoldDoc, diff --git a/src/librustdoc/markdown_index_pass.rs b/src/librustdoc/markdown_index_pass.rs index b1cc778bd1b..cdf2c48dd7d 100644 --- a/src/librustdoc/markdown_index_pass.rs +++ b/src/librustdoc/markdown_index_pass.rs @@ -10,8 +10,17 @@ //! Build indexes as appropriate for the markdown pass +use astsrv; +use config; use doc::ItemUtils; +use doc; use fold::Fold; +use fold; +use markdown_pass; +use markdown_writer; + +use core::str; +use std::par; pub fn mk_pass(+config: config::Config) -> Pass { { diff --git a/src/librustdoc/markdown_pass.rs b/src/librustdoc/markdown_pass.rs index 3328cdd527a..39ba0bafb0d 100644 --- a/src/librustdoc/markdown_pass.rs +++ b/src/librustdoc/markdown_pass.rs @@ -10,10 +10,20 @@ //! Generate markdown from a document tree +use astsrv; use doc::ItemUtils; +use doc; +use fold; +use markdown_pass; use markdown_writer::Writer; use markdown_writer::WriterUtils; use markdown_writer::WriterFactory; +use sort_pass; + +use core::str; +use core::vec; +use std::par; +use syntax; pub fn mk_pass(+writer_factory: WriterFactory) -> Pass { let f = fn~(move writer_factory, diff --git a/src/librustdoc/markdown_writer.rs b/src/librustdoc/markdown_writer.rs index 9cf404e0533..adad3c5f5e1 100644 --- a/src/librustdoc/markdown_writer.rs +++ b/src/librustdoc/markdown_writer.rs @@ -8,9 +8,22 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use config; use doc::ItemUtils; -use io::ReaderUtil; +use doc; + +use core::io::ReaderUtil; +use core::io; +use core::libc; +use core::oldcomm; +use core::os; +use core::pipes; +use core::result; +use core::run; +use core::str; +use core::task; use std::future; +use syntax; pub enum WriteInstr { Write(~str), diff --git a/src/librustdoc/page_pass.rs b/src/librustdoc/page_pass.rs index af8ac5f1427..d582119081b 100644 --- a/src/librustdoc/page_pass.rs +++ b/src/librustdoc/page_pass.rs @@ -15,10 +15,20 @@ Each page corresponds is a logical section. There may be pages for individual modules, pages for the crate, indexes, etc. */ +use astsrv; +use config; use doc::{ItemUtils, PageUtils}; +use doc; use fold::Fold; -use syntax::ast; +use fold; +use sort_pass; use util::NominalOp; +use util; + +use core::oldcomm; +use core::option; +use core::vec; +use syntax::ast; pub fn mk_pass(output_style: config::OutputStyle) -> Pass { { diff --git a/src/librustdoc/pass.rs b/src/librustdoc/pass.rs index 0fbc61ad454..cc3bdf9f82c 100644 --- a/src/librustdoc/pass.rs +++ b/src/librustdoc/pass.rs @@ -8,6 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use astsrv; +use doc; + +use core::vec; + /// A single operation on the document model pub type Pass = { name: ~str, diff --git a/src/librustdoc/path_pass.rs b/src/librustdoc/path_pass.rs index b17f4d67a5c..e183c13b90f 100644 --- a/src/librustdoc/path_pass.rs +++ b/src/librustdoc/path_pass.rs @@ -10,8 +10,12 @@ //! Records the full path to items +use astsrv; use doc::ItemUtils; +use doc; use fold::Fold; +use fold; + use syntax::ast; pub fn mk_pass() -> Pass { diff --git a/src/librustdoc/prune_hidden_pass.rs b/src/librustdoc/prune_hidden_pass.rs index bfe6f838704..c5756571a41 100644 --- a/src/librustdoc/prune_hidden_pass.rs +++ b/src/librustdoc/prune_hidden_pass.rs @@ -10,8 +10,14 @@ //! Prunes things with the #[doc(hidden)] attribute +use astsrv; +use attr_parser; use doc::ItemUtils; +use doc; use fold::Fold; +use fold; + +use core::vec; use std::map::HashMap; pub fn mk_pass() -> Pass { diff --git a/src/librustdoc/prune_private_pass.rs b/src/librustdoc/prune_private_pass.rs index e3dc1553a63..c1852128622 100644 --- a/src/librustdoc/prune_private_pass.rs +++ b/src/librustdoc/prune_private_pass.rs @@ -12,7 +12,13 @@ #[legacy_exports]; +use astsrv; +use doc; use fold::Fold; +use fold; + +use core::util; +use syntax::ast; export mk_pass; @@ -56,7 +62,7 @@ fn is_visible(srv: astsrv::Srv, doc: doc::ItemDoc) -> bool { ast_map::node_item(item, _) => { item.vis == ast::public } - _ => core::util::unreachable() + _ => util::unreachable() } } } diff --git a/src/librustdoc/sectionalize_pass.rs b/src/librustdoc/sectionalize_pass.rs index 2c73d4c478b..090016a6f9c 100644 --- a/src/librustdoc/sectionalize_pass.rs +++ b/src/librustdoc/sectionalize_pass.rs @@ -10,8 +10,14 @@ //! Breaks rustdocs into sections according to their headers +use astsrv; use doc::ItemUtils; +use doc; use fold::Fold; +use fold; + +use core::str; +use std::par; pub fn mk_pass() -> Pass { { diff --git a/src/librustdoc/sort_item_name_pass.rs b/src/librustdoc/sort_item_name_pass.rs index 3ef4750b9ad..58349318bbb 100644 --- a/src/librustdoc/sort_item_name_pass.rs +++ b/src/librustdoc/sort_item_name_pass.rs @@ -10,7 +10,11 @@ //! Sorts items by name +use astsrv; use doc::ItemUtils; +use doc; +use extract; +use sort_pass; pub fn mk_pass() -> Pass { pure fn by_item_name(item1: &doc::ItemTag, item2: &doc::ItemTag) -> bool { diff --git a/src/librustdoc/sort_item_type_pass.rs b/src/librustdoc/sort_item_type_pass.rs index 25fc11a4a2a..4f69a307c20 100644 --- a/src/librustdoc/sort_item_type_pass.rs +++ b/src/librustdoc/sort_item_type_pass.rs @@ -10,7 +10,11 @@ //! Sorts items by type +use astsrv; use doc::ItemUtils; +use doc; +use extract; +use sort_pass; pub fn mk_pass() -> Pass { pure fn by_score(item1: &doc::ItemTag, item2: &doc::ItemTag) -> bool { diff --git a/src/librustdoc/sort_pass.rs b/src/librustdoc/sort_pass.rs index a4926e765a7..a660f0c42ad 100644 --- a/src/librustdoc/sort_pass.rs +++ b/src/librustdoc/sort_pass.rs @@ -10,11 +10,15 @@ //! A general sorting pass +use astsrv; use doc::ItemUtils; +use doc; use fold::Fold; -use std::sort; +use fold; use util::NominalOp; +use std::sort; + pub type ItemLtEqOp = pure fn~(v1: &doc::ItemTag, v2: &doc::ItemTag) -> bool; type ItemLtEq = NominalOp; diff --git a/src/librustdoc/text_pass.rs b/src/librustdoc/text_pass.rs index 9a48822b453..30e91f95569 100644 --- a/src/librustdoc/text_pass.rs +++ b/src/librustdoc/text_pass.rs @@ -10,10 +10,15 @@ //! Generic pass for performing an operation on all descriptions +use astsrv; use doc::ItemUtils; +use doc; use fold::Fold; +use fold; use util::NominalOp; +use std::par; + pub fn mk_pass(name: ~str, +op: fn~(~str) -> ~str) -> Pass { { name: name, diff --git a/src/librustdoc/trim_pass.rs b/src/librustdoc/trim_pass.rs index e6696b74eae..78f56ceaba7 100644 --- a/src/librustdoc/trim_pass.rs +++ b/src/librustdoc/trim_pass.rs @@ -16,6 +16,10 @@ is interpreted as the brief description. */ use doc::ItemUtils; +use doc; +use text_pass; + +use core::str; pub fn mk_pass() -> Pass { text_pass::mk_pass(~"trim", |s| str::trim(s) ) diff --git a/src/librustdoc/tystr_pass.rs b/src/librustdoc/tystr_pass.rs index 4609454315f..ae69e83c3c7 100644 --- a/src/librustdoc/tystr_pass.rs +++ b/src/librustdoc/tystr_pass.rs @@ -10,13 +10,20 @@ //! Pulls type information out of the AST and attaches it to the document +use astsrv; use doc::ItemUtils; +use doc; +use extract::to_str; +use extract; use fold::Fold; +use fold; + +use core::vec; +use std::map::HashMap; +use std::par; use syntax::ast; use syntax::print::pprust; use syntax::ast_map; -use std::map::HashMap; -use extract::to_str; pub fn mk_pass() -> Pass { { diff --git a/src/librustdoc/unindent_pass.rs b/src/librustdoc/unindent_pass.rs index a2a40238500..e18d1652a5b 100644 --- a/src/librustdoc/unindent_pass.rs +++ b/src/librustdoc/unindent_pass.rs @@ -19,6 +19,13 @@ instances where the string containing the doc comment is opened in the middle of a line, and each of the following lines is indented. */ +use text_pass; + +use core::str; +use core::uint; +use core::vec; +use std::par; + pub fn mk_pass() -> Pass { text_pass::mk_pass(~"unindent", unindent) } diff --git a/src/librustdoc/util.rs b/src/librustdoc/util.rs index ebeb9346d3c..998b64421d5 100644 --- a/src/librustdoc/util.rs +++ b/src/librustdoc/util.rs @@ -8,6 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::oldcomm; +use core::task; + // Just a named container for our op, so it can have impls pub struct NominalOp { op: T diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index e2bbda46d7c..63d15f8f76e 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -15,12 +15,17 @@ * between tasks. */ -use private::{SharedMutableState, shared_mutable_state, - clone_shared_mutable_state, unwrap_shared_mutable_state, - get_shared_mutable_state, get_shared_immutable_state}; -use sync::{Mutex, mutex_with_condvars, - RWlock, rwlock_with_condvars}; +use sync; +use sync::{Mutex, mutex_with_condvars, RWlock, rwlock_with_condvars}; +use core::cast; +use core::pipes; +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}; +use core::ptr; +use core::task; +use core::util; /// As sync::condvar, a mechanism for unlock-and-descheduling and signalling. pub struct Condvar { is_mutex: bool, failed: &mut bool, cond: &sync::Condvar } diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs index 9054f9355ad..9359a707d4c 100644 --- a/src/libstd/arena.rs +++ b/src/libstd/arena.rs @@ -34,10 +34,18 @@ #[forbid(deprecated_mode)]; +use list; use list::{List, Cons, Nil}; -use cast::reinterpret_cast; -use sys::TypeDesc; -use libc::size_t; + +use core::at_vec; +use core::cast::reinterpret_cast; +use core::cast; +use core::libc::size_t; +use core::ptr; +use core::sys::TypeDesc; +use core::sys; +use core::uint; +use core::vec; #[abi = "rust-intrinsic"] extern mod rusti { diff --git a/src/libstd/base64.rs b/src/libstd/base64.rs index 43f13b5b91f..4cad9d1675d 100644 --- a/src/libstd/base64.rs +++ b/src/libstd/base64.rs @@ -9,7 +9,11 @@ // except according to those terms. #[forbid(deprecated_mode)]; -use io::Reader; + +use core::io::Reader; +use core::iter; +use core::str; +use core::vec; pub trait ToBase64 { pure fn to_base64() -> ~str; diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index 5b9dc6cf3a8..828de1eb546 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -10,7 +10,10 @@ #[forbid(deprecated_mode)]; -use vec::{to_mut, from_elem}; +use core::ops; +use core::uint; +use core::vec::{to_mut, from_elem}; +use core::vec; struct SmallBitv { /// only the lowest nbits of this value are used. the rest is undefined. diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs index cc8cadb709d..42facbc20d0 100644 --- a/src/libstd/c_vec.rs +++ b/src/libstd/c_vec.rs @@ -37,6 +37,12 @@ */ #[forbid(deprecated_mode)]; +use core::libc; +use core::oldcomm; +use core::option; +use core::ptr; +use core::task; + /** * The type representing a foreign chunk of memory * diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs index b972ef953e4..29c75e629e9 100644 --- a/src/libstd/cell.rs +++ b/src/libstd/cell.rs @@ -9,6 +9,9 @@ // except according to those terms. #[forbid(deprecated_mode)]; + +use core::option; + /// A dynamic, mutable location. /// /// Similar to a mutable option type, but friendlier. diff --git a/src/libstd/cmp.rs b/src/libstd/cmp.rs index 28ee8c81e73..7c126c7338b 100644 --- a/src/libstd/cmp.rs +++ b/src/libstd/cmp.rs @@ -11,6 +11,10 @@ #[forbid(deprecated_mode)]; /// Additional general-purpose comparison functionality. +use core::f32; +use core::f64; +use core::float; + const fuzzy_epsilon: float = 1.0e-6; pub trait FuzzyEq { diff --git a/src/libstd/comm.rs b/src/libstd/comm.rs index 1055f3ea7df..850e53c2d48 100644 --- a/src/libstd/comm.rs +++ b/src/libstd/comm.rs @@ -17,8 +17,9 @@ Higher level communication abstractions. // NB: transitionary, de-mode-ing. #[forbid(deprecated_mode)]; -use pipes::{GenericChan, GenericSmartChan, GenericPort, - Chan, Port, Selectable, Peekable}; +use core::pipes::{GenericChan, GenericSmartChan, GenericPort}; +use core::pipes::{Chan, Port, Selectable, Peekable}; +use core::pipes; /// An extension of `pipes::stream` that allows both sending and receiving. pub struct DuplexStream { diff --git a/src/libstd/dbg.rs b/src/libstd/dbg.rs index 75e25f75c6c..bcbe750ff7e 100644 --- a/src/libstd/dbg.rs +++ b/src/libstd/dbg.rs @@ -11,8 +11,9 @@ #[forbid(deprecated_mode)]; //! Unsafe debugging functions for inspecting values. -use cast::reinterpret_cast; - +use core::cast::reinterpret_cast; +use core::ptr; +use core::sys; #[abi = "cdecl"] extern mod rustrt { diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index 687eff887c8..ff4fab0e1df 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -12,9 +12,11 @@ #[forbid(deprecated_mode)]; #[forbid(non_camel_case_types)]; -use option::{Some, None}; -use dvec::DVec; -use core::cmp::{Eq}; +use core::cmp::Eq; +use core::dvec::DVec; +use core::dvec; +use core::uint; +use core::vec; pub trait Deque { fn size() -> uint; diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs index 59e0a1e84fe..86cc15d068b 100644 --- a/src/libstd/ebml.rs +++ b/src/libstd/ebml.rs @@ -9,8 +9,14 @@ // except according to those terms. #[forbid(deprecated_mode)]; + use serialize; +use core::io; +use core::ops; +use core::str; +use core::vec; + // Simple Extensible Binary Markup Language (ebml) reader and writer on a // cursor model. See the specification here: // http://www.matroska.org/technical/specs/rfc/index.html @@ -54,6 +60,13 @@ enum EbmlEncoderTag { // -------------------------------------- pub mod reader { + use serialize; + + use core::int; + use core::io; + use core::ops; + use core::str; + use core::vec; // ebml reading @@ -271,7 +284,7 @@ pub mod reader { fn read_u8 (&self) -> u8 { doc_as_u8 (self.next_doc(EsU8 )) } fn read_uint(&self) -> uint { let v = doc_as_u64(self.next_doc(EsUint)); - if v > (core::uint::max_value as u64) { + if v > (::core::uint::max_value as u64) { fail fmt!("uint %? too large for this architecture", v); } v as uint @@ -385,6 +398,9 @@ pub mod reader { } pub mod writer { + use core::io; + use core::str; + use core::vec; // ebml writing pub struct Encoder { @@ -546,7 +562,7 @@ pub mod writer { } } - impl Encoder: serialize::Encoder { + impl Encoder: ::serialize::Encoder { fn emit_nil(&self) {} fn emit_uint(&self, v: uint) { diff --git a/src/libstd/flatpipes.rs b/src/libstd/flatpipes.rs index 1617641afe3..c1515a8b5e2 100644 --- a/src/libstd/flatpipes.rs +++ b/src/libstd/flatpipes.rs @@ -38,10 +38,13 @@ block the scheduler thread, so will their pipes. */ // The basic send/recv interface FlatChan and PortChan will implement +use core::io; use core::pipes::GenericChan; use core::pipes::GenericPort; - +use core::pipes; use core::sys::size_of; +use core::uint; +use core::vec; /** A FlatPort, consisting of a `BytePort` that recieves byte vectors, @@ -69,18 +72,20 @@ pub struct FlatChan, C: ByteChan> { Constructors for flat pipes that using serialization-based flattening. */ pub mod serial { - pub use DefaultEncoder = ebml::writer::Encoder; pub use DefaultDecoder = ebml::reader::Decoder; - use core::io::{Reader, Writer}; - use core::pipes::{Port, Chan}; use serialize::{Decodable, Encodable}; use flatpipes::flatteners::{DeserializingUnflattener, SerializingFlattener}; use flatpipes::flatteners::{deserialize_buffer, serialize_value}; 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; pub type ReaderPort = FlatPort< T, DeserializingUnflattener, @@ -141,7 +146,6 @@ pub mod serial { let (port, chan) = pipes::stream(); return (pipe_port(move port), pipe_chan(move chan)); } - } // FIXME #4074 this doesn't correctly enforce POD bounds @@ -159,9 +163,11 @@ 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}; pub type ReaderPort = FlatPort, ReaderBytePort>; @@ -242,7 +248,7 @@ pub trait ByteChan { const CONTINUE: [u8 * 4] = [0xAA, 0xBB, 0xCC, 0xDD]; -impl, P: BytePort> FlatPort: GenericPort { +pub impl,P:BytePort> FlatPort: GenericPort { fn recv() -> T { match self.try_recv() { Some(move val) => move val, @@ -287,7 +293,7 @@ impl, P: BytePort> FlatPort: GenericPort { } } -impl, C: ByteChan> FlatChan: GenericChan { +impl,C:ByteChan> FlatChan: GenericChan { fn send(val: T) { self.byte_chan.send(CONTINUE.to_vec()); let bytes = self.flattener.flatten(move val); @@ -299,7 +305,7 @@ impl, C: ByteChan> FlatChan: GenericChan { } } -impl, P: BytePort> FlatPort { +pub impl,P:BytePort> FlatPort { static fn new(u: U, p: P) -> FlatPort { FlatPort { unflattener: move u, @@ -308,7 +314,7 @@ impl, P: BytePort> FlatPort { } } -impl, C: ByteChan> FlatChan { +pub impl,C:ByteChan> FlatChan { static fn new(f: F, c: C) -> FlatChan { FlatChan { flattener: move f, @@ -319,14 +325,16 @@ impl, C: ByteChan> FlatChan { pub mod flatteners { - - use core::sys::size_of; - - use serialize::{Encoder, Decoder, - Encodable, Decodable}; - - use core::io::{Writer, Reader, BytesWriter, ReaderUtil}; + use ebml; use flatpipes::util::BufReader; + use json; + use serialize::{Encoder, Decoder, Encodable, Decodable}; + + use core::cast; + use core::io::{Writer, Reader, BytesWriter, ReaderUtil}; + use core::ptr; + use core::sys::size_of; + use core::vec; // XXX: Is copy/send equivalent to pod? pub struct PodUnflattener { @@ -488,9 +496,9 @@ pub mod flatteners { } pub mod bytepipes { - use core::io::{Writer, Reader, ReaderUtil}; use core::pipes::{Port, Chan}; + use core::pipes; pub struct ReaderBytePort { reader: R @@ -556,12 +564,12 @@ pub mod bytepipes { pub impl PipeBytePort: BytePort { fn try_recv(&self, count: uint) -> Option<~[u8]> { if self.buf.len() >= count { - let mut bytes = core::util::replace(&mut self.buf, ~[]); + let mut bytes = ::core::util::replace(&mut self.buf, ~[]); self.buf = bytes.slice(count, bytes.len()); bytes.truncate(count); return Some(bytes); } else if self.buf.len() > 0 { - let mut bytes = core::util::replace(&mut self.buf, ~[]); + let mut bytes = ::core::util::replace(&mut self.buf, ~[]); assert count > bytes.len(); match self.try_recv(count - bytes.len()) { Some(move rest) => { @@ -580,7 +588,7 @@ pub mod bytepipes { None => return None } } else { - core::util::unreachable() + ::core::util::unreachable() } } } @@ -612,8 +620,8 @@ pub mod bytepipes { // XXX: This belongs elsewhere mod util { - - use io::{Reader, BytesReader}; + use core::io::{Reader, BytesReader}; + use core::io; pub struct BufReader { buf: ~[u8], @@ -632,7 +640,7 @@ mod util { // Recreating the BytesReader state every call since // I can't get the borrowing to work correctly let bytes_reader = BytesReader { - bytes: core::util::id::<&[u8]>(self.buf), + bytes: ::core::util::id::<&[u8]>(self.buf), pos: self.pos }; diff --git a/src/libstd/fun_treemap.rs b/src/libstd/fun_treemap.rs index 1eccb5a8d92..6a24e1e5817 100644 --- a/src/libstd/fun_treemap.rs +++ b/src/libstd/fun_treemap.rs @@ -22,8 +22,7 @@ */ use core::cmp::{Eq, Ord}; -use option::{Some, None}; -use option = option; +use core::option::{Some, None}; pub type Treemap = @TreeNode; diff --git a/src/libstd/future.rs b/src/libstd/future.rs index 2a72c2f696a..ccb26a4439d 100644 --- a/src/libstd/future.rs +++ b/src/libstd/future.rs @@ -21,9 +21,12 @@ * ~~~ */ -use either::Either; -use pipes::{recv, oneshot, ChanOne, PortOne, send_one, recv_one}; -use cast::copy_lifetime; +use core::cast::copy_lifetime; +use core::cast; +use core::either::Either; +use core::option; +use core::pipes::{recv, oneshot, ChanOne, PortOne, send_one, recv_one}; +use core::task; #[doc = "The future type"] pub struct Future { diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs index 38540524dac..acbe32c74dc 100644 --- a/src/libstd/getopts.rs +++ b/src/libstd/getopts.rs @@ -76,8 +76,11 @@ use core::cmp::Eq; use core::result::{Err, Ok}; +use core::result; use core::option; use core::option::{Some, None}; +use core::str; +use core::vec; #[deriving_eq] enum Name { @@ -450,6 +453,10 @@ enum FailType { * groups of short and long option names, together. */ pub mod groups { + use getopts::Result; + + use core::str; + use core::vec; /** one group of options, e.g., both -h and --help, along with * their shared description and properties diff --git a/src/libstd/json.rs b/src/libstd/json.rs index 770d621d51f..c3f30c45e62 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -15,11 +15,19 @@ //! json serialization -use core::cmp::{Eq, Ord}; -use io::{WriterUtil, ReaderUtil}; -use send_map::linear; +use serialize; use sort::Sort; +use core::char; +use core::cmp::{Eq, Ord}; +use core::float; +use core::io::{WriterUtil, ReaderUtil}; +use core::io; +use core::send_map::linear; +use core::str; +use core::to_str; +use core::vec; + /// Represents a json value pub enum Json { Number(float), diff --git a/src/libstd/list.rs b/src/libstd/list.rs index e41aab8ec1f..5922b20300e 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -13,8 +13,8 @@ use core::cmp::Eq; use core::option; -use option::*; -use option::{Some, None}; +use core::option::*; +use core::vec; #[deriving_eq] pub enum List { diff --git a/src/libstd/map.rs b/src/libstd/map.rs index 39124dfbfba..0e5a7972838 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -11,14 +11,17 @@ //! A map type #[forbid(deprecated_mode)]; -use io::WriterUtil; -use to_str::ToStr; -use mutable::Mut; -use send_map::linear::LinearMap; - use core::cmp::Eq; -use hash::Hash; -use to_bytes::IterBytes; +use core::hash::Hash; +use core::io::WriterUtil; +use core::io; +use core::ops; +use core::to_str::ToStr; +use core::mutable::Mut; +use core::send_map::linear::LinearMap; +use core::to_bytes::IterBytes; +use core::uint; +use core::vec; /// A convenience type to treat a hashmap as a set pub type Set = HashMap; @@ -103,7 +106,7 @@ pub trait Map { pure fn each_value_ref(fn(value: &V) -> bool); } -mod util { +pub mod util { pub type Rational = {num: int, den: int}; // : int::positive(*.den); pub pure fn rational_leq(x: Rational, y: Rational) -> bool { @@ -117,6 +120,13 @@ 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 core::io; + use core::ops; + use core::option; + use core::uint; + use core::vec; const initial_capacity: uint = 32u; // 2^5 diff --git a/src/libstd/md4.rs b/src/libstd/md4.rs index 8e58a010f46..d10533008d9 100644 --- a/src/libstd/md4.rs +++ b/src/libstd/md4.rs @@ -10,6 +10,10 @@ #[forbid(deprecated_mode)]; +use core::str; +use core::uint; +use core::vec; + pub pure fn md4(msg: &[u8]) -> {a: u32, b: u32, c: u32, d: u32} { // subtle: if orig_len is merely uint, then the code below // which performs shifts by 32 bits or more has undefined diff --git a/src/libstd/net_ip.rs b/src/libstd/net_ip.rs index 1eb970526c3..ebe0ac690fe 100644 --- a/src/libstd/net_ip.rs +++ b/src/libstd/net_ip.rs @@ -11,6 +11,14 @@ //! Types/fns concerning Internet Protocol (IP), versions 4 & 6 #[forbid(deprecated_mode)]; +use core::libc; +use core::oldcomm; +use core::ptr; +use core::result; +use core::str; +use core::uint; +use core::vec; + use iotask = uv::iotask::IoTask; use interact = uv::iotask::interact; @@ -139,6 +147,14 @@ pub fn get_addr(node: &str, iotask: iotask) } pub mod v4 { + use uv::ll; + + use core::ptr; + use core::result; + use core::str; + use core::uint; + use core::vec; + /** * Convert a str to `ip_addr` * @@ -225,6 +241,9 @@ pub mod v4 { } } pub mod v6 { + use core::result; + use core::str; + /** * Convert a str to `ip_addr` * diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs index c888b457356..ca365e2a7d3 100644 --- a/src/libstd/net_tcp.rs +++ b/src/libstd/net_tcp.rs @@ -12,13 +12,23 @@ // XXX Need FFI fixes #[allow(deprecated_mode)]; +use future; +use future_spawn = future::spawn; use ip = net_ip; +use uv; use uv::iotask; use uv::iotask::IoTask; -use future_spawn = future::spawn; -use result::{Result}; -use libc::size_t; -use io::{Reader, ReaderUtil, Writer}; + +use core::io::{Reader, ReaderUtil, Writer}; +use core::io; +use core::libc::size_t; +use core::libc; +use core::oldcomm; +use core::ptr; +use core::result::{Result}; +use core::result; +use core::uint; +use core::vec; #[nolink] extern mod rustrt { @@ -901,6 +911,8 @@ fn tear_down_socket_data(socket_data: @TcpSocketData) unsafe { // shared implementation for tcp::read fn read_common_impl(socket_data: *TcpSocketData, timeout_msecs: uint) -> result::Result<~[u8],TcpErrData> unsafe { + use timer; + log(debug, ~"starting tcp::read"); let iotask = (*socket_data).iotask; let rs_result = read_start_common_impl(socket_data); @@ -1258,6 +1270,17 @@ type TcpBufferedSocketData = { //#[cfg(test)] mod test { + use net; + use net::ip; + use uv; + + use core::io; + use core::oldcomm; + use core::result; + use core::str; + use core::task; + use core::vec; + // FIXME don't run on fbsd or linux 32 bit (#2064) #[cfg(target_os="win32")] #[cfg(target_os="darwin")] @@ -1566,7 +1589,8 @@ mod test { } fn impl_tcp_socket_impl_reader_handles_eof() { - use io::{Reader,ReaderUtil}; + use core::io::{Reader,ReaderUtil}; + let hl_loop = uv::global_loop::get(); let server_ip = ~"127.0.0.1"; let server_port = 10041u; diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs index a6ba728ccbb..f920e7e9da6 100644 --- a/src/libstd/net_url.rs +++ b/src/libstd/net_url.rs @@ -11,8 +11,24 @@ //! Types/fns concerning URLs (see RFC 3986) #[forbid(deprecated_mode)]; -use io::ReaderUtil; -use send_map::linear::LinearMap; +use map; +use map::HashMap; + +use core::cmp::Eq; +use core::dvec::DVec; +use core::from_str::FromStr; +use core::io::{Reader, ReaderUtil}; +use core::io; +use core::send_map::linear::LinearMap; +use core::send_map; +use core::str; +use core::to_bytes::IterBytes; +use core::to_bytes; +use core::to_str::ToStr; +use core::to_str; +use core::uint; +use core::util; +use core::vec; #[deriving_eq] struct Url { @@ -654,7 +670,7 @@ pub pure fn from_str(rawurl: &str) -> Result { Ok(Url::new(scheme, userinfo, host, port, path, query, fragment)) } -impl Url: from_str::FromStr { +impl Url: FromStr { static pure fn from_str(s: &str) -> Option { match from_str(s) { Ok(move url) => Some(url), diff --git a/src/libstd/par.rs b/src/libstd/par.rs index 10cbcaa0c3b..d88d298ef18 100644 --- a/src/libstd/par.rs +++ b/src/libstd/par.rs @@ -10,6 +10,12 @@ #[forbid(deprecated_mode)]; +use core::cast; +use core::ptr; +use core::sys; +use core::uint; +use core::vec; + use future_spawn = future::spawn; diff --git a/src/libstd/prettyprint.rs b/src/libstd/prettyprint.rs index ef26a8cb190..87699a9c894 100644 --- a/src/libstd/prettyprint.rs +++ b/src/libstd/prettyprint.rs @@ -10,19 +10,21 @@ #[forbid(deprecated_mode)]; -use io::Writer; -use io::WriterUtil; use serialize; -pub struct Encoder { +use core::io::Writer; +use core::io::WriterUtil; +use core::io; + +pub struct Serializer { wr: io::Writer, } -pub fn Encoder(wr: io::Writer) -> Encoder { - Encoder { wr: wr } +pub fn Serializer(wr: io::Writer) -> Serializer { + Serializer { wr: wr } } -pub impl Encoder: serialize::Encoder { +pub impl Serializer: serialize::Encoder { fn emit_nil(&self) { self.wr.write_str(~"()") } diff --git a/src/libstd/priority_queue.rs b/src/libstd/priority_queue.rs index 642b27fa465..42818676359 100644 --- a/src/libstd/priority_queue.rs +++ b/src/libstd/priority_queue.rs @@ -2,7 +2,8 @@ //! A priority queue implemented with a binary heap use core::cmp::Ord; -use ptr::addr_of; +use core::ptr::addr_of; +use core::vec; #[abi = "rust-intrinsic"] extern "C" mod rusti { diff --git a/src/libstd/rl.rs b/src/libstd/rl.rs index b8cd1dc3ca2..f384cceb41b 100644 --- a/src/libstd/rl.rs +++ b/src/libstd/rl.rs @@ -11,7 +11,9 @@ // FIXME #3921. This is unsafe because linenoise uses global mutable // state without mutexes. -use libc::{c_char, c_int}; +use core::libc::{c_char, c_int}; +use core::str; +use core::task; extern mod rustrt { #[legacy_exports]; @@ -79,4 +81,4 @@ pub unsafe fn complete(cb: CompletionCb) unsafe { } rustrt::linenoiseSetCompletionCallback(callback); -} \ No newline at end of file +} diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs index aa78d22e4c8..7196dfad8e5 100644 --- a/src/libstd/rope.rs +++ b/src/libstd/rope.rs @@ -35,6 +35,13 @@ #[forbid(deprecated_mode)]; +use core::cast; +use core::char; +use core::option; +use core::str; +use core::uint; +use core::vec; + /// The type of ropes. pub type Rope = node::Root; @@ -441,6 +448,8 @@ pub fn loop_leaves(rope: Rope, it: fn(node::Leaf) -> bool) -> bool{ pub mod iterator { pub mod leaf { + use rope::node; + pub fn start(rope: Rope) -> node::leaf_iterator::T { match (rope) { node::Empty => return node::leaf_iterator::empty(), @@ -452,6 +461,8 @@ pub mod iterator { } } pub mod char { + use rope::node; + pub fn start(rope: Rope) -> node::char_iterator::T { match (rope) { node::Empty => return node::char_iterator::empty(), @@ -543,7 +554,15 @@ pub fn char_at(rope: Rope, pos: uint) -> char { /* Section: Implementation */ -mod node { +pub mod node { + use rope::node; + + use core::cast; + use core::char; + use core::option; + use core::str; + use core::uint; + use core::vec; /// Implementation of type `rope` pub enum Root { @@ -1116,6 +1135,9 @@ mod node { } pub mod leaf_iterator { + use core::option; + use core::vec; + pub type T = { stack: ~[mut @Node], mut stackpos: int @@ -1153,6 +1175,11 @@ mod node { } pub mod char_iterator { + use rope::node::leaf_iterator; + + use core::option; + use core::str; + pub type T = { leaf_iterator: leaf_iterator::T, mut leaf: Option, diff --git a/src/libstd/serialize.rs b/src/libstd/serialize.rs index 9b194925693..97d5ad18780 100644 --- a/src/libstd/serialize.rs +++ b/src/libstd/serialize.rs @@ -17,6 +17,9 @@ Core encoding and decoding interfaces. #[forbid(deprecated_mode)]; #[forbid(non_camel_case_types)]; +use core::at_vec; +use core::vec; + pub trait Encoder { // Primitive types: fn emit_nil(&self); diff --git a/src/libstd/sha1.rs b/src/libstd/sha1.rs index 1a005bdc03f..264a8791e01 100644 --- a/src/libstd/sha1.rs +++ b/src/libstd/sha1.rs @@ -24,6 +24,10 @@ #[forbid(deprecated_mode)]; +use core::str; +use core::uint; +use core::vec; + /* * A SHA-1 implementation derived from Paul E. Jones's reference * implementation, which is written for clarity, not speed. At some diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index b16cf99cb4e..e412d237e65 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -14,10 +14,13 @@ */ #[forbid(deprecated_mode)]; +use map; +use map::Map; + +use core::dvec::DVec; +use core::ops; use core::option; use core::option::{Some, None}; -use dvec::DVec; -use map::Map; // FIXME (#2347): Should not be @; there's a bug somewhere in rustc that // requires this to be. diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs index 316e23ef7ac..b497f63b674 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -11,9 +11,11 @@ //! Sorting methods #[forbid(deprecated_mode)]; -use vec::{len, push}; use core::cmp::{Eq, Ord}; -use dvec::DVec; +use core::dvec::DVec; +use core::util; +use core::vec::{len, push}; +use core::vec; type Le = pure fn(v1: &T, v2: &T) -> bool; diff --git a/src/libstd/std.rc b/src/libstd/std.rc index f3781c38676..669c8b14fd9 100644 --- a/src/libstd/std.rc +++ b/src/libstd/std.rc @@ -26,8 +26,6 @@ not required in or otherwise suitable for the core library. #[license = "MIT"]; #[crate_type = "lib"]; -#[no_core]; - #[allow(vecs_implicitly_copyable)]; #[deny(non_camel_case_types)]; // XXX this is set to allow because there are two methods in encoding @@ -35,6 +33,8 @@ not required in or otherwise suitable for the core library. #[allow(deprecated_mode)]; #[forbid(deprecated_pattern)]; +#[no_core]; + extern mod core(vers = "0.6"); use core::*; diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index e1b029c5396..66a3d649956 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -17,7 +17,13 @@ * in std. */ -use private::{Exclusive, exclusive}; +use core::option; +use core::pipes; +use core::private::{Exclusive, exclusive}; +use core::ptr; +use core::task; +use core::util; +use core::vec; /**************************************************************************** * Internals diff --git a/src/libstd/task_pool.rs b/src/libstd/task_pool.rs index a87576789af..35bea7b01b4 100644 --- a/src/libstd/task_pool.rs +++ b/src/libstd/task_pool.rs @@ -11,8 +11,11 @@ /// A task pool abstraction. Useful for achieving predictable CPU /// parallelism. -use pipes::{Chan, Port}; -use task::{SchedMode, SingleThreaded}; +use core::pipes::{Chan, Port}; +use core::pipes; +use core::task::{SchedMode, SingleThreaded}; +use core::task; +use core::vec; enum Msg { Execute(~fn(&T)), diff --git a/src/libstd/tempfile.rs b/src/libstd/tempfile.rs index 25ea4ad7bb5..afb9290f6cf 100644 --- a/src/libstd/tempfile.rs +++ b/src/libstd/tempfile.rs @@ -12,8 +12,9 @@ #[forbid(deprecated_mode)]; -use core::option; -use option::{None, Some}; +use core::os; +use core::rand; +use core::str; pub fn mkdtemp(tmpdir: &Path, suffix: &str) -> Option { let r = rand::Rng(); diff --git a/src/libstd/term.rs b/src/libstd/term.rs index 5ec0f934440..ae5949e6f18 100644 --- a/src/libstd/term.rs +++ b/src/libstd/term.rs @@ -11,7 +11,12 @@ //! Simple ANSI color library #[forbid(deprecated_mode)]; -use core::Option; +use core::i32; +use core::io; +use core::option; +use core::os; +use core::str; +use core::vec; // FIXME (#2807): Windows support. diff --git a/src/libstd/test.rs b/src/libstd/test.rs index d365077d063..a3959295735 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -17,17 +17,28 @@ #[forbid(deprecated_mode)]; +use getopts; +use sort; +use term; + use core::cmp::Eq; -use either::Either; -use result::{Ok, Err}; -use io::WriterUtil; -use libc::size_t; -use task::TaskBuilder; +use core::either::Either; +use core::either; +use core::io::WriterUtil; +use core::io; +use core::libc::size_t; +use core::oldcomm; +use core::option; +use core::result; +use core::str; +use core::task::TaskBuilder; +use core::task; +use core::vec; #[abi = "cdecl"] extern mod rustrt { #[legacy_exports]; - fn rust_sched_threads() -> libc::size_t; + fn rust_sched_threads() -> size_t; } // The name of a test. By convention this follows the rules for rust diff --git a/src/libstd/time.rs b/src/libstd/time.rs index 1058910c35a..61f9dbb6cea 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -11,9 +11,13 @@ #[forbid(deprecated_mode)]; use core::cmp::Eq; -use libc::{c_char, c_int, c_long, size_t, time_t}; -use io::{Reader, ReaderUtil}; -use result::{Result, Ok, Err}; +use core::int; +use core::libc::{c_char, c_int, c_long, size_t, time_t}; +use core::i32; +use core::io::{Reader, ReaderUtil}; +use core::io; +use core::result::{Result, Ok, Err}; +use core::str; #[abi = "cdecl"] extern mod rustrt { diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index c3a2a11e1f8..ae132af8b6b 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -12,9 +12,16 @@ #[forbid(deprecated_mode)]; +use uv; use uv::iotask; use uv::iotask::IoTask; +use core::either; +use core::libc; +use core::oldcomm; +use core::ptr; +use core; + /** * Wait for timeout period then send provided value over a channel * @@ -32,7 +39,9 @@ use uv::iotask::IoTask; * * val - a value of type T to send over the provided `ch` */ pub fn delayed_send(iotask: IoTask, - msecs: uint, ch: oldcomm::Chan, val: T) { + msecs: uint, + ch: oldcomm::Chan, + val: T) { unsafe { let timer_done_po = oldcomm::Port::<()>(); let timer_done_ch = oldcomm::Chan(&timer_done_po); @@ -108,8 +117,9 @@ pub fn sleep(iotask: IoTask, msecs: uint) { * be a `some(T)`. If not, then `none` will be returned. */ pub fn recv_timeout(iotask: IoTask, - msecs: uint, - wait_po: oldcomm::Port) -> Option { + msecs: uint, + wait_po: oldcomm::Port) + -> Option { let timeout_po = oldcomm::Port::<()>(); let timeout_ch = oldcomm::Chan(&timeout_po); delayed_send(iotask, msecs, timeout_ch, ()); diff --git a/src/libstd/uv_global_loop.rs b/src/libstd/uv_global_loop.rs index 2efbfae3da4..0cbfbe87de4 100644 --- a/src/libstd/uv_global_loop.rs +++ b/src/libstd/uv_global_loop.rs @@ -16,10 +16,15 @@ use ll = uv_ll; use iotask = uv_iotask; use get_gl = get; use uv_iotask::{IoTask, spawn_iotask}; -use private::{chan_from_global_ptr, weaken_task}; + +use core::either::{Left, Right}; +use core::libc; use core::oldcomm::{Port, Chan, select2, listen}; -use task::TaskBuilder; -use either::{Left, Right}; +use core::private::{chan_from_global_ptr, weaken_task}; +use core::str; +use core::task::TaskBuilder; +use core::task; +use core::vec; extern mod rustrt { fn rust_uv_get_kernel_global_chan_ptr() -> *libc::uintptr_t; diff --git a/src/libstd/uv_iotask.rs b/src/libstd/uv_iotask.rs index d778606075d..ed2da88bac4 100644 --- a/src/libstd/uv_iotask.rs +++ b/src/libstd/uv_iotask.rs @@ -16,12 +16,15 @@ */ #[forbid(deprecated_mode)]; -use libc::c_void; -use ptr::addr_of; -use core::oldcomm::{Port, Chan, listen}; -use task::TaskBuilder; use ll = uv_ll; +use core::libc::c_void; +use core::libc; +use core::oldcomm::{Port, Chan, listen}; +use core::ptr::addr_of; +use core::task::TaskBuilder; +use core::task; + /// Used to abstract-away direct interaction with a libuv loop. pub enum IoTask { IoTask_({ diff --git a/src/libstd/uv_ll.rs b/src/libstd/uv_ll.rs index 65333b41864..b4d617afdee 100644 --- a/src/libstd/uv_ll.rs +++ b/src/libstd/uv_ll.rs @@ -32,8 +32,12 @@ #[allow(non_camel_case_types)]; // C types -use libc::size_t; -use ptr::to_unsafe_ptr; +use core::libc::size_t; +use core::libc; +use core::ptr::to_unsafe_ptr; +use core::ptr; +use core::str; +use core::vec; // libuv struct mappings pub type uv_ip4_addr = { @@ -315,6 +319,8 @@ pub type uv_getaddrinfo_t = { }; pub mod uv_ll_struct_stubgen { + use core::ptr; + pub fn gen_stub_uv_tcp_t() -> uv_tcp_t { return gen_stub_os(); #[cfg(target_os = "linux")] diff --git a/src/libstd/workcache.rs b/src/libstd/workcache.rs index 4d49e98a8b7..45c95146e8e 100644 --- a/src/libstd/workcache.rs +++ b/src/libstd/workcache.rs @@ -8,15 +8,19 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::cmp::Eq; -use send_map::linear::LinearMap; -use pipes::{recv, oneshot, PortOne, send_one}; -use either::{Right,Left,Either}; - use json; use sha1; use serialize::{Encoder, Encodable, Decoder, Decodable}; +use core::either::{Either, Left, Right}; +use core::io; +use core::option; +use core::pipes::{recv, oneshot, PortOne, send_one}; +use core::result; +use core::send_map::linear::LinearMap; +use core::task; +use core::to_bytes; + /** * * This is a loose clone of the fbuild build system, made a touch more diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index da49340e24a..c7c8c77c70f 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -10,10 +10,17 @@ // The Rust abstract syntax tree. -use std::serialize::{Encodable, Decodable, Encoder, Decoder}; +use ast; use codemap::{span, FileName}; use parse::token; +use core::cast; +use core::cmp; +use core::ptr; +use core::task; +use core::to_bytes; +use std::serialize::{Encodable, Decodable, Encoder, Decoder}; + #[auto_encode] #[auto_decode] type spanned = {node: T, span: span}; diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 6e684d0daf4..f35d8c4e1c4 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -8,13 +8,24 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::map; -use std::map::HashMap; use ast::*; -use print::pprust; +use ast; use ast_util::{path_to_ident, stmt_id}; +use ast_util; +use attr; +use codemap; use diagnostic::span_handler; use parse::token::ident_interner; +use print::pprust; +use visit; + +use core::cmp; +use core::either; +use core::str; +use core::vec; +use std::map::HashMap; +use std::map; +use std; enum path_elt { path_mod(ident), diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 521114bf297..eaa61b304cd 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -8,8 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use codemap::{span, BytePos}; use ast::*; +use ast; +use ast_util; +use codemap::{span, BytePos}; +use visit; + +use core::cmp; +use core::int; +use core::option; +use core::str; +use core::to_bytes; +use core::vec; pure fn spanned(+lo: BytePos, +hi: BytePos, +t: T) -> spanned { respan(mk_sp(lo, hi), move t) @@ -262,10 +272,10 @@ pure fn is_call_expr(e: @expr) -> bool { } // This makes def_id hashable -impl def_id : core::to_bytes::IterBytes { +impl def_id : to_bytes::IterBytes { #[inline(always)] - pure fn iter_bytes(&self, +lsb0: bool, f: core::to_bytes::Cb) { - core::to_bytes::iter_bytes_2(&self.crate, &self.node, lsb0, f); + pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { + to_bytes::iter_bytes_2(&self.crate, &self.node, lsb0, f); } } diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index aadea886407..5062cefc497 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -10,13 +10,21 @@ // Functions dealing with attributes and meta_items -use std::map; -use std::map::HashMap; -use either::Either; -use diagnostic::span_handler; +use ast; use ast_util::{spanned, dummy_spanned}; -use parse::comments::{doc_comment_style, strip_doc_comment_decoration}; +use attr; use codemap::BytePos; +use diagnostic::span_handler; +use parse::comments::{doc_comment_style, strip_doc_comment_decoration}; + +use core::cmp; +use core::either::Either; +use core::either; +use core::option; +use core::vec; +use std::map::HashMap; +use std::map; +use std; // Constructors export mk_name_value_item_str; diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 974455972f1..b717d084789 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -21,7 +21,14 @@ source code snippets, etc. */ -use dvec::DVec; +use ast_util; + +use core::cmp; +use core::dvec::DVec; +use core::str; +use core::to_bytes; +use core::uint; +use core::vec; use std::serialize::{Encodable, Decodable, Encoder, Decoder}; trait Pos { diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index e42bb00c212..71113a46838 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -8,9 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::term; -use io::WriterUtil; use codemap::span; +use codemap; + +use core::cmp; +use core::io::WriterUtil; +use core::io; +use core::option; +use core::str; +use core::vec; +use std::term; export emitter, emit; export level, fatal, error, warning, note; diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs index 8eb37386364..b8fe00e246c 100644 --- a/src/libsyntax/ext/auto_encode.rs +++ b/src/libsyntax/ext/auto_encode.rs @@ -88,8 +88,12 @@ node twice. */ -use ext::base::*; +use ast_util; +use attr; use codemap::span; +use ext::base::*; + +use core::vec; use std::map; use std::map::HashMap; @@ -259,11 +263,20 @@ priv impl ext_ctxt { @{span: span, global: false, idents: strs, rp: None, types: ~[]} } + fn path_global(span: span, strs: ~[ast::ident]) -> @ast::path { + @{span: span, global: true, idents: strs, rp: None, types: ~[]} + } + fn path_tps(span: span, strs: ~[ast::ident], tps: ~[@ast::Ty]) -> @ast::path { @{span: span, global: false, idents: strs, rp: None, types: tps} } + fn path_tps_global(span: span, strs: ~[ast::ident], + tps: ~[@ast::Ty]) -> @ast::path { + @{span: span, global: true, idents: strs, rp: None, types: tps} + } + fn ty_path(span: span, strs: ~[ast::ident], tps: ~[@ast::Ty]) -> @ast::Ty { @{id: self.next_id(), @@ -334,6 +347,10 @@ priv impl ext_ctxt { self.expr(span, ast::expr_path(self.path(span, strs))) } + fn expr_path_global(span: span, strs: ~[ast::ident]) -> @ast::expr { + self.expr(span, ast::expr_path(self.path_global(span, strs))) + } + fn expr_var(span: span, var: ~str) -> @ast::expr { self.expr_path(span, ~[self.ident_of(var)]) } @@ -424,7 +441,7 @@ fn mk_ser_impl( let ty_param = cx.bind_path( span, cx.ident_of(~"__S"), - cx.path( + cx.path_global( span, ~[ cx.ident_of(~"std"), @@ -436,7 +453,7 @@ fn mk_ser_impl( ); // Make a path to the std::serialize::Encodable trait. - let path = cx.path_tps( + let path = cx.path_tps_global( span, ~[ cx.ident_of(~"std"), @@ -468,7 +485,7 @@ fn mk_deser_impl( let ty_param = cx.bind_path( span, cx.ident_of(~"__D"), - cx.path( + cx.path_global( span, ~[ cx.ident_of(~"std"), @@ -480,7 +497,7 @@ fn mk_deser_impl( ); // Make a path to the std::serialize::Decodable trait. - let path = cx.path_tps( + let path = cx.path_tps_global( span, ~[ cx.ident_of(~"std"), @@ -815,7 +832,7 @@ fn mk_deser_fields( cx.expr_blk( cx.expr_call( span, - cx.expr_path(span, ~[ + cx.expr_path_global(span, ~[ cx.ident_of(~"std"), cx.ident_of(~"serialize"), cx.ident_of(~"Decodable"), @@ -1019,7 +1036,7 @@ fn mk_enum_deser_variant_nary( let expr_lambda = cx.lambda_expr( cx.expr_call( span, - cx.expr_path(span, ~[ + cx.expr_path_global(span, ~[ cx.ident_of(~"std"), cx.ident_of(~"serialize"), cx.ident_of(~"Decodable"), diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index cf994e0ea52..dc774805ed3 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -8,12 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::map::HashMap; -use parse::parser; -use diagnostic::span_handler; -use codemap::{CodeMap, span, ExpnInfo, ExpandedFrom}; +use ast; use ast_util::dummy_sp; -use parse::token; +use codemap; +use codemap::{CodeMap, span, ExpnInfo, ExpandedFrom}; +use diagnostic::span_handler; +use ext; +use parse; +use parse::{parser, token}; + +use core::io; +use core::vec; +use std::map::HashMap; // new-style macro! tt code: // diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 1e7d27bee6e..d63f14b5774 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -8,8 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use ast; +use codemap; use codemap::span; use ext::base::ext_ctxt; +use ext::build; + +use core::dvec; +use core::option; fn mk_expr(cx: ext_ctxt, sp: codemap::span, expr: ast::expr_) -> @ast::expr { @@ -55,10 +61,19 @@ fn mk_raw_path_(sp: span, -> @ast::path { @{ span: sp, global: false, idents: idents, rp: None, types: move types } } +fn mk_raw_path_global(sp: span, idents: ~[ast::ident]) -> @ast::path { + let p : @ast::path = @{span: sp, global: true, idents: idents, + rp: None, types: ~[]}; + return p; +} fn mk_path(cx: ext_ctxt, sp: span, idents: ~[ast::ident]) -> @ast::expr { mk_expr(cx, sp, ast::expr_path(mk_raw_path(sp, idents))) } +fn mk_path_global(cx: ext_ctxt, sp: span, idents: ~[ast::ident]) -> + @ast::expr { + mk_expr(cx, sp, ast::expr_path(mk_raw_path_global(sp, idents))) +} fn mk_access_(cx: ext_ctxt, sp: span, p: @ast::expr, m: ast::ident) -> @ast::expr { mk_expr(cx, sp, ast::expr_field(p, m, ~[])) @@ -80,6 +95,11 @@ fn mk_call(cx: ext_ctxt, sp: span, fn_path: ~[ast::ident], let pathexpr = mk_path(cx, sp, fn_path); return mk_call_(cx, sp, pathexpr, args); } +fn mk_call_global(cx: ext_ctxt, sp: span, fn_path: ~[ast::ident], + args: ~[@ast::expr]) -> @ast::expr { + let pathexpr = mk_path_global(cx, sp, fn_path); + return mk_call_(cx, sp, pathexpr, args); +} // e = expr, t = type fn mk_base_vec_e(cx: ext_ctxt, sp: span, exprs: ~[@ast::expr]) -> @ast::expr { @@ -244,6 +264,15 @@ fn mk_ty_path(cx: ext_ctxt, let ty = @{ id: cx.next_id(), node: move ty, span: span }; ty } +fn mk_ty_path_global(cx: ext_ctxt, + span: span, + idents: ~[ ast::ident ]) + -> @ast::Ty { + let ty = build::mk_raw_path_global(span, idents); + let ty = ast::ty_path(ty, cx.next_id()); + let ty = @{ id: cx.next_id(), node: move ty, span: span }; + ty +} fn mk_simple_ty_path(cx: ext_ctxt, span: span, ident: ast::ident) diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs index d84d79082a4..4f88ffeeb04 100644 --- a/src/libsyntax/ext/concat_idents.rs +++ b/src/libsyntax/ext/concat_idents.rs @@ -9,6 +9,7 @@ // except according to those terms. use ext::base::*; +use ext::base; fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: ~[ast::token_tree]) -> base::mac_result { diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs index d1ba835a3e5..3cbc8f3834f 100644 --- a/src/libsyntax/ext/deriving.rs +++ b/src/libsyntax/ext/deriving.rs @@ -19,9 +19,13 @@ use ast::{struct_variant_kind, sty_by_ref, sty_region, tuple_variant_kind}; use ast::{ty_nil, ty_param, ty_param_bound, ty_path, ty_rptr, unnamed_field}; use ast::{variant}; use ext::base::ext_ctxt; +use ext::build; use codemap::span; use parse::token::special_idents::clownshoes_extensions; +use core::dvec; +use core::uint; + enum Junction { Conjunction, Disjunction, @@ -202,7 +206,9 @@ fn create_derived_impl(cx: ext_ctxt, // Create the type parameters. let impl_ty_params = dvec::DVec(); for ty_params.each |ty_param| { - let bound = build::mk_ty_path(cx, span, trait_path.map(|x| *x)); + let bound = build::mk_ty_path_global(cx, + span, + trait_path.map(|x| *x)); let bounds = @~[ ty_param_bound(bound) ]; let impl_ty_param = build::mk_ty_param(cx, ty_param.ident, bounds); impl_ty_params.push(move impl_ty_param); @@ -212,7 +218,7 @@ fn create_derived_impl(cx: ext_ctxt, // Create the reference to the trait. let trait_path = { span: span, - global: false, + global: true, idents: trait_path.map(|x| *x), rp: None, types: ~[] diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs index b5c55437d70..c07853a400b 100644 --- a/src/libsyntax/ext/env.rs +++ b/src/libsyntax/ext/env.rs @@ -14,8 +14,14 @@ * should all get sucked into either the compiler syntax extension plugin * interface. */ + use ext::base::*; +use ext::base; use ext::build::mk_uniq_str; + +use core::option; +use core::os; + export expand_syntax_ext; fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: ~[ast::token_tree]) diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 41d5c8ee0bb..a9eff93e6b8 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -8,17 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::map::HashMap; - -use ast::{crate, expr_, expr_mac, mac_invoc_tt, - tt_delim, tt_tok, item_mac, stmt_, stmt_mac, stmt_expr, stmt_semi}; -use fold::*; +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; +use codemap::{span, ExpandedFrom}; use ext::base::*; +use fold::*; use parse::{parser, parse_expr_from_source_str, new_parser_from_tts}; - -use codemap::{span, ExpandedFrom}; - +use core::option; +use core::vec; +use std::map::HashMap; fn expand_expr(exts: HashMap<~str, syntax_extension>, cx: ext_ctxt, e: expr_, s: span, fld: ast_fold, @@ -276,18 +276,17 @@ fn core_macros() -> ~str { macro_rules! ignore (($($x:tt)*) => (())) macro_rules! error ( ($( $arg:expr ),+) => ( - log(core::error, fmt!( $($arg),+ )) )) + log(::core::error, fmt!( $($arg),+ )) )) macro_rules! warn ( ($( $arg:expr ),+) => ( - log(core::warn, fmt!( $($arg),+ )) )) + log(::core::warn, fmt!( $($arg),+ )) )) macro_rules! info ( ($( $arg:expr ),+) => ( - log(core::info, fmt!( $($arg),+ )) )) + log(::core::info, fmt!( $($arg),+ )) )) macro_rules! debug ( ($( $arg:expr ),+) => ( - log(core::debug, fmt!( $($arg),+ )) )) + log(::core::debug, fmt!( $($arg),+ )) )) macro_rules! die( ($msg: expr) => ( - core::sys::begin_unwind($msg, - file!().to_owned(), line!()) + ::core::sys::begin_unwind($msg, file!().to_owned(), line!()) ); () => ( die!(~\"explicit failure\") diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index 2b5f95c4066..b8a27096f73 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -15,10 +15,14 @@ * should all get sucked into either the standard library extfmt module or the * compiler syntax extension plugin interface. */ -use extfmt::ct::*; -use ext::base::*; + +use ast; use codemap::span; +use ext::base::*; +use ext::base; use ext::build::*; +use extfmt::ct::*; + export expand_syntax_ext; fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: ~[ast::token_tree]) @@ -57,7 +61,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, } fn make_rt_path_expr(cx: ext_ctxt, sp: span, nm: @~str) -> @ast::expr { let path = make_path_vec(cx, nm); - return mk_path(cx, sp, path); + return mk_path_global(cx, sp, path); } // Produces an AST expression that represents a RT::conv record, // which tells the RT::conv* functions how to perform the conversion @@ -87,7 +91,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, let count_lit = mk_uint(cx, sp, c as uint); let count_is_path = make_path_vec(cx, @~"CountIs"); let count_is_args = ~[count_lit]; - return mk_call(cx, sp, count_is_path, count_is_args); + return mk_call_global(cx, sp, count_is_path, count_is_args); } _ => cx.span_unimpl(sp, ~"unimplemented fmt! conversion") } @@ -129,7 +133,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, let path = make_path_vec(cx, @fname); let cnv_expr = make_rt_conv_expr(cx, sp, cnv); let args = ~[cnv_expr, arg]; - return mk_call(cx, arg.span, path, args); + return mk_call_global(cx, arg.span, path, args); } fn make_new_conv(cx: ext_ctxt, sp: span, cnv: Conv, arg: @ast::expr) -> @@ -285,10 +289,11 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, } let arg_vec = mk_fixed_vec_e(cx, fmt_sp, piece_exprs); - return mk_call(cx, fmt_sp, - ~[cx.parse_sess().interner.intern(@~"str"), - cx.parse_sess().interner.intern(@~"concat")], - ~[arg_vec]); + return mk_call_global(cx, + fmt_sp, + ~[cx.parse_sess().interner.intern(@~"str"), + cx.parse_sess().interner.intern(@~"concat")], + ~[arg_vec]); } // // Local Variables: diff --git a/src/libsyntax/ext/log_syntax.rs b/src/libsyntax/ext/log_syntax.rs index 47096182fe8..563c56e02b5 100644 --- a/src/libsyntax/ext/log_syntax.rs +++ b/src/libsyntax/ext/log_syntax.rs @@ -8,8 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use ast; +use codemap; use ext::base::*; -use io::WriterUtil; +use ext::base; +use print; + +use core::io::WriterUtil; +use core::option; fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, tt: ~[ast::token_tree]) -> base::mac_result { diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index 56f426e3853..7a87d909fe6 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -14,11 +14,16 @@ // something smarter. 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::quote::rt::*; +use core::vec; + // Transitional reexports so qquote can find the paths it is looking for mod syntax { #[legacy_exports]; @@ -34,6 +39,14 @@ fn path(ids: ~[ident], span: span) -> @ast::path { types: ~[]} } +fn path_global(ids: ~[ident], span: span) -> @ast::path { + @{span: span, + global: true, + idents: ids, + rp: None, + types: ~[]} +} + trait append_types { fn add_ty(ty: @ast::Ty) -> @ast::path; fn add_tys(+tys: ~[@ast::Ty]) -> @ast::path; @@ -82,6 +95,7 @@ trait ext_ctxt_ast_builder { +params: ~[ast::ty_param]) -> @ast::item; fn item_ty(name: ident, span: span, ty: @ast::Ty) -> @ast::item; fn ty_vars(+ty_params: ~[ast::ty_param]) -> ~[@ast::Ty]; + fn ty_vars_global(+ty_params: ~[ast::ty_param]) -> ~[@ast::Ty]; fn ty_field_imm(name: ident, ty: @ast::Ty) -> ast::ty_field; fn ty_rec(+v: ~[ast::ty_field]) -> @ast::Ty; fn field_imm(name: ident, e: @ast::expr) -> ast::field; @@ -303,4 +317,9 @@ impl ext_ctxt: ext_ctxt_ast_builder { ty_params.map(|p| self.ty_path_ast_builder( path(~[p.ident], dummy_sp()))) } + + fn ty_vars_global(+ty_params: ~[ast::ty_param]) -> ~[@ast::Ty] { + ty_params.map(|p| self.ty_path_ast_builder( + path(~[p.ident], dummy_sp()))) + } } diff --git a/src/libsyntax/ext/pipes/check.rs b/src/libsyntax/ext/pipes/check.rs index 7193a00950e..8eecafa8fa4 100644 --- a/src/libsyntax/ext/pipes/check.rs +++ b/src/libsyntax/ext/pipes/check.rs @@ -29,9 +29,10 @@ that. */ +use ast; use ext::base::ext_ctxt; - use ext::pipes::proto::{state, protocol, next_state}; +use ext::pipes::proto; impl ext_ctxt: proto::visitor<(), (), ()> { fn visit_proto(_proto: protocol, diff --git a/src/libsyntax/ext/pipes/liveness.rs b/src/libsyntax/ext/pipes/liveness.rs index 1323042eb62..76749f6b2db 100644 --- a/src/libsyntax/ext/pipes/liveness.rs +++ b/src/libsyntax/ext/pipes/liveness.rs @@ -37,6 +37,7 @@ updating the states using rule (2) until there are no changes. */ +use core::str; use std::bitv::{Bitv}; fn analyze(proto: protocol, _cx: ext_ctxt) { diff --git a/src/libsyntax/ext/pipes/mod.rs b/src/libsyntax/ext/pipes/mod.rs index 0a02bca88ca..67b5c81ad2d 100644 --- a/src/libsyntax/ext/pipes/mod.rs +++ b/src/libsyntax/ext/pipes/mod.rs @@ -43,14 +43,15 @@ FIXME (#3072) - This is still incomplete. */ -use codemap::span; -use ext::base::ext_ctxt; +use ast; use ast::tt_delim; -use parse::lexer::{new_tt_reader, reader}; -use parse::parser::Parser; - +use codemap::span; +use ext::base; +use ext::base::ext_ctxt; use ext::pipes::parse_proto::proto_parser; use ext::pipes::proto::{visit, protocol}; +use parse::lexer::{new_tt_reader, reader}; +use parse::parser::Parser; #[legacy_exports] mod ast_builder; diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index c07170e5c36..ef9c086e3f5 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -10,18 +10,19 @@ // A protocol compiler for Rust. -use to_str::ToStr; - -use dvec::DVec; - use ast::ident; use ast_util::dummy_sp; -use util::interner; use ext::base::ext_ctxt; -use parse::*; +use ext::pipes::ast_builder::{append_types, path, path_global}; use ext::pipes::proto::*; use ext::quote::rt::*; -use ext::pipes::ast_builder::{append_types, path}; +use parse::*; +use util::interner; + +use core::dvec::DVec; +use core::str; +use core::to_str::ToStr; +use core::vec; trait gen_send { fn gen_send(cx: ext_ctxt, try: bool) -> @ast::item; @@ -59,13 +60,14 @@ impl message: gen_send { let pipe_ty = cx.ty_path_ast_builder( path(~[this.data_name()], span) - .add_tys(cx.ty_vars(this.ty_params))); + .add_tys(cx.ty_vars_global(this.ty_params))); let args_ast = vec::append( ~[cx.arg(cx.ident_of(~"pipe"), pipe_ty)], args_ast); let mut body = ~"{\n"; + body += fmt!("use super::%s;\n", self.name()); if this.proto.is_bounded() { let (sp, rp) = match (this.dir, next.dir) { @@ -76,11 +78,11 @@ impl message: gen_send { }; body += ~"let b = pipe.reuse_buffer();\n"; - body += fmt!("let %s = pipes::SendPacketBuffered(\ - ptr::addr_of(&(b.buffer.data.%s)));\n", + body += fmt!("let %s = ::pipes::SendPacketBuffered(\ + ::ptr::addr_of(&(b.buffer.data.%s)));\n", sp, next.name); - body += fmt!("let %s = pipes::RecvPacketBuffered(\ - ptr::addr_of(&(b.buffer.data.%s)));\n", + body += fmt!("let %s = ::pipes::RecvPacketBuffered(\ + ::ptr::addr_of(&(b.buffer.data.%s)));\n", rp, next.name); } else { @@ -91,24 +93,23 @@ impl message: gen_send { (recv, recv) => "(move c, move s)" }; - body += fmt!("let %s = pipes::entangle();\n", pat); + body += fmt!("let %s = ::pipes::entangle();\n", pat); } - body += fmt!("let message = %s::%s(%s);\n", - this.proto.name, + body += fmt!("let message = %s(%s);\n", self.name(), str::connect(vec::append_one( arg_names.map(|x| ~"move " + cx.str_of(*x)), ~"move s"), ~", ")); if !try { - body += fmt!("pipes::send(move pipe, move message);\n"); + body += fmt!("::pipes::send(move pipe, move message);\n"); // return the new channel body += ~"move c }"; } else { - body += fmt!("if pipes::send(move pipe, move message) {\n \ - pipes::rt::make_some(move c) \ - } else { pipes::rt::make_none() } }"); + body += fmt!("if ::pipes::send(move pipe, move message) {\n \ + ::pipes::rt::make_some(move c) \ + } else { ::pipes::rt::make_none() } }"); } let body = cx.parse_expr(body); @@ -142,7 +143,8 @@ impl message: gen_send { ~[cx.arg(cx.ident_of(~"pipe"), cx.ty_path_ast_builder( path(~[this.data_name()], span) - .add_tys(cx.ty_vars(this.ty_params))))], + .add_tys(cx.ty_vars_global( + this.ty_params))))], args_ast); let message_args = if arg_names.len() == 0 { @@ -154,18 +156,21 @@ impl message: gen_send { }; let mut body = ~"{ "; - body += fmt!("let message = %s::%s%s;\n", - this.proto.name, + body += fmt!("use super::%s;\n", self.name()); + body += fmt!("let message = %s%s;\n", self.name(), message_args); if !try { - body += fmt!("pipes::send(move pipe, move message);\n"); + body += fmt!("::pipes::send(move pipe, move message);\n"); body += ~" }"; } else { - body += fmt!("if pipes::send(move pipe, move message) { \ - pipes::rt::make_some(()) \ - } else { pipes::rt::make_none() } }"); + body += fmt!("if ::pipes::send(move pipe, move message) \ + { \ + ::pipes::rt::make_some(()) \ + } else { \ + ::pipes::rt::make_none() \ + } }"); } let body = cx.parse_expr(body); @@ -190,7 +195,7 @@ impl message: gen_send { fn to_ty(cx: ext_ctxt) -> @ast::Ty { cx.ty_path_ast_builder(path(~[cx.ident_of(self.name())], self.span()) - .add_tys(cx.ty_vars(self.get_params()))) + .add_tys(cx.ty_vars_global(self.get_params()))) } } @@ -261,14 +266,14 @@ impl state: to_type_decls { self.data_name(), self.span, cx.ty_path_ast_builder( - path(~[cx.ident_of(~"pipes"), - cx.ident_of(dir.to_str() + ~"Packet")], + path_global(~[cx.ident_of(~"pipes"), + cx.ident_of(dir.to_str() + ~"Packet")], dummy_sp()) .add_ty(cx.ty_path_ast_builder( - path(~[cx.ident_of(self.proto.name), + path(~[cx.ident_of(~"super"), self.data_name()], dummy_sp()) - .add_tys(cx.ty_vars(self.ty_params))))), + .add_tys(cx.ty_vars_global(self.ty_params))))), self.ty_params)); } else { @@ -277,15 +282,15 @@ impl state: to_type_decls { self.data_name(), self.span, cx.ty_path_ast_builder( - path(~[cx.ident_of(~"pipes"), - cx.ident_of(dir.to_str() - + ~"PacketBuffered")], + path_global(~[cx.ident_of(~"pipes"), + cx.ident_of(dir.to_str() + + ~"PacketBuffered")], dummy_sp()) .add_tys(~[cx.ty_path_ast_builder( - path(~[cx.ident_of(self.proto.name), + path(~[cx.ident_of(~"super"), self.data_name()], - dummy_sp()) - .add_tys(cx.ty_vars(self.ty_params))), + dummy_sp()) + .add_tys(cx.ty_vars_global(self.ty_params))), self.proto.buffer_ty_path(cx)])), self.ty_params)); }; @@ -303,10 +308,10 @@ impl protocol: gen_init { let body = if !self.is_bounded() { match start_state.dir { - send => quote_expr!( pipes::entangle() ), + send => quote_expr!( ::pipes::entangle() ), recv => { quote_expr!({ - let (s, c) = pipes::entangle(); + let (s, c) = ::pipes::entangle(); (move c, move s) }) } @@ -338,7 +343,7 @@ impl protocol: gen_init { let fty = s.to_ty(ext_cx); ext_cx.field_imm(ext_cx.ident_of(s.name), quote_expr!( - pipes::mk_packet::<$fty>() + ::pipes::mk_packet::<$fty>() )) })) } @@ -347,7 +352,7 @@ impl protocol: gen_init { debug!("gen_init_bounded"); let buffer_fields = self.gen_buffer_init(ext_cx); let buffer = quote_expr!( - ~{header: pipes::BufferHeader(), + ~{header: ::pipes::BufferHeader(), data: $buffer_fields} ); @@ -358,12 +363,12 @@ impl protocol: gen_init { fmt!("data.%s.set_buffer_(buffer)", s.name))), ext_cx.parse_expr( - fmt!("ptr::addr_of(&(data.%s))", + fmt!("::ptr::addr_of(&(data.%s))", self.states[0].name)))); quote_expr!({ let buffer = $buffer; - do pipes::entangle_buffer(move buffer) |buffer, data| { + do ::pipes::entangle_buffer(move buffer) |buffer, data| { $entangle_body } }) @@ -381,7 +386,7 @@ impl protocol: gen_init { } cx.ty_path_ast_builder(path(~[cx.ident_of(~"__Buffer")], self.span) - .add_tys(cx.ty_vars(params))) + .add_tys(cx.ty_vars_global(params))) } fn gen_buffer_type(cx: ext_ctxt) -> @ast::item { @@ -395,7 +400,7 @@ impl protocol: gen_init { } } let ty = s.to_ty(cx); - let fty = quote_ty!( pipes::Packet<$ty> ); + let fty = quote_ty!( ::pipes::Packet<$ty> ); cx.ty_field_imm(cx.ident_of(s.name), fty) }; diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs index b00a2aab69f..a2673c481b1 100644 --- a/src/libsyntax/ext/pipes/proto.rs +++ b/src/libsyntax/ext/pipes/proto.rs @@ -8,11 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use to_str::ToStr; -use dvec::DVec; - +use ast; use ext::pipes::ast_builder::{path, append_types}; +use core::cmp; +use core::dvec::DVec; +use core::to_str::ToStr; + enum direction { send, recv } impl direction : cmp::Eq { diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index c498c3407c2..184093715c6 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -8,12 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use mod ast; -use mod parse::token; - +use ast; +use attr; use codemap::{span, BytePos}; use ext::base::ext_ctxt; +use ext::base; +use ext::build; use parse::token::*; +use parse::token; +use parse; + +use core::str; /** * @@ -27,6 +32,12 @@ use parse::token::*; */ pub mod rt { + use ast; + use parse; + use print::pprust; + + use core::str; + pub use ast::*; pub use parse::token::*; pub use parse::new_parser_from_tts; @@ -577,15 +588,15 @@ fn expand_parse_call(cx: ext_ctxt, id_ext(cx, ~"parse_sess")), ~[]); let new_parser_call = - build::mk_call(cx, sp, - ids_ext(cx, ~[~"syntax", - ~"ext", - ~"quote", - ~"rt", - ~"new_parser_from_tts"]), - ~[parse_sess_call(), - cfg_call(), - tts_expr]); + build::mk_call_global(cx, sp, + ids_ext(cx, ~[~"syntax", + ~"ext", + ~"quote", + ~"rt", + ~"new_parser_from_tts"]), + ~[parse_sess_call(), + cfg_call(), + tts_expr]); build::mk_call_(cx, sp, build::mk_access_(cx, sp, new_parser_call, diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index e4074315689..47c6ea8876e 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -8,10 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ext::base::*; +use codemap; use codemap::{span, Loc, FileMap}; -use print::pprust; +use ext::base::*; +use ext::base; use ext::build::{mk_base_vec_e, mk_uint, mk_u8, mk_base_str}; +use print::pprust; + +use core::io; +use core::result; +use core::str; +use core::vec; export expand_line; export expand_col; diff --git a/src/libsyntax/ext/trace_macros.rs b/src/libsyntax/ext/trace_macros.rs index 6bf7437e152..c202778d0df 100644 --- a/src/libsyntax/ext/trace_macros.rs +++ b/src/libsyntax/ext/trace_macros.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use ast; use codemap::span; +use ext::base; use ext::base::ext_ctxt; use ast::tt_delim; use parse::lexer::{new_tt_reader, reader}; diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index ad4677942ac..c7b4a2b239a 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -9,19 +9,25 @@ // except according to those terms. // Earley-like parser for macros. -use parse::token; -use parse::token::{Token, EOF, to_str, nonterminal}; -use parse::lexer::*; //resolve bug? -//import parse::lexer::{reader, tt_reader, tt_reader_as_reader}; -use parse::parser::Parser; -//import parse::common::parser_common; -use parse::common::*; //resolve bug? -use parse::parse_sess; -use dvec::DVec; use ast::{matcher, match_tok, match_seq, match_nonterminal, ident}; use ast_util::mk_sp; -use std::map::HashMap; use codemap::BytePos; +use codemap; +use parse::common::*; //resolve bug? +use parse::lexer::*; //resolve bug? +use parse::parse_sess; +use parse::parser::Parser; +use parse::token::{Token, EOF, to_str, nonterminal}; +use parse::token; + +use core::dvec::DVec; +use core::dvec; +use core::io; +use core::option; +use core::str; +use core::uint; +use core::vec; +use std::map::HashMap; /* This is an Earley-like parser, without support for in-grammar nonterminals, only by calling out to the main rust parser for named nonterminals (which it diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index e93f3d6e38b..7386b3b67b9 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -8,19 +8,24 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ext::base::{ext_ctxt, mac_result, mr_any, mr_def, normal_tt}; -use codemap::span; -use ast::{ident, matcher_, matcher, match_tok, - match_nonterminal, match_seq, tt_delim}; -use parse::lexer::{new_tt_reader, reader}; -use parse::token::{FAT_ARROW, SEMI, LBRACE, RBRACE, nt_matchers, nt_tt}; -use parse::parser::Parser; -use ext::tt::macro_parser::{parse, parse_or_else, success, failure, - named_match, matched_seq, matched_nonterminal, - error}; -use std::map::HashMap; -use parse::token::special_idents; +use ast::{ident, matcher_, matcher, match_tok, match_nonterminal, match_seq}; +use ast::{tt_delim}; +use ast; use ast_util::dummy_sp; +use codemap::span; +use ext::base::{ext_ctxt, mac_result, mr_any, mr_def, normal_tt}; +use ext::base; +use ext::tt::macro_parser::{error}; +use ext::tt::macro_parser::{named_match, matched_seq, matched_nonterminal}; +use ext::tt::macro_parser::{parse, parse_or_else, success, failure}; +use parse::lexer::{new_tt_reader, reader}; +use parse::parser::Parser; +use parse::token::special_idents; +use parse::token::{FAT_ARROW, SEMI, LBRACE, RBRACE, nt_matchers, nt_tt}; +use print; + +use core::io; +use std::map::HashMap; fn add_new_extension(cx: ext_ctxt, sp: span, name: ident, arg: ~[ast::token_tree]) -> base::mac_result { diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index a68482ea46b..c1745fac710 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -8,11 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use diagnostic::span_handler; +use ast; use ast::{token_tree, tt_delim, tt_tok, tt_seq, tt_nonterminal,ident}; -use ext::tt::macro_parser::{named_match, matched_seq, matched_nonterminal}; +use ast_util; use codemap::span; +use diagnostic::span_handler; +use ext::tt::macro_parser::{named_match, matched_seq, matched_nonterminal}; use parse::token::{EOF, INTERPOLATED, IDENT, Token, nt_ident, ident_interner}; + +use core::option; +use core::vec; +use std; use std::map::HashMap; export tt_reader, new_tt_reader, dup_tt_reader, tt_next_token; diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 0b1ff4f56ec..6d32c73e1f7 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -8,8 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use codemap::span; use ast::*; +use ast; +use codemap::span; + +use core::option; +use core::vec; export ast_fold_precursor; export ast_fold; diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index a4bef47fdf2..a3fd069afbb 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -8,9 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use either::{Either, Left, Right}; +use ast; use ast_util::spanned; use parse::common::*; //resolve bug? +use parse::token; + +use core::either::{Either, Left, Right}; export parser_attr; diff --git a/src/libsyntax/parse/classify.rs b/src/libsyntax/parse/classify.rs index 0ff5c296125..7f57c777833 100644 --- a/src/libsyntax/parse/classify.rs +++ b/src/libsyntax/parse/classify.rs @@ -12,6 +12,7 @@ Predicates on exprs and stmts that the pretty-printer and parser use */ +use ast; use ast_util::operator_prec; fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool { diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 22b40736748..0cd3ef0ee73 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -8,11 +8,22 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use io::ReaderUtil; +use ast; +use codemap::{CodeMap, FileMap, CharPos}; +use diagnostic; +use parse::lexer::{is_whitespace, get_str_from, reader}; +use parse::lexer::{string_reader, bump, is_eof, nextch}; +use parse::lexer; +use parse::token; +use parse; use util::interner; -use parse::lexer::{string_reader, bump, is_eof, nextch, - is_whitespace, get_str_from, reader}; -use codemap::{FileMap, CharPos}; + +use core::cmp; +use core::io::ReaderUtil; +use core::io; +use core::str; +use core::uint; +use core::vec; export cmnt; export lit; diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index 246a8fa9c7c..ca0bbbb7369 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -8,10 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::map::{HashMap}; +use ast; use ast_util::spanned; -use parse::parser::Parser; use parse::lexer::reader; +use parse::parser::Parser; +use parse::token; + +use core::option; +use std::map::HashMap; type seq_sep = { sep: Option, diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index c4e34311b88..c51f7e4dad6 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -8,10 +8,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use diagnostic::span_handler; +use ast; +use ast_util; use codemap::{span, CodeMap, CharPos, BytePos}; -use ext::tt::transcribe::{tt_reader, new_tt_reader, dup_tt_reader, - tt_next_token}; +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 parse::token; + +use core::char; +use core::either; +use core::str; +use core::u64; + +use std; export reader, string_reader, new_string_reader, is_whitespace; export tt_reader, new_tt_reader; diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 803135f7599..fb5c6250179 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -12,6 +12,20 @@ #[legacy_exports]; +use ast::node_id; +use ast; +use codemap::{span, CodeMap, FileMap, CharPos, BytePos}; +use codemap; +use diagnostic::{span_handler, mk_span_handler, mk_handler, emitter}; +use parse::attr::parser_attr; +use parse::lexer::{reader, string_reader}; +use parse::parser::Parser; +use parse::token::{ident_interner, mk_ident_interner}; +use util::interner; + +use core::io; +use core::result; + export parser; export common; export lexer; @@ -36,15 +50,6 @@ export parse_stmt_from_source_str; export parse_tts_from_source_str; export parse_from_source_str; -use ast::node_id; -use codemap::{span, CodeMap, FileMap, CharPos, BytePos}; -use diagnostic::{span_handler, mk_span_handler, mk_handler, emitter}; -use parse::attr::parser_attr; -use parse::lexer::{reader, string_reader}; -use parse::parser::Parser; -use parse::token::{ident_interner, mk_ident_interner}; -use util::interner; - #[legacy_exports] mod lexer; diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index 3db635f3b43..6b73cf308a2 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -17,10 +17,17 @@ Obsolete syntax that becomes too hard to parse can be removed. */ -use codemap::span; use ast::{expr, expr_lit, lit_nil}; +use ast; use ast_util::{respan}; +use codemap::span; use parse::token::Token; +use parse::token; + +use core::cmp; +use core::option; +use core::str; +use core::to_bytes; /// The specific types of unsupported syntax pub enum ObsoleteSyntax { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 2b83404e065..f85ca3fefef 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -8,76 +8,79 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use print::pprust::expr_to_str; - -use result::Result; -use either::{Either, Left, Right}; -use std::map::HashMap; -use parse::token::{can_begin_expr, is_ident, is_ident_or_path, is_plain_ident, - INTERPOLATED, special_idents}; -use codemap::{span,FssNone, BytePos}; -use util::interner::Interner; +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}; +use ast::{blk_check_mode, box, by_copy, by_move, by_ref, by_val}; +use ast::{capture_clause, capture_item, crate, crate_cfg, decl, decl_item}; +use ast::{decl_local, default_blk, deref, div, enum_def, enum_variant_kind}; +use ast::{expl, expr, expr_, expr_addr_of, expr_match, expr_again}; +use ast::{expr_assert, expr_assign, expr_assign_op, expr_binary, expr_block}; +use ast::{expr_break, expr_call, expr_cast, expr_copy, expr_do_body}; +use ast::{expr_fail, expr_field, expr_fn, expr_fn_block, expr_if, expr_index}; +use ast::{expr_lit, expr_log, expr_loop, expr_loop_body, expr_mac}; +use ast::{expr_method_call, expr_paren, expr_path, expr_rec, expr_repeat}; +use ast::{expr_ret, expr_swap, expr_struct, expr_tup, expr_unary}; +use ast::{expr_unary_move, expr_vec, expr_vstore, expr_vstore_mut_box}; +use ast::{expr_vstore_fixed, expr_vstore_slice, expr_vstore_box}; +use ast::{expr_vstore_mut_slice, expr_while, extern_fn, field, fn_decl}; +use ast::{expr_vstore_uniq, TyFn, Onceness, Once, Many}; +use ast::{foreign_item, foreign_item_const, foreign_item_fn, foreign_mod}; +use ast::{ident, impure_fn, infer, inherited, item, item_, item_const}; +use ast::{item_const, item_enum, item_fn, item_foreign_mod, item_impl}; +use ast::{item_mac, item_mod, item_struct, item_trait, item_ty, lit, lit_}; +use ast::{lit_bool, lit_float, lit_float_unsuffixed, lit_int}; +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; use ast_util::{spanned, respan, mk_sp, ident_to_path, operator_prec}; -use parse::lexer::reader; -use parse::prec::{as_prec, token_to_binop}; +use ast_util; +use classify; +use codemap::{span,FssNone, BytePos}; +use codemap; use parse::attr::parser_attr; -use parse::common::{seq_sep_trailing_disallowed, seq_sep_trailing_allowed, - seq_sep_none, token_to_str}; -use dvec::DVec; -use vec::{push}; -use parse::obsolete::{ - ObsoleteSyntax, - ObsoleteLowerCaseKindBounds, ObsoleteLet, - ObsoleteFieldTerminator, ObsoleteStructCtor, - ObsoleteWith, ObsoleteClassMethod, ObsoleteClassTraits, - ObsoleteModeInFnType, ObsoleteMoveInit, ObsoleteBinaryMove, -}; -use ast::{_mod, add, arg, arm, attribute, - bind_by_ref, bind_infer, bind_by_value, bind_by_move, - bitand, bitor, bitxor, blk, blk_check_mode, box, by_copy, - by_move, by_ref, by_val, capture_clause, - capture_item, struct_immutable, struct_mutable, - crate, crate_cfg, decl, decl_item, decl_local, - default_blk, deref, div, enum_def, enum_variant_kind, expl, expr, - expr_, expr_addr_of, expr_match, expr_again, expr_assert, - expr_assign, expr_assign_op, expr_binary, expr_block, expr_break, - expr_call, expr_cast, expr_copy, expr_do_body, expr_fail, - expr_field, expr_fn, expr_fn_block, expr_if, expr_index, - expr_lit, expr_log, expr_loop, expr_loop_body, expr_mac, - expr_method_call, expr_paren, expr_path, expr_rec, expr_repeat, - expr_ret, expr_swap, expr_struct, expr_tup, expr_unary, - expr_unary_move, expr_vec, expr_vstore, expr_vstore_mut_box, - expr_vstore_mut_slice, expr_while, extern_fn, field, fn_decl, - foreign_item, foreign_item_const, foreign_item_fn, foreign_mod, - ident, impure_fn, infer, inherited, - item, item_, item_struct, item_const, item_enum, item_fn, - item_foreign_mod, item_impl, item_mac, item_mod, item_trait, - item_ty, lit, lit_, lit_bool, lit_float, lit_float_unsuffixed, - lit_int, lit_int_unsuffixed, lit_nil, lit_str, lit_uint, local, - m_const, m_imm, m_mutbl, mac_, - mac_invoc_tt, matcher, match_nonterminal, match_seq, - match_tok, method, mode, module_ns, mt, mul, mutability, - named_field, neg, noreturn, not, pat, pat_box, pat_enum, - pat_ident, pat_lit, pat_range, pat_rec, pat_region, pat_struct, - pat_tup, pat_uniq, pat_wild, path, private, Proto, ProtoBare, - ProtoBorrowed, ProtoBox, ProtoUniq, provided, public, pure_fn, - purity, re_static, re_self, re_anon, re_named, region, - rem, required, ret_style, return_val, self_ty, shl, shr, stmt, - stmt_decl, stmt_expr, stmt_semi, stmt_mac, struct_def, - struct_field, struct_variant_kind, subtract, sty_box, sty_by_ref, - sty_region, sty_static, sty_uniq, sty_value, token_tree, - trait_method, trait_ref, tt_delim, tt_seq, tt_tok, - tt_nonterminal, tuple_variant_kind, Ty, ty_, ty_bot, - ty_box, ty_field, ty_fn, ty_infer, ty_mac, ty_method, ty_nil, - ty_param, ty_param_bound, ty_path, ty_ptr, ty_rec, ty_rptr, - ty_tup, ty_u32, ty_uniq, ty_vec, ty_fixed_length_vec, - type_value_ns, uniq, unnamed_field, unsafe_blk, unsafe_fn, - variant, view_item, view_item_, view_item_export, - view_item_import, view_item_use, view_path, view_path_glob, - view_path_list, view_path_simple, visibility, vstore, vstore_box, - vstore_fixed, vstore_slice, vstore_uniq, - expr_vstore_fixed, expr_vstore_slice, expr_vstore_box, - expr_vstore_uniq, TyFn, Onceness, Once, Many}; +use parse::common::{seq_sep_none, token_to_str}; +use parse::common::{seq_sep_trailing_disallowed, seq_sep_trailing_allowed}; +use parse::lexer::reader; +use parse::obsolete::{ObsoleteClassTraits, ObsoleteModeInFnType}; +use parse::obsolete::{ObsoleteLet, ObsoleteFieldTerminator}; +use parse::obsolete::{ObsoleteMoveInit, ObsoleteBinaryMove}; +use parse::obsolete::{ObsoleteStructCtor, ObsoleteWith, ObsoleteClassMethod}; +use parse::obsolete::{ObsoleteSyntax, ObsoleteLowerCaseKindBounds}; +use parse::prec::{as_prec, token_to_binop}; +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 print::pprust::expr_to_str; +use util::interner::Interner; + +use core::cmp; +use core::dvec::DVec; +use core::dvec; +use core::either::{Either, Left, Right}; +use core::either; +use core::result::Result; +use core::vec::push; +use core::vec; +use std::map::HashMap; export Parser; @@ -195,7 +198,7 @@ fn Parser(sess: parse_sess, cfg: ast::crate_cfg, keywords: token::keyword_table(), strict_keywords: token::strict_keyword_table(), reserved_keywords: token::reserved_keyword_table(), - obsolete_set: std::map::HashMap(), + obsolete_set: HashMap(), mod_path_stack: ~[], } } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 04e6e187dbb..f286b15c752 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -8,8 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use util::interner; +use ast; +use ast_util; +use parse::token; use util::interner::Interner; +use util::interner; + +use core::cast; +use core::char; +use core::cmp; +use core::str; +use core::task; use std::map::HashMap; #[auto_encode] @@ -332,7 +341,7 @@ mod special_idents { } struct ident_interner { - priv interner: util::interner::Interner<@~str>, + priv interner: Interner<@~str>, } impl ident_interner { diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index d90341254cc..c9d2abfe0cb 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -8,8 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use io::WriterUtil; -use dvec::DVec; +use core::cmp; +use core::dvec::DVec; +use core::io::WriterUtil; +use core::io; +use core::str; +use core::vec; /* * This pretty-printer is a direct reimplementation of Philip Karlton's diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 3b995addd62..ad4080c3094 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -8,16 +8,32 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use parse::{comments, lexer, token}; -use codemap::{CodeMap, BytePos}; -use print::pp::{break_offset, word, printer, space, zerobreak, hardbreak}; -use print::pp::{breaks, consistent, inconsistent, eof}; use ast::{required, provided}; +use ast; +use ast_util; use ast_util::{operator_prec}; -use dvec::DVec; +use attr; +use codemap::{CodeMap, BytePos}; +use codemap; +use diagnostic; use parse::classify::*; use parse::token::ident_interner; -use str::{push_str, push_char}; +use parse::token; +use parse::{comments, lexer, token}; +use parse; +use print::pp::{break_offset, word, printer, space, zerobreak, hardbreak}; +use print::pp::{breaks, consistent, inconsistent, eof}; +use print::pp; +use print::pprust; + +use core::char; +use core::dvec::DVec; +use core::io; +use core::option; +use core::str::{push_str, push_char}; +use core::str; +use core::u64; +use core::vec; // The ps is stored here to prevent recursive type. enum ann_node { diff --git a/src/libsyntax/syntax.rc b/src/libsyntax/syntax.rc index 687504b873e..0777269f8f7 100644 --- a/src/libsyntax/syntax.rc +++ b/src/libsyntax/syntax.rc @@ -16,8 +16,6 @@ #[crate_type = "lib"]; -#[no_core]; - #[legacy_modes]; #[legacy_exports]; @@ -26,11 +24,13 @@ #[allow(deprecated_mode)]; #[warn(deprecated_pattern)]; -extern mod core(vers = "0.6"); -extern mod std(vers = "0.6"); +#[no_core]; +extern mod core(vers = "0.6"); use core::*; +extern mod std(vers = "0.6"); + pub mod syntax { pub use ext; pub use parse; diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 9a47edfeb05..b7d894a7e9f 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -8,9 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - use ast::*; +use ast; +use ast_util; use codemap::span; +use parse; + +use core::option; +use core::vec; // Context-passing AST walker. Each overridden visit method has full control // over what happens with its node, it can do its own traversal of the node's diff --git a/src/test/run-pass/super.rs b/src/test/run-pass/super.rs new file mode 100644 index 00000000000..0eb922643c6 --- /dev/null +++ b/src/test/run-pass/super.rs @@ -0,0 +1,12 @@ +pub mod a { + pub fn f() {} + pub mod b { + fn g() { + super::f(); + } + } +} + +fn main() { +} +