From 4c2e4c37ce01a98c768a986b0b87a6e93ef72699 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 13 Dec 2012 13:05:22 -0800 Subject: [PATCH] librustc: Make `use` statements crate-relative by default. r=brson --- src/libcargo/cargo.rc | 29 ++- src/libcore/core.rc | 2 +- src/libcore/int-template.rs | 5 + src/libcore/int-template/int.rs | 6 +- src/libcore/iter-trait.rs | 5 + src/libcore/libc.rs | 160 ++++++++------- src/libcore/os.rs | 24 +-- src/libcore/send_map.rs | 2 +- src/libcore/task/local_data.rs | 2 +- src/libcore/task/local_data_priv.rs | 7 +- src/libcore/task/mod.rs | 6 +- src/libcore/task/spawn.rs | 4 +- src/libcore/to_str.rs | 2 +- src/libcore/uint-template.rs | 5 + src/libcore/uint-template/u8.rs | 4 + src/libcore/uint-template/uint.rs | 9 +- src/librustc/driver/session.rs | 15 +- src/librustc/front/intrinsic.rs | 2 +- src/librustc/metadata/creader.rs | 4 +- src/librustc/metadata/csearch.rs | 23 +-- src/librustc/metadata/decoder.rs | 39 ++-- src/librustc/metadata/encoder.rs | 4 +- src/librustc/metadata/loader.rs | 2 +- src/librustc/metadata/mod.rs | 32 --- src/librustc/metadata/tydecode.rs | 5 +- src/librustc/middle/astencode.rs | 56 +++--- src/librustc/middle/borrowck/gather_loans.rs | 6 +- src/librustc/middle/borrowck/mod.rs | 42 ++-- src/librustc/middle/check_alt.rs | 17 +- src/librustc/middle/const_eval.rs | 4 +- src/librustc/middle/kind.rs | 15 +- src/librustc/middle/liveness.rs | 19 +- src/librustc/middle/privacy.rs | 6 +- src/librustc/middle/region.rs | 15 +- src/librustc/middle/resolve.rs | 182 +++++++++++++++--- src/librustc/middle/trans/alt.rs | 31 +-- src/librustc/middle/trans/base.rs | 65 +++---- src/librustc/middle/trans/build.rs | 15 +- src/librustc/middle/trans/callee.rs | 17 +- src/librustc/middle/trans/closure.rs | 31 ++- src/librustc/middle/trans/consts.rs | 5 +- src/librustc/middle/trans/controlflow.rs | 6 +- src/librustc/middle/trans/datum.rs | 8 +- src/librustc/middle/trans/debuginfo.rs | 25 +-- src/librustc/middle/trans/expr.rs | 19 +- src/librustc/middle/trans/foreign.rs | 37 ++-- src/librustc/middle/trans/glue.rs | 8 +- src/librustc/middle/trans/inline.rs | 10 +- src/librustc/middle/trans/meth.rs | 28 +-- src/librustc/middle/trans/monomorphize.rs | 23 +-- src/librustc/middle/trans/reflect.rs | 23 +-- src/librustc/middle/trans/shape.rs | 20 +- src/librustc/middle/trans/tvec.rs | 21 +- src/librustc/middle/trans/type_of.rs | 8 +- src/librustc/middle/trans/type_use.rs | 13 +- src/librustc/middle/trans/uniq.rs | 11 +- src/librustc/middle/typeck/astconv.rs | 13 +- src/librustc/middle/typeck/check/alt.rs | 6 +- src/librustc/middle/typeck/check/demand.rs | 12 +- src/librustc/middle/typeck/check/method.rs | 12 +- src/librustc/middle/typeck/check/mod.rs | 92 +++++---- src/librustc/middle/typeck/check/regionck.rs | 12 +- .../middle/typeck/check/regionmanip.rs | 12 +- src/librustc/middle/typeck/check/vtable.rs | 24 +-- src/librustc/middle/typeck/check/writeback.rs | 12 +- src/librustc/middle/typeck/coherence.rs | 8 +- src/librustc/middle/typeck/collect.rs | 24 ++- .../middle/typeck/infer/assignment.rs | 4 +- src/librustc/middle/typeck/infer/combine.rs | 9 +- src/librustc/middle/typeck/infer/floating.rs | 2 +- src/librustc/middle/typeck/infer/glb.rs | 7 +- src/librustc/middle/typeck/infer/integral.rs | 2 +- src/librustc/middle/typeck/infer/lattice.rs | 6 +- src/librustc/middle/typeck/infer/lub.rs | 7 +- src/librustc/middle/typeck/infer/mod.rs | 74 ++++--- .../middle/typeck/infer/region_inference.rs | 16 +- src/librustc/middle/typeck/infer/resolve.rs | 6 +- src/librustc/middle/typeck/infer/sub.rs | 7 +- src/librustc/middle/typeck/infer/to_str.rs | 6 +- src/librustc/middle/typeck/infer/unify.rs | 9 +- src/librustc/middle/typeck/mod.rs | 79 ++++---- src/librustc/middle/typeck/rscope.rs | 2 +- src/librustc/rustc.rc | 2 +- src/librustdoc/astsrv.rs | 22 +-- src/librustdoc/parse.rs | 4 +- src/librusti/rusti.rc | 6 +- src/libstd/serialization.rs | 2 +- src/libstd/timer.rs | 3 +- src/libstd/uv_global_loop.rs | 4 +- src/libstd/uv_iotask.rs | 2 +- src/libsyntax/ext/auto_serialize.rs | 2 +- src/libsyntax/ext/build.rs | 2 +- src/libsyntax/ext/concat_idents.rs | 2 +- src/libsyntax/ext/deriving.rs | 2 +- src/libsyntax/ext/env.rs | 4 +- src/libsyntax/ext/fmt.rs | 2 +- src/libsyntax/ext/log_syntax.rs | 2 +- src/libsyntax/ext/pipes/ast_builder.rs | 2 +- src/libsyntax/ext/pipes/check.rs | 2 +- src/libsyntax/ext/pipes/mod.rs | 5 +- src/libsyntax/ext/pipes/parse_proto.rs | 2 +- src/libsyntax/ext/pipes/pipec.rs | 13 +- src/libsyntax/ext/pipes/proto.rs | 2 +- src/libsyntax/ext/quote.rs | 4 +- src/libsyntax/ext/source_util.rs | 4 +- src/libsyntax/ext/tt/macro_rules.rs | 7 +- src/libsyntax/ext/tt/transcribe.rs | 2 +- src/libsyntax/parse/attr.rs | 2 +- src/libsyntax/parse/comments.rs | 5 +- src/libsyntax/parse/common.rs | 4 +- src/libsyntax/parse/mod.rs | 13 +- src/libsyntax/parse/obsolete.rs | 2 +- src/libsyntax/parse/parser.rs | 16 +- src/libsyntax/parse/prec.rs | 4 +- src/libsyntax/print/pprust.rs | 4 +- src/libsyntax/syntax.rc | 5 + src/test/auxiliary/cci_capture_clause.rs | 2 +- src/test/auxiliary/pub_use_mods_xcrate.rs | 2 +- src/test/compile-fail/super-at-top-level.rs | 7 + src/test/run-pass/alias-uninit-value.rs | 2 - src/test/run-pass/alt-pattern-drop.rs | 18 +- .../run-pass/auto-ref-bounded-ty-param.rs | 4 +- src/test/run-pass/auto_serialize.rs | 2 + src/test/run-pass/basic-1.rs | 20 +- src/test/run-pass/basic-2.rs | 24 ++- src/test/run-pass/basic.rs | 19 +- src/test/run-pass/bind-by-move.rs | 1 + src/test/run-pass/binops.rs | 13 +- src/test/run-pass/bitv-perf-test.rs | 2 + .../borrowck-borrow-from-expr-block.rs | 6 +- .../call-closure-from-overloaded-op.rs | 6 +- src/test/run-pass/capture_nil.rs | 7 +- src/test/run-pass/chan-leak.rs | 32 ++- src/test/run-pass/class-exports.rs | 2 + src/test/run-pass/comm.rs | 13 +- src/test/run-pass/conditional-compile.rs | 2 + src/test/run-pass/core-export-f64-sqrt.rs | 6 +- src/test/run-pass/decl-with-recv.rs | 18 +- src/test/run-pass/dvec-test.rs | 4 +- .../run-pass/export-glob-imports-target.rs | 4 +- src/test/run-pass/export-glob.rs | 5 +- src/test/run-pass/export-multi.rs | 2 + src/test/run-pass/extern-mod-syntax.rs | 2 + src/test/run-pass/getopts_ref.rs | 2 + src/test/run-pass/guards-not-exhaustive.rs | 4 +- src/test/run-pass/hashmap-memory.rs | 4 +- src/test/run-pass/import-from-foreign.rs | 2 + src/test/run-pass/import-from.rs | 2 + src/test/run-pass/import-glob-0.rs | 2 + src/test/run-pass/import-glob-1.rs | 2 + src/test/run-pass/import-glob-crate.rs | 2 + src/test/run-pass/import-in-block.rs | 2 - src/test/run-pass/import-trailing-comma.rs | 2 + src/test/run-pass/import.rs | 2 + src/test/run-pass/import2.rs | 2 + src/test/run-pass/import3.rs | 2 + src/test/run-pass/import4.rs | 2 + src/test/run-pass/import5.rs | 5 +- src/test/run-pass/import6.rs | 2 + src/test/run-pass/import7.rs | 2 + src/test/run-pass/import8.rs | 2 + src/test/run-pass/intrinsics-math.rs | 2 + src/test/run-pass/issue-1112.rs | 5 +- src/test/run-pass/issue-1696.rs | 2 + src/test/run-pass/issue-2214.rs | 4 +- src/test/run-pass/issue-2383.rs | 2 + src/test/run-pass/issue-2445.rs | 2 - src/test/run-pass/issue-2718.rs | 2 + src/test/run-pass/issue-2804-2.rs | 2 + src/test/run-pass/issue-2804.rs | 2 + src/test/run-pass/issue-2895.rs | 11 +- src/test/run-pass/issue-2904.rs | 2 + src/test/run-pass/issue-3026.rs | 2 + src/test/run-pass/issue-3052.rs | 2 - src/test/run-pass/issue-3424.rs | 2 + src/test/run-pass/issue-3559.rs | 2 + src/test/run-pass/issue-3702.rs | 4 +- src/test/run-pass/issue-507.rs | 17 +- src/test/run-pass/issue-687.rs | 36 ++-- src/test/run-pass/issue-783.rs | 20 +- src/test/run-pass/ivec-tag.rs | 17 +- src/test/run-pass/lazychan.rs | 14 +- .../log-knows-the-names-of-variants-in-std.rs | 2 + src/test/run-pass/mod-merge-hack-template.rs | 2 +- src/test/run-pass/mod-view-items.rs | 2 + src/test/run-pass/nested-pattern.rs | 3 - src/test/run-pass/non-boolean-pure-fns.rs | 2 + src/test/run-pass/pipe-bank-proto.rs | 2 + src/test/run-pass/pipe-detect-term.rs | 2 + src/test/run-pass/pipe-peek.rs | 2 + src/test/run-pass/pipe-pingpong-bounded.rs | 2 + src/test/run-pass/pipe-pingpong-proto.rs | 2 + .../run-pass/pipe-presentation-examples.rs | 2 + src/test/run-pass/pipe-select.rs | 2 + src/test/run-pass/pipe-sleep.rs | 4 +- src/test/run-pass/placement-new-arena.rs | 2 + src/test/run-pass/reexport-star.rs | 2 + src/test/run-pass/regions-mock-trans-impls.rs | 2 + src/test/run-pass/regions-mock-trans.rs | 2 - src/test/run-pass/rt-circular-buffer.rs | 51 +++-- src/test/run-pass/rt-sched-1.rs | 2 - src/test/run-pass/self-shadowing-import.rs | 2 + src/test/run-pass/send-resource.rs | 13 +- src/test/run-pass/send-type-inference.rs | 11 +- src/test/run-pass/sendfn-deep-copy.rs | 5 - src/test/run-pass/sendfn-spawn-with-fn-arg.rs | 5 - .../run-pass/shape_intrinsic_tag_then_rec.rs | 2 + src/test/run-pass/spawn-fn.rs | 5 +- src/test/run-pass/spawn2.rs | 6 +- src/test/run-pass/tag-exports.rs | 2 + src/test/run-pass/task-comm-16.rs | 1 - src/test/run-pass/task-comm-4.rs | 1 - src/test/run-pass/task-comm-6.rs | 1 - src/test/run-pass/task-comm.rs | 52 +++-- src/test/run-pass/task-killjoin-rsrc.rs | 2 - src/test/run-pass/task-killjoin.rs | 2 - src/test/run-pass/trait-inheritance-num.rs | 2 + src/test/run-pass/trait-inheritance-num0.rs | 2 + src/test/run-pass/trait-inheritance-num2.rs | 4 +- src/test/run-pass/unique-copy-box.rs | 7 +- src/test/run-pass/use-mod.rs | 2 + src/test/run-pass/use.rs | 4 +- src/test/run-pass/yield.rs | 9 +- src/test/run-pass/yield1.rs | 5 +- src/test/run-pass/yield2.rs | 2 - src/test/run-pass/zip-same-length.rs | 1 - 226 files changed, 1324 insertions(+), 1140 deletions(-) create mode 100644 src/test/compile-fail/super-at-top-level.rs diff --git a/src/libcargo/cargo.rc b/src/libcargo/cargo.rc index 2ced2026f6d..4fc8ddd9cdb 100644 --- a/src/libcargo/cargo.rc +++ b/src/libcargo/cargo.rc @@ -42,26 +42,25 @@ extern mod std(vers = "0.5"); extern mod rustc(vers = "0.5"); extern mod syntax(vers = "0.5"); -use core::*; - #[legacy_exports] mod pgp; -use syntax::{ast, codemap, parse, visit, attr}; -use syntax::diagnostic::span_handler; -use codemap::span; -use rustc::metadata::filesearch::{get_cargo_root, get_cargo_root_nearest, - get_cargo_sysroot, libdir}; -use syntax::diagnostic; +use rustc::metadata::filesearch::{get_cargo_root, get_cargo_root_nearest}; +use rustc::metadata::filesearch::{get_cargo_sysroot, libdir}; -use result::{Ok, Err}; -use io::WriterUtil; -use send_map::linear::LinearMap; +use core::*; + +use core::dvec::DVec; +use core::io::WriterUtil; +use core::result::{Ok, Err}; +use core::send_map::linear::LinearMap; +use std::getopts::{optflag, optopt, opt_present}; +use std::map::HashMap; use std::{map, json, tempfile, term, sort, getopts}; -use map::HashMap; -use to_str::to_str; -use getopts::{optflag, optopt, opt_present}; -use dvec::DVec; +use syntax::codemap::span; +use syntax::diagnostic::span_handler; +use syntax::diagnostic; +use syntax::{ast, codemap, parse, visit, attr}; struct Package { name: ~str, diff --git a/src/libcore/core.rc b/src/libcore/core.rc index 5f313244e27..bfdc0a6eb0d 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -247,7 +247,7 @@ mod core { #[cfg(test)] mod std { extern mod std(vers = "0.5"); - pub use std::test; + pub use std::std::test; } diff --git a/src/libcore/int-template.rs b/src/libcore/int-template.rs index dbeb51b813f..3878d6a5205 100644 --- a/src/libcore/int-template.rs +++ b/src/libcore/int-template.rs @@ -12,7 +12,12 @@ #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; +#[cfg(stage0)] use T = inst::T; +#[cfg(stage1)] +#[cfg(stage2)] +use T = self::inst::T; + use cmp::{Eq, Ord}; use from_str::FromStr; use num::from_int; diff --git a/src/libcore/int-template/int.rs b/src/libcore/int-template/int.rs index 87f5659e6f4..98d833adea9 100644 --- a/src/libcore/int-template/int.rs +++ b/src/libcore/int-template/int.rs @@ -10,7 +10,11 @@ //! Operations and constants for `int` +#[cfg(stage0)] pub use inst::pow; +#[cfg(stage1)] +#[cfg(stage2)] +pub use self::inst::pow; mod inst { pub type T = int; @@ -54,4 +58,4 @@ mod inst { assert (min_value <= 0); assert (min_value + max_value + 1 == 0); } -} \ No newline at end of file +} diff --git a/src/libcore/iter-trait.rs b/src/libcore/iter-trait.rs index 861f55afc99..dfb91c49b7d 100644 --- a/src/libcore/iter-trait.rs +++ b/src/libcore/iter-trait.rs @@ -16,7 +16,12 @@ #[forbid(deprecated_pattern)]; use cmp::{Eq, Ord}; + +#[cfg(stage0)] use inst::{IMPL_T, EACH, SIZE_HINT}; +#[cfg(stage1)] +#[cfg(stage2)] +use self::inst::{IMPL_T, EACH, SIZE_HINT}; impl IMPL_T: iter::BaseIter { pure fn each(blk: fn(v: &A) -> bool) { EACH(&self, blk) } diff --git a/src/libcore/libc.rs b/src/libcore/libc.rs index 64f63663098..80e3a22dcba 100644 --- a/src/libcore/libc.rs +++ b/src/libcore/libc.rs @@ -59,89 +59,109 @@ // Initial glob-exports mean that all the contents of all the modules // wind up exported, if you're interested in writing platform-specific code. -pub use types::common::c95::*; -pub use types::common::c99::*; -pub use types::common::posix88::*; -pub use types::common::posix01::*; -pub use types::common::posix08::*; -pub use types::common::bsd44::*; -pub use types::os::common::posix01::*; -pub use types::os::arch::c95::*; -pub use types::os::arch::c99::*; -pub use types::os::arch::posix88::*; -pub use types::os::arch::posix01::*; -pub use types::os::arch::posix08::*; -pub use types::os::arch::bsd44::*; -pub use types::os::arch::extra::*; +pub use libc::types::common::c95::*; +pub use libc::types::common::c99::*; +pub use libc::types::common::posix88::*; +pub use libc::types::common::posix01::*; +pub use libc::types::common::posix08::*; +pub use libc::types::common::bsd44::*; +pub use libc::types::os::common::posix01::*; +pub use libc::types::os::arch::c95::*; +pub use libc::types::os::arch::c99::*; +pub use libc::types::os::arch::posix88::*; +pub use libc::types::os::arch::posix01::*; +pub use libc::types::os::arch::posix08::*; +pub use libc::types::os::arch::bsd44::*; +pub use libc::types::os::arch::extra::*; -pub use consts::os::c95::*; -pub use consts::os::c99::*; -pub use consts::os::posix88::*; -pub use consts::os::posix01::*; -pub use consts::os::posix08::*; -pub use consts::os::bsd44::*; -pub use consts::os::extra::*; +pub use libc::consts::os::c95::*; +pub use libc::consts::os::c99::*; +pub use libc::consts::os::posix88::*; +pub use libc::consts::os::posix01::*; +pub use libc::consts::os::posix08::*; +pub use libc::consts::os::bsd44::*; +pub use libc::consts::os::extra::*; -pub use funcs::c95::ctype::*; -pub use funcs::c95::stdio::*; -pub use funcs::c95::stdlib::*; -pub use funcs::c95::string::*; +pub use libc::funcs::c95::ctype::*; +pub use libc::funcs::c95::stdio::*; +pub use libc::funcs::c95::stdlib::*; +pub use libc::funcs::c95::string::*; -pub use funcs::posix88::stat_::*; -pub use funcs::posix88::stdio::*; -pub use funcs::posix88::fcntl::*; -pub use funcs::posix88::dirent::*; -pub use funcs::posix88::unistd::*; +pub use libc::funcs::posix88::stat_::*; +pub use libc::funcs::posix88::stdio::*; +pub use libc::funcs::posix88::fcntl::*; +pub use libc::funcs::posix88::dirent::*; +pub use libc::funcs::posix88::unistd::*; -pub use funcs::posix01::stat_::*; -pub use funcs::posix01::unistd::*; -pub use funcs::posix08::unistd::*; +pub use libc::funcs::posix01::stat_::*; +pub use libc::funcs::posix01::unistd::*; +pub use libc::funcs::posix08::unistd::*; -pub use funcs::bsd44::*; -pub use funcs::extra::*; +pub use libc::funcs::bsd44::*; +pub use libc::funcs::extra::*; + +#[cfg(target_os = "win32")] +pub use libc::funcs::extra::kernel32::*; +#[cfg(target_os = "win32")] +pub use libc::funcs::extra::msvcrt::*; // Explicit export lists for the intersection (provided here) mean that // you can write more-platform-agnostic code if you stick to just these // symbols. -pub use size_t; -pub use c_float, c_double, c_void, FILE, fpos_t; -pub use DIR, dirent_t; -pub use c_char, c_schar, c_uchar; -pub use c_short, c_ushort, c_int, c_uint, c_long, c_ulong; -pub use size_t, ptrdiff_t, clock_t, time_t; -pub use c_longlong, c_ulonglong, intptr_t, uintptr_t; -pub use off_t, dev_t, ino_t, pid_t, mode_t, ssize_t; +pub use libc::types::common::c95::{FILE, c_void, fpos_t}; +pub use libc::types::common::posix88::{DIR, dirent_t}; +pub use libc::types::os::arch::c95::{c_char, c_double, c_float, c_int}; +pub use libc::types::os::arch::c95::{c_long, c_short, c_uchar, c_ulong}; +pub use libc::types::os::arch::c95::{c_ushort, clock_t, ptrdiff_t}; +pub use libc::types::os::arch::c95::{size_t, time_t}; +pub use libc::types::os::arch::c99::{c_longlong, c_ulonglong, intptr_t}; +pub use libc::types::os::arch::c99::{uintptr_t}; +pub use libc::types::os::arch::posix88::{dev_t, dirent_t, ino_t, mode_t}; +pub use libc::types::os::arch::posix88::{off_t, pid_t, ssize_t}; -pub use EXIT_FAILURE, EXIT_SUCCESS, RAND_MAX, -EOF, SEEK_SET, SEEK_CUR, SEEK_END, _IOFBF, _IONBF, _IOLBF, -BUFSIZ, FOPEN_MAX, FILENAME_MAX, L_tmpnam, TMP_MAX, -O_RDONLY, O_WRONLY, O_RDWR, O_APPEND, O_CREAT, O_EXCL, O_TRUNC, -S_IFIFO, S_IFCHR, S_IFBLK, S_IFDIR, S_IFREG, S_IFMT, S_IEXEC, -S_IWRITE, S_IREAD, S_IRWXU, S_IXUSR, S_IWUSR, S_IRUSR, F_OK, R_OK, -W_OK, X_OK, STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO; +pub use libc::consts::os::c95::{_IOFBF, _IOLBF, _IONBF, BUFSIZ, EOF}; +pub use libc::consts::os::c95::{EXIT_FAILURE, EXIT_SUCCESS}; +pub use libc::consts::os::c95::{FILENAME_MAX, FOPEN_MAX, L_tmpnam}; +pub use libc::consts::os::c95::{RAND_MAX, SEEK_CUR, SEEK_END}; +pub use libc::consts::os::c95::{SEEK_SET, TMP_MAX}; +pub use libc::consts::os::posix88::{F_OK, O_APPEND, O_CREAT, O_EXCL}; +pub use libc::consts::os::posix88::{O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY}; +pub use libc::consts::os::posix88::{R_OK, S_IEXEC, S_IFBLK, S_IFCHR}; +pub use libc::consts::os::posix88::{S_IFDIR, S_IFIFO, S_IFMT, S_IFREG}; +pub use libc::consts::os::posix88::{S_IREAD, S_IRUSR, S_IRWXU, S_IWUSR}; +pub use libc::consts::os::posix88::{STDERR_FILENO, STDIN_FILENO}; +pub use libc::consts::os::posix88::{STDOUT_FILENO, W_OK, X_OK}; -pub use isalnum, isalpha, iscntrl, isdigit, islower, isprint, ispunct, -isspace, isupper, isxdigit, tolower, toupper; +pub use libc::funcs::c95::ctype::{isalnum, isalpha, iscntrl, isdigit}; +pub use libc::funcs::c95::ctype::{islower, isprint, ispunct, isspace}; +pub use libc::funcs::c95::ctype::{isupper, isxdigit, tolower, toupper}; -pub use fopen, freopen, fflush, fclose, remove, tmpfile, setvbuf, setbuf, -fgetc, fgets, fputc, fputs, puts, ungetc, fread, fwrite, fseek, ftell, -rewind, fgetpos, fsetpos, feof, ferror, perror; +pub use libc::funcs::c95::stdio::{fclose, feof, ferror, fflush, fgetc}; +pub use libc::funcs::c95::stdio::{fgetpos, fgets, fopen, fputc, fputs}; +pub use libc::funcs::c95::stdio::{fread, freopen, fseek, fsetpos, ftell}; +pub use libc::funcs::c95::stdio::{fwrite, perror, puts, remove, rewind}; +pub use libc::funcs::c95::stdio::{setbuf, setvbuf, tmpfile, ungetc}; -pub use abs, labs, atof, atoi, strtod, strtol, strtoul, calloc, malloc, -realloc, free, abort, exit, system, getenv, rand, srand; +pub use libc::funcs::c95::stdlib::{abort, abs, atof, atoi, calloc, exit}; +pub use libc::funcs::c95::stdlib::{free, getenv, labs, malloc, rand}; +pub use libc::funcs::c95::stdlib::{realloc, srand, strtod, strtol}; +pub use libc::funcs::c95::stdlib::{strtoul, system}; -pub use strcpy, strncpy, strcat, strncat, strcmp, strncmp, strcoll, strchr, -strrchr, strspn, strcspn, strpbrk, strstr, strlen, strerror, strtok, -strxfrm, memcpy, memmove, memcmp, memchr, memset; +pub use libc::funcs::c95::string::{memchr, memcmp, memcpy, memmove}; +pub use libc::funcs::c95::string::{memset, strcat, strchr, strcmp}; +pub use libc::funcs::c95::string::{strcoll, strcpy, strcspn, strerror}; +pub use libc::funcs::c95::string::{strlen, strncat, strncmp, strncpy}; +pub use libc::funcs::c95::string::{strpbrk, strrchr, strspn, strstr}; +pub use libc::funcs::c95::string::{strtok, strxfrm}; -pub use chmod, mkdir; -pub use popen, pclose, fdopen, fileno; -pub use open, creat; -pub use access, chdir, close, dup, dup2, execv, execve, execvp, getcwd, -getpid, isatty, lseek, pipe, read, rmdir, unlink, write; - -pub use fstat, stat; +pub use libc::funcs::posix88::fcntl::{open, creat}; +pub use libc::funcs::posix88::stat_::{chmod, fstat, mkdir, stat}; +pub use libc::funcs::posix88::stdio::{fdopen, fileno, pclose, popen}; +pub use libc::funcs::posix88::unistd::{access, chdir, close, dup, dup2}; +pub use libc::funcs::posix88::unistd::{execv, execve, execvp, getcwd}; +pub use libc::funcs::posix88::unistd::{getpid, isatty, lseek, pipe, read}; +pub use libc::funcs::posix88::unistd::{rmdir, unlink, write}; mod types { @@ -1365,10 +1385,6 @@ pub mod funcs { #[cfg(target_os = "win32")] pub mod extra { - use types::os::arch::extra::*; - pub use kernel32::*; - pub use msvcrt::*; - #[abi = "stdcall"] pub extern mod kernel32 { fn GetEnvironmentVariableW(n: LPCWSTR, @@ -1396,7 +1412,7 @@ pub mod funcs { #[nolink] pub extern mod msvcrt { #[link_name = "_commit"] - fn commit(fd: c_int) -> c_int; + pub fn commit(fd: c_int) -> c_int; } } } diff --git a/src/libcore/os.rs b/src/libcore/os.rs index e793155c267..c3bf8df5114 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -1,4 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// Copyright 2012 The Rust Project Developers.src/libcore/os.rs // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -36,7 +36,7 @@ pub use libc::{close, fclose}; use option::{Some, None}; -pub use consts::*; +pub use os::consts::*; use task::TaskBuilder; // FIXME: move these to str perhaps? #2620 @@ -77,8 +77,8 @@ pub fn fill_charp_buf(f: fn(*mut c_char, size_t) -> bool) } #[cfg(windows)] -mod win32 { - use libc::DWORD; +pub mod win32 { + use libc::types::os::arch::extra::DWORD; pub fn fill_utf16_buf_and_decode(f: fn(*mut u16, DWORD) -> DWORD) -> Option<~str> { @@ -224,7 +224,7 @@ mod global_env { #[cfg(windows)] pub fn getenv(n: &str) -> Option<~str> { - use win32::*; + use os::win32::*; do as_utf16_p(n) |u| { do fill_utf16_buf_and_decode() |buf, sz| { libc::GetEnvironmentVariableW(u, buf, sz) @@ -245,7 +245,7 @@ mod global_env { #[cfg(windows)] pub fn setenv(n: &str, v: &str) { - use win32::*; + use os::win32::*; do as_utf16_p(n) |nbuf| { do as_utf16_p(v) |vbuf| { libc::SetEnvironmentVariableW(nbuf, vbuf); @@ -403,7 +403,7 @@ pub fn self_exe_path() -> Option { #[cfg(windows)] fn load_self() -> Option<~str> { - use win32::*; + use os::win32::*; do fill_utf16_buf_and_decode() |buf, sz| { libc::GetModuleFileNameW(0u as libc::DWORD, buf, sz) } @@ -566,7 +566,7 @@ pub fn make_dir(p: &Path, mode: c_int) -> bool { #[cfg(windows)] fn mkdir(p: &Path, _mode: c_int) -> bool { - use win32::*; + use os::win32::*; // FIXME: turn mode into something useful? #2623 do as_utf16_p(p.to_str()) |buf| { libc::CreateDirectoryW(buf, unsafe { @@ -614,7 +614,7 @@ pub fn remove_dir(p: &Path) -> bool { #[cfg(windows)] fn rmdir(p: &Path) -> bool { - use win32::*; + use os::win32::*; return do as_utf16_p(p.to_str()) |buf| { libc::RemoveDirectoryW(buf) != (0 as libc::BOOL) }; @@ -633,7 +633,7 @@ pub fn change_dir(p: &Path) -> bool { #[cfg(windows)] fn chdir(p: &Path) -> bool { - use win32::*; + use os::win32::*; return do as_utf16_p(p.to_str()) |buf| { libc::SetCurrentDirectoryW(buf) != (0 as libc::BOOL) }; @@ -653,7 +653,7 @@ pub fn copy_file(from: &Path, to: &Path) -> bool { #[cfg(windows)] fn do_copy_file(from: &Path, to: &Path) -> bool { - use win32::*; + use os::win32::*; return do as_utf16_p(from.to_str()) |fromp| { do as_utf16_p(to.to_str()) |top| { libc::CopyFileW(fromp, top, (0 as libc::BOOL)) != @@ -713,7 +713,7 @@ pub fn remove_file(p: &Path) -> bool { #[cfg(windows)] fn unlink(p: &Path) -> bool { - use win32::*; + use os::win32::*; return do as_utf16_p(p.to_str()) |buf| { libc::DeleteFileW(buf) != (0 as libc::BOOL) }; diff --git a/src/libcore/send_map.rs b/src/libcore/send_map.rs index 4a8fe459b37..af6b2c16377 100644 --- a/src/libcore/send_map.rs +++ b/src/libcore/send_map.rs @@ -451,7 +451,7 @@ pub mod linear { #[test] pub mod test { - use linear::LinearMap; + use send_map::linear::LinearMap; #[test] pub fn inserts() { diff --git a/src/libcore/task/local_data.rs b/src/libcore/task/local_data.rs index cc0353a354b..ca8cc67dc4a 100644 --- a/src/libcore/task/local_data.rs +++ b/src/libcore/task/local_data.rs @@ -26,7 +26,7 @@ magic. */ -use local_data_priv::{ +use task::local_data_priv::{ local_pop, local_get, local_set, diff --git a/src/libcore/task/local_data_priv.rs b/src/libcore/task/local_data_priv.rs index 494801d88ea..a5ae3291b87 100644 --- a/src/libcore/task/local_data_priv.rs +++ b/src/libcore/task/local_data_priv.rs @@ -10,8 +10,13 @@ #[doc(hidden)]; // FIXME #3538 -use local_data::LocalDataKey; +use task::local_data::LocalDataKey; + +#[cfg(notest)] use rt::rust_task; +#[cfg(test)] +#[allow(non_camel_case_types)] +type rust_task = libc::c_void; pub trait LocalData { } impl @T: LocalData { } diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index 98da3f50318..d9b040abf7b 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -41,12 +41,10 @@ use cmp::Eq; use result::Result; use pipes::{stream, Chan, Port}; -use local_data_priv::{local_get, local_set}; +use task::local_data_priv::{local_get, local_set}; +use task::rt::{task_id, rust_task}; use util::replace; -use rt::task_id; -use rt::rust_task; - mod local_data_priv; pub mod local_data; pub mod rt; diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 61e358e1e30..e2ed853ee29 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -73,8 +73,8 @@ #[doc(hidden)]; // FIXME #3538 #[warn(deprecated_mode)]; -use rt::rust_task; -use rt::rust_closure; +use task::rt::rust_task; +use task::rt::rust_closure; macro_rules! move_it ( { $x:expr } => ( unsafe { let y = move *ptr::addr_of(&($x)); move y } ) diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs index 7f9aa28e364..55055470f10 100644 --- a/src/libcore/to_str.rs +++ b/src/libcore/to_str.rs @@ -18,7 +18,7 @@ The `ToStr` trait for converting to strings #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; -pub trait ToStr { pure fn to_str() -> ~str; } +pub trait ToStr { pub pure fn to_str() -> ~str; } impl int: ToStr { pure fn to_str() -> ~str { int::str(self) } diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs index 8a03b0f94bc..a7d37c3ae61 100644 --- a/src/libcore/uint-template.rs +++ b/src/libcore/uint-template.rs @@ -12,7 +12,12 @@ #[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; +#[cfg(stage0)] use T = inst::T; +#[cfg(stage1)] +#[cfg(stage2)] +use T = self::inst::T; + use cmp::{Eq, Ord}; use from_str::FromStr; diff --git a/src/libcore/uint-template/u8.rs b/src/libcore/uint-template/u8.rs index 81635bf1e7f..4d0b3f2d4b7 100644 --- a/src/libcore/uint-template/u8.rs +++ b/src/libcore/uint-template/u8.rs @@ -10,7 +10,11 @@ //! Operations and constants for `u8` +#[cfg(stage0)] pub use inst::is_ascii; +#[cfg(stage1)] +#[cfg(stage2)] +pub use self::inst::is_ascii; mod inst { pub type T = u8; diff --git a/src/libcore/uint-template/uint.rs b/src/libcore/uint-template/uint.rs index 718d7956b31..8451d78d8e0 100644 --- a/src/libcore/uint-template/uint.rs +++ b/src/libcore/uint-template/uint.rs @@ -10,10 +10,17 @@ //! Operations and constants for `uint` +#[cfg(stage0)] pub use inst::{ div_ceil, div_round, div_floor, iterate, next_power_of_two }; +#[cfg(stage1)] +#[cfg(stage2)] +pub use self::inst::{ + div_ceil, div_round, div_floor, iterate, + next_power_of_two +}; mod inst { pub type T = uint; @@ -169,4 +176,4 @@ mod inst { assert(uint::div_ceil(3u, 4u) == 1u); assert(uint::div_round(3u, 4u) == 1u); } -} \ No newline at end of file +} diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index 38594ea2c17..b2cb6da78dd 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -9,16 +9,17 @@ // except according to those terms. -use syntax::{ast, codemap}; -use syntax::ast::node_id; -use codemap::span; -use syntax::ast::{int_ty, uint_ty, float_ty}; -use syntax::parse::parse_sess; -use metadata::filesearch; -use back::target_strs; use back::link; +use back::target_strs; +use metadata::filesearch; use middle::lint; +use syntax::ast::node_id; +use syntax::ast::{int_ty, uint_ty, float_ty}; +use syntax::codemap::span; +use syntax::parse::parse_sess; +use syntax::{ast, codemap}; + enum os { os_win32, os_macos, os_linux, os_freebsd, } diff --git a/src/librustc/front/intrinsic.rs b/src/librustc/front/intrinsic.rs index 8a65ac6894b..8703e604744 100644 --- a/src/librustc/front/intrinsic.rs +++ b/src/librustc/front/intrinsic.rs @@ -14,7 +14,7 @@ mod intrinsic { #[legacy_exports]; - pub use rusti::visit_tydesc; + pub use intrinsic::rusti::visit_tydesc; // FIXME (#3727): remove this when the interface has settled and the // version in sys is no longer present. diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs index 9c734f8e698..bebddec94d3 100644 --- a/src/librustc/metadata/creader.rs +++ b/src/librustc/metadata/creader.rs @@ -17,8 +17,8 @@ use syntax::visit; use syntax::codemap::span; use std::map::HashMap; use syntax::print::pprust; -use filesearch::FileSearch; -use common::*; +use metadata::filesearch::FileSearch; +use metadata::common::*; use dvec::DVec; use syntax::parse::token::ident_interner; diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs index 9dc4a01b731..ae56cf45dbc 100644 --- a/src/librustc/metadata/csearch.rs +++ b/src/librustc/metadata/csearch.rs @@ -10,19 +10,20 @@ // Searching for information from the cstore -use std::ebml; -use reader = std::ebml::reader; -use syntax::ast; -use syntax::ast_util; -use syntax::ast_map; +use metadata::common::*; use middle::ty; -use option::{Some, None}; -use syntax::diagnostic::span_handler; -use syntax::diagnostic::expect; -use ast_util::dummy_sp; -use common::*; + +use core::dvec::DVec; +use core::option::{Some, None}; +use reader = std::ebml::reader; +use std::ebml; use std::map::HashMap; -use dvec::DVec; +use syntax::ast; +use syntax::ast_map; +use syntax::ast_util::dummy_sp; +use syntax::ast_util; +use syntax::diagnostic::expect; +use syntax::diagnostic::span_handler; export struct_dtor; export get_symbol; diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index 110b151a651..1e86eb78cfe 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -10,27 +10,28 @@ // Decoding metadata from a single crate's metadata -use std::ebml; -use std::map; -use std::map::HashMap; -use std::serialization::deserialize; -use reader = ebml::reader; -use io::WriterUtil; +use cmd = metadata::cstore::crate_metadata; use dvec::DVec; -use syntax::{ast, ast_util}; -use syntax::attr; -use middle::ty; -use syntax::ast_map; -use tydecode::{parse_ty_data, parse_def_id, parse_bounds_data, - parse_ident}; -use syntax::print::pprust; -use cmd=cstore::crate_metadata; -use util::ppaux::ty_to_str; -use syntax::diagnostic::span_handler; -use common::*; -use syntax::parse::token::ident_interner; use hash::{Hash, HashUtil}; -use csearch::{ProvidedTraitMethodInfo, StaticMethodInfo}; +use io::WriterUtil; +use metadata::common::*; +use metadata::csearch::{ProvidedTraitMethodInfo, StaticMethodInfo}; +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 std::ebml; +use std::map::HashMap; +use std::map; +use std::serialization::deserialize; +use syntax::ast_map; +use syntax::attr; +use syntax::diagnostic::span_handler; +use syntax::parse::token::ident_interner; +use syntax::print::pprust; +use syntax::{ast, ast_util}; export struct_dtor; export get_struct_fields; diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index e2a4b8880c9..6000c20ba1b 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -15,12 +15,12 @@ use util::ppaux::ty_to_str; use std::{ebml, map}; use std::map::HashMap; use io::WriterUtil; -use writer = ebml::writer; +use writer = std::ebml::writer; use syntax::ast::*; use syntax::print::pprust; use syntax::{ast_util, visit}; use syntax::ast_util::*; -use common::*; +use metadata::common::*; use middle::ty; use middle::ty::node_id_to_type; use middle::resolve; diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index b1a4fcc24cd..5901e58aeb1 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -15,7 +15,7 @@ use syntax::{ast, attr}; use syntax::print::pprust; use syntax::codemap::span; use lib::llvm::{False, llvm, mk_object_file, mk_section_iter}; -use filesearch::FileSearch; +use metadata::filesearch::FileSearch; use io::WriterUtil; use syntax::parse::token::ident_interner; diff --git a/src/librustc/metadata/mod.rs b/src/librustc/metadata/mod.rs index 43790002136..4ba6abb0383 100644 --- a/src/librustc/metadata/mod.rs +++ b/src/librustc/metadata/mod.rs @@ -41,35 +41,3 @@ mod loader; #[legacy_exports] mod filesearch; - -// Define the rustc API's that the metadata module has access to -// Over time we will reduce these dependencies and, once metadata has -// no dependencies on rustc it can move into its own crate. - -mod middle { - #[legacy_exports]; - pub use middle_::ty; - pub use middle_::resolve; -} - -mod front { - #[legacy_exports]; -} - -mod back { - #[legacy_exports]; -} - -mod driver { - #[legacy_exports]; -} - -mod util { - #[legacy_exports]; - pub use util_::ppaux; -} - -mod lib { - #[legacy_exports]; - pub use lib_::llvm; -} diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 1708027eaf9..9289e17eeb2 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -13,13 +13,14 @@ // tjc note: Would be great to have a `match check` macro equivalent // for some of these +use middle::ty; +use middle::ty::{FnTyBase, FnMeta, FnSig}; + use syntax::ast; use syntax::ast::*; use syntax::ast_util; use syntax::ast_util::respan; -use middle::ty; use std::map::HashMap; -use ty::{FnTyBase, FnMeta, FnSig}; export parse_state_from_data; export parse_arg_data, parse_ty_data, parse_def_id, parse_ident; diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index 781ac7809e7..cf6b0bf332e 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -8,46 +8,40 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use c = metadata::common; +use cstore = metadata::cstore; +use driver::session::Session; +use e = metadata::encoder; +use metadata::decoder; +use metadata::encoder; +use metadata::tydecode; +use metadata::tyencode; +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 util::ppaux::ty_to_str; +use reader = std::ebml::reader; +use std::ebml::reader::get_doc; +use std::ebml::writer::Serializer; +use std::ebml; +use std::map::HashMap; +use std::serialization::{DeserializerHelpers, deserialize}; +use std::serialization::{Serializable, SerializerHelpers}; +use std::serialization; use syntax::ast; -use syntax::fold; -use syntax::fold::*; -use syntax::visit; use syntax::ast_map; use syntax::ast_util; use syntax::codemap::span; -use std::ebml; -use writer = std::ebml::writer; -use reader = std::ebml::reader; -use reader::get_doc; -use writer::Serializer; -use std::map::HashMap; -use std::serialization; -use std::serialization::{Serializable, - SerializerHelpers, - DeserializerHelpers, - deserialize}; -use middle::{ty, typeck}; -use middle::typeck::{method_origin, method_map_entry, - vtable_res, - vtable_origin}; -use driver::session::Session; -use middle::freevars::freevar_entry; -use c = metadata::common; -use e = metadata::encoder; -use cstore = metadata::cstore; -use metadata::encoder; -use metadata::decoder; -use metadata::tyencode; -use metadata::tydecode; - - -// used in testing: -use syntax::diagnostic; use syntax::codemap; +use syntax::diagnostic; +use syntax::fold::*; +use syntax::fold; use syntax::parse; use syntax::print::pprust; +use syntax::visit; +use writer = std::ebml::writer; export maps; export encode_inlined_item; diff --git a/src/librustc/middle/borrowck/gather_loans.rs b/src/librustc/middle/borrowck/gather_loans.rs index eafbe8b16ab..d5809a7389e 100644 --- a/src/librustc/middle/borrowck/gather_loans.rs +++ b/src/librustc/middle/borrowck/gather_loans.rs @@ -16,9 +16,9 @@ // their associated scopes. In phase two, checking loans, we will then make // sure that all of these loans are honored. -use mem_categorization::{mem_categorization_ctxt, opt_deref_kind}; -use preserve::{preserve_condition, pc_ok, pc_if_pure}; -use ty::{ty_region}; +use middle::mem_categorization::{mem_categorization_ctxt, opt_deref_kind}; +use middle::borrowck::preserve::{preserve_condition, pc_ok, pc_if_pure}; +use middle::ty::{ty_region}; use core::send_map::linear::LinearMap; diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index c5a02c978f9..90de3281447 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -226,34 +226,36 @@ Borrowck results in two maps. #[legacy_exports]; -use syntax::ast; -use syntax::ast::{mutability, m_mutbl, m_imm, m_const}; -use syntax::visit; -use syntax::ast_util; -use syntax::ast_map; -use syntax::codemap::span; -use util::ppaux::{ty_to_str, region_to_str, explain_region, - expr_repr, note_and_explain_region}; -use std::map::{HashMap, Set}; -use std::list; -use std::list::{List, Cons, Nil}; -use result::{Result, Ok, Err}; -use syntax::print::pprust; +use middle::mem_categorization::*; +use middle::ty::to_str; use util::common::indenter; -use ty::to_str; -use dvec::DVec; -use mem_categorization::*; +use util::ppaux::{expr_repr, note_and_explain_region}; +use util::ppaux::{ty_to_str, region_to_str, explain_region}; + +use core::dvec::DVec; +use core::result::{Result, Ok, Err}; +use std::list::{List, Cons, Nil}; +use std::list; +use std::map::{HashMap, Set}; +use syntax::ast::{mutability, m_mutbl, m_imm, m_const}; +use syntax::ast; +use syntax::ast_map; +use syntax::ast_util; +use syntax::codemap::span; +use syntax::print::pprust; +use syntax::visit; #[legacy_exports] -mod check_loans; +pub mod check_loans; #[legacy_exports] -mod gather_loans; +pub mod gather_loans; #[legacy_exports] -mod loan; +pub mod loan; #[legacy_exports] -mod preserve; +pub mod preserve; export check_crate, root_map, mutbl_map; +export check_loans, gather_loans, loan, preserve; fn check_crate(tcx: ty::ctxt, method_map: typeck::method_map, diff --git a/src/librustc/middle/check_alt.rs b/src/librustc/middle/check_alt.rs index ff4fed8b37e..d3448a5f3a9 100644 --- a/src/librustc/middle/check_alt.rs +++ b/src/librustc/middle/check_alt.rs @@ -8,19 +8,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use middle::const_eval::{compare_const_vals, lookup_const_by_id}; +use middle::const_eval::{eval_const_expr, const_val, const_int, const_bool}; +use middle::pat_util::*; +use middle::ty::*; +use middle::ty; +use middle::typeck::method_map; +use util::ppaux::ty_to_str; + +use std::map::HashMap; use syntax::ast::*; use syntax::ast_util::{variant_def_ids, dummy_sp, unguarded_pat, walk_pat}; -use const_eval::{eval_const_expr, const_val, const_int, const_bool, - compare_const_vals, lookup_const_by_id}; use syntax::codemap::span; use syntax::print::pprust::pat_to_str; -use util::ppaux::ty_to_str; -use pat_util::*; use syntax::visit; -use middle::ty; -use middle::ty::*; -use middle::typeck::method_map; -use std::map::HashMap; struct AltCheckCtxt { tcx: ty::ctxt, diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index f483f922ed7..a51885b1fc7 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use syntax::{ast,ast_map,ast_util,visit}; -use ast::*; +use syntax::{ast, ast_map, ast_util, visit}; +use syntax::ast::*; // // This pass classifies expressions by their constant-ness. diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs index f5edad9acc4..a8395013958 100644 --- a/src/librustc/middle/kind.rs +++ b/src/librustc/middle/kind.rs @@ -8,16 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use syntax::{visit, ast_util}; +use middle::freevars::freevar_entry; +use middle::lint::{non_implicitly_copyable_typarams, implicit_copies}; +use middle::ty::{CopyValue, MoveValue, ReadValue}; +use middle::ty::{Kind, kind_copyable, kind_noncopyable, kind_const}; +use util::ppaux::{ty_to_str, tys_to_str}; + +use std::map::HashMap; use syntax::ast::*; use syntax::codemap::span; -use middle::ty::{Kind, kind_copyable, kind_noncopyable, kind_const}; -use middle::ty::{CopyValue, MoveValue, ReadValue}; -use std::map::HashMap; -use util::ppaux::{ty_to_str, tys_to_str}; use syntax::print::pprust::expr_to_str; -use freevars::freevar_entry; -use lint::{non_implicitly_copyable_typarams,implicit_copies}; +use syntax::{visit, ast_util}; // Kind analysis pass. // diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index e8fcbf12356..48fff1a269b 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -102,17 +102,18 @@ * to return explicitly. */ -use dvec::DVec; -use std::map::HashMap; -use syntax::{visit, ast_util}; -use syntax::print::pprust::{expr_to_str, block_to_str}; -use visit::vt; -use syntax::codemap::span; -use syntax::ast::*; -use io::WriterUtil; -use capture::{cap_move, cap_drop, cap_copy, cap_ref}; +use middle::capture::{cap_move, cap_drop, cap_copy, cap_ref}; use middle::ty::MoveValue; +use core::dvec::DVec; +use core::io::WriterUtil; +use std::map::HashMap; +use syntax::ast::*; +use syntax::codemap::span; +use syntax::print::pprust::{expr_to_str, block_to_str}; +use syntax::visit::vt; +use syntax::{visit, ast_util}; + export check_crate; export last_use_map; diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 78c423b791d..5819db17f58 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -11,6 +11,9 @@ // A pass that checks to make sure private fields and methods aren't used // outside their scopes. +use middle::ty::{ty_struct, ty_enum}; +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; @@ -21,9 +24,6 @@ use syntax::ast::{provided, required}; use syntax::ast_map::{node_item, node_method}; use syntax::ast_util::{Private, Public, has_legacy_export_attr, is_local}; use syntax::ast_util::{visibility_to_privacy}; -use ty::{ty_struct, ty_enum}; -use typeck::{method_map, method_origin, method_param, method_self}; -use typeck::{method_static, method_trait}; use core::util::ignore; use dvec::DVec; diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 4d5e29678a1..f746e023680 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -18,18 +18,19 @@ region parameterized. */ use driver::session::Session; -use middle::ty; -use syntax::{ast, visit}; -use syntax::codemap::span; -use syntax::print::pprust; -use syntax::ast_map; -use dvec::DVec; use metadata::csearch; -use ty::{region_variance, rv_covariant, rv_invariant, rv_contravariant}; +use middle::ty::{region_variance, rv_covariant, rv_invariant}; +use middle::ty::{rv_contravariant}; +use middle::ty; +use core::dvec::DVec; use std::list; use std::list::list; use std::map::HashMap; +use syntax::ast_map; +use syntax::codemap::span; +use syntax::print::pprust; +use syntax::{ast, visit}; type parent = Option; diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index bc987db48cd..bc728e5319a 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -313,6 +313,16 @@ enum XrayFlag { Xray //< Private items can be accessed. } +enum UseLexicalScopeFlag { + DontUseLexicalScope, + UseLexicalScope +} + +struct ModulePrefixResult { + result: ResolveResult<@Module>, + prefix_len: uint +} + impl XrayFlag : cmp::Eq { pure fn eq(&self, other: &XrayFlag) -> bool { ((*self) as uint) == ((*other) as uint) @@ -2108,9 +2118,10 @@ impl Resolver { } else { // First, resolve the module path for the directive, if necessary. match self.resolve_module_path_for_import(module_, - module_path, - NoXray, - import_directive.span) { + module_path, + NoXray, + DontUseLexicalScope, + import_directive.span) { Failed => { resolution_result = Failed; @@ -2650,8 +2661,11 @@ impl Resolver { while index < module_path_len { let name = (*module_path).get_elt(index); - match self.resolve_name_in_module(search_module, name, TypeNS, - xray) { + match self.resolve_name_in_module(search_module, + name, + TypeNS, + xray, + false) { Failed => { self.session.span_err(span, ~"unresolved name"); return Failed; @@ -2702,12 +2716,13 @@ impl Resolver { } /** - * Attempts to resolve the module part of an import directive rooted at - * the given module. + * Attempts to resolve the module part of an import directive or path + * rooted at the given module. */ fn resolve_module_path_for_import(module_: @Module, module_path: @DVec, xray: XrayFlag, + use_lexical_scope: UseLexicalScopeFlag, span: span) -> ResolveResult<@Module> { @@ -2722,9 +2737,20 @@ impl Resolver { // The first element of the module path must be in the current scope // chain. - let first_element = (*module_path).get_elt(0); + 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 } + } + }; + let mut search_module; - match self.resolve_module_in_lexical_scope(module_, first_element) { + match resolve_result.result { Failed => { self.session.span_err(span, ~"unresolved name"); return Failed; @@ -2740,10 +2766,10 @@ impl Resolver { } return self.resolve_module_path_from_root(search_module, - module_path, - 1, - xray, - span); + module_path, + resolve_result.prefix_len, + xray, + span); } fn resolve_item_in_lexical_scope(module_: @Module, @@ -2811,8 +2837,11 @@ impl Resolver { } // Resolve the name in the parent module. - match self.resolve_name_in_module(search_module, name, namespace, - Xray) { + match self.resolve_name_in_module(search_module, + name, + namespace, + Xray, + false) { Failed => { // Continue up the search chain. } @@ -2832,9 +2861,15 @@ impl Resolver { } } + /** Resolves a module name in the current lexical scope. */ fn resolve_module_in_lexical_scope(module_: @Module, name: ident) -> ResolveResult<@Module> { - match self.resolve_item_in_lexical_scope(module_, name, TypeNS) { + // 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); + match resolve_result { Success(target) => { match target.bindings.type_def { Some(ref type_def) => { @@ -2870,6 +2905,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::". + */ + fn resolve_module_prefix(module_: @Module, + module_path: @DVec) + -> ModulePrefixResult { + 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; + } + } + i += 1; + } else { + break; + } + } + + // 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); + let resolve_result = self.resolve_name_in_module(containing_module, + name, + TypeNS, + Xray, + allow_globs); + match resolve_result { + Success(target) => { + match target.bindings.type_def { + Some(ref type_def) => { + match (*type_def).module_def { + None => { + error!("!!! (resolving crate-relative \ + module) module wasn't actually a \ + module!"); + return ModulePrefixResult { + result: Failed, + prefix_len: i + 1 + }; + } + Some(module_def) => { + return ModulePrefixResult { + result: Success(module_def), + prefix_len: i + 1 + }; + } + } + } + None => { + error!("!!! (resolving crate-relative module) module + wasn't actually a module!"); + return ModulePrefixResult { + result: Failed, + prefix_len: i + 1 + }; + } + } + } + Indeterminate => { + debug!("(resolving crate-relative module) indeterminate; \ + bailing"); + return ModulePrefixResult { + result: Indeterminate, + prefix_len: i + 1 + }; + } + Failed => { + debug!("(resolving crate-relative module) failed to resolve"); + return ModulePrefixResult { + result: Failed, + prefix_len: i + 1 + }; + } + } + } + fn name_is_exported(module_: @Module, name: ident) -> bool { return !module_.legacy_exports || module_.exported_names.size() == 0 || @@ -2884,7 +3015,8 @@ impl Resolver { fn resolve_name_in_module(module_: @Module, name: ident, namespace: Namespace, - xray: XrayFlag) + xray: XrayFlag, + allow_globs: bool) -> ResolveResult { debug!("(resolving name in module) resolving `%s` in `%s`", @@ -2910,10 +3042,10 @@ impl Resolver { } } - // Next, check the module's imports. If the module has a glob, then - // we bail out; we don't know its imports yet. - - if module_.glob_count > 0 { + // Next, check the module's imports. If the module has a glob and + // globs were not allowed, then we bail out; we don't know its imports + // yet. + if !allow_globs && module_.glob_count > 0 { debug!("(resolving name in module) module has glob; bailing out"); return Indeterminate; } @@ -4627,10 +4759,10 @@ impl Resolver { let mut containing_module; match self.resolve_module_path_for_import(self.current_module, - module_path_idents, - xray, - path.span) { - + module_path_idents, + xray, + UseLexicalScope, + path.span) { Failed => { self.session.span_err(path.span, fmt!("use of undeclared module `%s`", diff --git a/src/librustc/middle/trans/alt.rs b/src/librustc/middle/trans/alt.rs index 5d5b5783556..7885a8ea0b6 100644 --- a/src/librustc/middle/trans/alt.rs +++ b/src/librustc/middle/trans/alt.rs @@ -142,26 +142,27 @@ * */ +use back::abi; use lib::llvm::llvm; use lib::llvm::{ValueRef, BasicBlockRef}; -use pat_util::*; -use build::*; -use base::*; -use syntax::ast; -use syntax::ast_util; -use syntax::ast_util::{dummy_sp, path_to_ident}; +use middle::pat_util::*; +use middle::resolve::DefMap; +use middle::trans::base::*; +use middle::trans::build::*; +use middle::trans::common::*; +use middle::trans::datum::*; +use middle::trans::expr::Dest; +use middle::ty::{CopyValue, MoveValue, ReadValue}; +use util::common::indenter; + +use core::dvec::DVec; +use std::map::HashMap; use syntax::ast::def_id; +use syntax::ast; +use syntax::ast_util::{dummy_sp, path_to_ident}; +use syntax::ast_util; use syntax::codemap::span; use syntax::print::pprust::pat_to_str; -use middle::resolve::DefMap; -use middle::ty::{CopyValue, MoveValue, ReadValue}; -use back::abi; -use std::map::HashMap; -use dvec::DVec; -use datum::*; -use common::*; -use expr::Dest; -use util::common::indenter; fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export. diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index cf6207dee58..a65f6668cd3 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -23,45 +23,44 @@ // but many TypeRefs correspond to one ty::t; for instance, tup(int, int, // int) and rec(x=int, y=int, z=int) will have the same TypeRef. -use libc::{c_uint, c_ulonglong}; -use std::{map, time, list}; -use std::map::HashMap; -use driver::session; -use session::Session; -use syntax::attr; +use back::link::{mangle_exported_name}; +use back::link::{mangle_internal_name_by_path_and_seq}; +use back::link::{mangle_internal_name_by_path}; +use back::link::{mangle_internal_name_by_seq}; +use back::link::{mangle_internal_name_by_type_only}; use back::{link, abi, upcall}; -use syntax::{ast, ast_util, codemap, ast_map}; -use ast_util::{def_id_of_def, local_def, path_to_ident}; -use syntax::visit; -use syntax::codemap::span; -use syntax::print::pprust::{expr_to_str, stmt_to_str, path_to_str}; -use pat_util::*; -use visit::vt; -use util::common::is_main_name; -use lib::llvm::{llvm, mk_target_data, mk_type_names}; +use driver::session; +use driver::session::Session; use lib::llvm::{ModuleRef, ValueRef, TypeRef, BasicBlockRef}; use lib::llvm::{True, False}; -use link::{mangle_internal_name_by_type_only, - mangle_internal_name_by_seq, - mangle_internal_name_by_path, - mangle_internal_name_by_path_and_seq, - mangle_exported_name}; -use metadata::{csearch, cstore, decoder, encoder}; +use lib::llvm::{llvm, mk_target_data, mk_type_names}; use metadata::common::link_meta; -use util::ppaux; -use util::ppaux::{ty_to_str, ty_to_short_str}; -use syntax::diagnostic::expect; +use metadata::{csearch, cstore, decoder, encoder}; +use middle::pat_util::*; +use middle::trans::build::*; +use middle::trans::common::*; +use middle::trans::shape::*; +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 build::*; -use shape::*; -use type_of::*; -use common::*; -use syntax::ast_map::{path, path_mod, path_name}; -use syntax::parse::token::special_idents; - +use core::libc::{c_uint, c_ulonglong}; +use core::option::{is_none, is_some}; +use std::map::HashMap; use std::smallintmap; -use option::{is_none, is_some}; +use std::{map, time, list}; +use syntax::ast_map::{path, path_mod, path_name}; +use syntax::ast_util::{def_id_of_def, local_def, path_to_ident}; +use syntax::attr; +use syntax::codemap::span; +use syntax::diagnostic::expect; +use syntax::parse::token::special_idents; +use syntax::print::pprust::{expr_to_str, stmt_to_str, path_to_str}; +use syntax::visit; +use syntax::visit::vt; +use syntax::{ast, ast_util, codemap, ast_map}; struct icx_popper { ccx: @crate_ctxt, @@ -1228,7 +1227,7 @@ fn with_scope_datumblock(bcx: block, opt_node_info: Option, name: ~str, f: fn(block) -> datum::DatumBlock) -> datum::DatumBlock { - use datum::DatumBlock; + use middle::trans::datum::DatumBlock; let _icx = bcx.insn_ctxt("with_scope_result"); let scope_cx = scope_block(bcx, opt_node_info, name); diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs index acb7fac19f8..614a02a9700 100644 --- a/src/librustc/middle/trans/build.rs +++ b/src/librustc/middle/trans/build.rs @@ -8,15 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::map::HashMap; -use libc::{c_uint, c_int}; -use lib::llvm::llvm; -use syntax::codemap; use codemap::span; +use lib::llvm::llvm; +use lib::llvm::{CallConv, TypeKind, AtomicBinOp, AtomicOrdering}; +use lib::llvm::{Opcode, IntPredicate, RealPredicate, True, False}; use lib::llvm::{ValueRef, TypeRef, BasicBlockRef, BuilderRef, ModuleRef}; -use lib::llvm::{Opcode, IntPredicate, RealPredicate, True, False, - CallConv, TypeKind, AtomicBinOp, AtomicOrdering}; -use common::*; +use libc::{c_uint, c_int}; +use middle::trans::common::*; + +use std::map::HashMap; +use syntax::codemap; fn B(cx: block) -> BuilderRef { let b = cx.fcx.ccx.builder.B; diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs index 50bf0cf39c8..7117ae6910c 100644 --- a/src/librustc/middle/trans/callee.rs +++ b/src/librustc/middle/trans/callee.rs @@ -17,16 +17,17 @@ // closure. use lib::llvm::ValueRef; -use syntax::ast; -use datum::Datum; -use common::{block, node_id_type_params}; -use build::*; -use base::{get_item_val, trans_external_path}; -use syntax::visit; -use syntax::print::pprust::{expr_to_str, stmt_to_str, path_to_str}; -use datum::*; +use middle::trans::base::{get_item_val, trans_external_path}; +use middle::trans::build::*; +use middle::trans::common::{block, node_id_type_params}; +use middle::trans::datum::*; +use middle::trans::datum::Datum; use util::common::indenter; +use syntax::ast; +use syntax::print::pprust::{expr_to_str, stmt_to_str, path_to_str}; +use syntax::visit; + // Represents a (possibly monomorphized) top-level fn item or method // item. Note that this is just the fn-ptr and is not a Rust closure // value (which is a pair). diff --git a/src/librustc/middle/trans/closure.rs b/src/librustc/middle/trans/closure.rs index 2796cca6838..5110bc261f7 100644 --- a/src/librustc/middle/trans/closure.rs +++ b/src/librustc/middle/trans/closure.rs @@ -8,26 +8,25 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use libc::c_uint; -use syntax::ast; -use syntax::ast_util; +use back::abi; +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 common::*; -use build::*; -use base::*; -use type_of::*; -use back::abi; +use middle::trans::base::*; +use middle::trans::build::*; +use middle::trans::common::*; +use middle::trans::datum::{Datum, INIT, ByRef, ByValue, FromLvalue}; +use middle::trans::type_of::*; +use util::ppaux::ty_to_str; + +use core::libc::c_uint; +use std::map::HashMap; +use syntax::ast; +use syntax::ast_map::{path, path_mod, path_name}; +use syntax::ast_util; use syntax::codemap::span; use syntax::print::pprust::expr_to_str; -use back::link::{ - mangle_internal_name_by_path, - mangle_internal_name_by_path_and_seq}; -use util::ppaux::ty_to_str; -use syntax::ast_map::{path, path_mod, path_name}; -use driver::session::session; -use std::map::HashMap; -use datum::{Datum, INIT, ByRef, ByValue, FromLvalue}; // ___Good to know (tm)__________________________________________________ // diff --git a/src/librustc/middle/trans/consts.rs b/src/librustc/middle/trans/consts.rs index d1b5ece9b0c..355e7801480 100644 --- a/src/librustc/middle/trans/consts.rs +++ b/src/librustc/middle/trans/consts.rs @@ -8,9 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use common::*; +use middle::trans::base::get_insn_ctxt; +use middle::trans::common::*; + use syntax::{ast, ast_util, codemap, ast_map}; -use base::get_insn_ctxt; fn const_lit(cx: @crate_ctxt, e: @ast::expr, lit: ast::lit) -> ValueRef { diff --git a/src/librustc/middle/trans/controlflow.rs b/src/librustc/middle/trans/controlflow.rs index e7d3c8a207c..2a9cece231b 100644 --- a/src/librustc/middle/trans/controlflow.rs +++ b/src/librustc/middle/trans/controlflow.rs @@ -9,9 +9,9 @@ // except according to those terms. use lib::llvm::ValueRef; -use common::*; -use datum::*; -use base::*; +use middle::trans::base::*; +use middle::trans::common::*; +use middle::trans::datum::*; fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export. diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs index 5fc6a9ed0ba..e303b3611c5 100644 --- a/src/librustc/middle/trans/datum.rs +++ b/src/librustc/middle/trans/datum.rs @@ -96,11 +96,11 @@ * values. */ use lib::llvm::ValueRef; -use base::*; -use common::*; -use build::*; -use util::ppaux::ty_to_str; +use middle::trans::base::*; +use middle::trans::build::*; +use middle::trans::common::*; use util::common::indenter; +use util::ppaux::ty_to_str; enum CopyAction { INIT, diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index e201493ca2b..b255b47bab3 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -8,21 +8,22 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::map; -use std::map::HashMap; -use lib::llvm::llvm; +use driver::session; use lib::llvm::ValueRef; -use trans::common::*; -use trans::base; -use trans::build::B; +use lib::llvm::llvm; +use middle::pat_util::*; +use middle::trans::base; +use middle::trans::build::B; +use middle::trans::common::*; use middle::ty; -use syntax::{ast, codemap, ast_util, ast_map}; -use syntax::parse::token::ident_interner; -use codemap::{span, CharPos}; -use ast::Ty; -use pat_util::*; use util::ppaux::ty_to_str; -use driver::session::session; + +use std::map::HashMap; +use std::map; +use syntax::ast::Ty; +use syntax::codemap::{span, CharPos}; +use syntax::parse::token::ident_interner; +use syntax::{ast, codemap, ast_util, ast_map}; export create_local_var; export create_function; diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index 59a1206bd0d..764ddabd143 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -111,17 +111,18 @@ lvalues are *never* stored by value. */ -use ty::struct_mutable_fields; use lib::llvm::ValueRef; -use common::*; -use datum::*; -use base::*; -use syntax::print::pprust::{expr_to_str}; -use util::ppaux::ty_to_str; -use util::common::indenter; -use ty::{AutoPtr, AutoBorrowVec, AutoBorrowVecRef, AutoBorrowFn}; -use callee::{AutorefArg, DoAutorefArg, DontAutorefArg}; +use middle::trans::base::*; +use middle::trans::callee::{AutorefArg, DoAutorefArg, DontAutorefArg}; +use middle::trans::common::*; +use middle::trans::datum::*; use middle::ty::MoveValue; +use middle::ty::struct_mutable_fields; +use middle::ty::{AutoPtr, AutoBorrowVec, AutoBorrowVecRef, AutoBorrowFn}; +use util::common::indenter; +use util::ppaux::ty_to_str; + +use syntax::print::pprust::{expr_to_str}; // The primary two functions for translating expressions: export trans_to_datum, trans_into; diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs index bef7d01e819..38c3a4f7cb3 100644 --- a/src/librustc/middle/trans/foreign.rs +++ b/src/librustc/middle/trans/foreign.rs @@ -11,26 +11,27 @@ // The classification code for the x86_64 ABI is taken from the clay language // https://github.com/jckarter/clay/blob/master/compiler/src/externals.cpp -use driver::session::arch_x86_64; -use syntax::codemap::span; -use libc::c_uint; -use syntax::{attr, ast_map}; -use lib::llvm::{ llvm, TypeRef, ValueRef, Integer, Pointer, Float, Double, - Struct, Array, ModuleRef, CallConv, Attribute, - StructRetAttribute, ByValAttribute, - SequentiallyConsistent, Acquire, Release, Xchg }; -use syntax::{ast, ast_util}; use back::{link, abi}; -use common::*; -use build::*; -use base::*; -use type_of::*; -use std::map::HashMap; +use driver::session::arch_x86_64; +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 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::type_of::*; +use middle::ty::{FnTyBase, FnMeta, FnSig}; use util::ppaux::ty_to_str; -use datum::*; -use callee::*; -use expr::{Dest, Ignore}; -use ty::{FnTyBase, FnMeta, FnSig}; + +use core::libc::c_uint; +use std::map::HashMap; +use syntax::codemap::span; +use syntax::{ast, ast_util}; +use syntax::{attr, ast_map}; export link_name, trans_foreign_mod, register_foreign_fn, trans_foreign_fn, trans_intrinsic; diff --git a/src/librustc/middle/trans/glue.rs b/src/librustc/middle/trans/glue.rs index 647ed2275b5..a42dee615e4 100644 --- a/src/librustc/middle/trans/glue.rs +++ b/src/librustc/middle/trans/glue.rs @@ -13,10 +13,10 @@ // Code relating to taking, dropping, etc as well as type descriptors. use lib::llvm::{ValueRef, TypeRef}; -use base::*; -use common::*; -use build::*; -use type_of::type_of; +use middle::trans::base::*; +use middle::trans::common::*; +use middle::trans::build::*; +use middle::trans::type_of::type_of; 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 f65ac092275..6f5aa792c47 100644 --- a/src/librustc/middle/trans/inline.rs +++ b/src/librustc/middle/trans/inline.rs @@ -8,12 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use common::*; +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 syntax::ast; -use syntax::ast_util::local_def; use syntax::ast_map::{path, path_mod, path_name}; -use base::{trans_item, get_item_val, self_arg, trans_fn, impl_owned_self, - impl_self, no_self, get_insn_ctxt}; +use syntax::ast_util::local_def; // `translate` will be true if this function is allowed to translate the // item and false otherwise. Currently, this parameter is set to false when diff --git a/src/librustc/middle/trans/meth.rs b/src/librustc/middle/trans/meth.rs index d2142085604..0488ed1e5b3 100644 --- a/src/librustc/middle/trans/meth.rs +++ b/src/librustc/middle/trans/meth.rs @@ -8,25 +8,25 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use libc::c_uint; -use base::*; -use common::*; -use type_of::*; -use build::*; -use driver::session::{session, expect}; -use syntax::{ast, ast_map}; -use ast_map::{path, path_mod, path_name, node_id_to_str}; -use syntax::ast_util::local_def; -use metadata::csearch; use back::{link, abi}; +use lib::llvm::llvm::LLVMGetParam; use lib::llvm::llvm; use lib::llvm::{ValueRef, TypeRef}; -use lib::llvm::llvm::LLVMGetParam; -use std::map::HashMap; +use metadata::csearch; +use middle::trans::base::*; +use middle::trans::build::*; +use middle::trans::callee::*; +use middle::trans::common::*; +use middle::trans::expr::{SaveIn, Ignore}; +use middle::trans::type_of::*; use util::ppaux::{ty_to_str, tys_to_str}; -use callee::*; + +use core::libc::c_uint; +use std::map::HashMap; +use syntax::ast_map::{path, path_mod, path_name, node_id_to_str}; +use syntax::ast_util::local_def; use syntax::print::pprust::expr_to_str; -use expr::{SaveIn, Ignore}; +use syntax::{ast, ast_map}; fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export. diff --git a/src/librustc/middle/trans/monomorphize.rs b/src/librustc/middle/trans/monomorphize.rs index c5a93ecd89d..9d662f87551 100644 --- a/src/librustc/middle/trans/monomorphize.rs +++ b/src/librustc/middle/trans/monomorphize.rs @@ -8,20 +8,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use common::*; -use syntax::ast; -use syntax::ast_util::local_def; -use syntax::ast_map::{path, path_mod, path_name}; -use base::{trans_item, get_item_val, no_self, self_arg, trans_fn, - impl_self, decl_internal_cdecl_fn, - set_inline_hint_if_appr, set_inline_hint, - trans_enum_variant, trans_struct_dtor, - get_insn_ctxt}; -use syntax::parse::token::special_idents; -use type_of::type_of_fn_from_ty; use back::link::mangle_exported_name; +use middle::trans::base::{get_insn_ctxt}; +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::common::*; +use middle::trans::type_of::type_of_fn_from_ty; use middle::ty::{FnTyBase, FnMeta, FnSig}; +use syntax::ast; +use syntax::ast_map::{path, path_mod, path_name}; +use syntax::ast_util::local_def; +use syntax::parse::token::special_idents; + fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id, real_substs: ~[ty::t], diff --git a/src/librustc/middle/trans/reflect.rs b/src/librustc/middle/trans/reflect.rs index bc85a57a64b..d15a9c101b9 100644 --- a/src/librustc/middle/trans/reflect.rs +++ b/src/librustc/middle/trans/reflect.rs @@ -8,19 +8,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::map::HashMap; -use lib::llvm::{TypeRef, ValueRef}; -use syntax::ast; use back::abi; -use common::*; -use build::*; -use base::*; -use type_of::*; -use ast::def_id; +use lib::llvm::{TypeRef, ValueRef}; +use middle::trans::base::*; +use middle::trans::build::*; +use middle::trans::callee::{ArgVals, DontAutorefArg}; +use middle::trans::common::*; +use middle::trans::datum::*; +use middle::trans::expr::SaveIn; +use middle::trans::type_of::*; use util::ppaux::ty_to_str; -use datum::*; -use callee::{ArgVals, DontAutorefArg}; -use expr::SaveIn; + +use std::map::HashMap; +use syntax::ast::def_id; +use syntax::ast; enum reflector = { visitor_val: ValueRef, diff --git a/src/librustc/middle/trans/shape.rs b/src/librustc/middle/trans/shape.rs index a95e25d625f..51c3cb9362f 100644 --- a/src/librustc/middle/trans/shape.rs +++ b/src/librustc/middle/trans/shape.rs @@ -11,25 +11,23 @@ // A "shape" is a compact encoding of a type that is used by interpreted glue. // This substitutes for the runtime tags used by e.g. MLs. +use back::abi; use lib::llvm::llvm; use lib::llvm::{True, False, ModuleRef, TypeRef, ValueRef}; -use driver::session; -use driver::session::session; -use trans::base; +use middle::trans::base; use middle::trans::common::*; use middle::trans::machine::*; -use back::abi; -use middle::ty; use middle::ty::field; +use middle::ty; +use util::ppaux::ty_to_str; + +use core::dvec::DVec; +use core::option::is_some; +use std::map::HashMap; use syntax::ast; use syntax::ast_util::dummy_sp; -use syntax::util::interner; -use util::ppaux::ty_to_str; use syntax::codemap::span; -use dvec::DVec; - -use std::map::HashMap; -use option::is_some; +use syntax::util::interner; use ty_ctxt = middle::ty::ctxt; diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs index 0504ce6d569..2eaf15818d8 100644 --- a/src/librustc/middle/trans/tvec.rs +++ b/src/librustc/middle/trans/tvec.rs @@ -8,18 +8,19 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use syntax::ast; -use lib::llvm::{ValueRef, TypeRef}; use back::abi; -use syntax::codemap::span; -use shape::llsize_of; -use build::*; -use common::*; -use util::ppaux::ty_to_str; -use expr::{Dest, SaveIn, Ignore}; -use datum::*; -use syntax::print::pprust::{expr_to_str}; +use lib::llvm::{ValueRef, TypeRef}; +use middle::trans::build::*; +use middle::trans::common::*; +use middle::trans::datum::*; +use middle::trans::expr::{Dest, Ignore, SaveIn}; +use middle::trans::shape::llsize_of; use util::common::indenter; +use util::ppaux::ty_to_str; + +use syntax::ast; +use syntax::codemap::span; +use syntax::print::pprust::{expr_to_str}; // Boxed vector types are in some sense currently a "shorthand" for a box // containing an unboxed vector. This expands a boxed vector type into such an diff --git a/src/librustc/middle/trans/type_of.rs b/src/librustc/middle/trans/type_of.rs index 086407c8186..f146d556a9d 100644 --- a/src/librustc/middle/trans/type_of.rs +++ b/src/librustc/middle/trans/type_of.rs @@ -8,12 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use common::*; -use lib::llvm::{TypeRef}; -use syntax::ast; use lib::llvm::llvm; -use driver::session::session; +use lib::llvm::{TypeRef}; +use middle::trans::common::*; + use std::map::HashMap; +use syntax::ast; export type_of; export type_of_dtor; diff --git a/src/librustc/middle/trans/type_use.rs b/src/librustc/middle/trans/type_use.rs index 33200a2dd82..2f9a97aa2d8 100644 --- a/src/librustc/middle/trans/type_use.rs +++ b/src/librustc/middle/trans/type_use.rs @@ -27,13 +27,16 @@ // much information, but have the disadvantage of being very // invasive.) -use std::map::HashMap; -use std::list; -use std::list::{List, Cons, Nil}; use metadata::csearch; -use syntax::ast::*, syntax::ast_util, syntax::visit; +use middle::trans::common::*; + +use std::list::{List, Cons, Nil}; +use std::list; +use std::map::HashMap; +use syntax::ast::*; use syntax::ast_map; -use common::*; +use syntax::ast_util; +use syntax::visit; type type_uses = uint; // Bitmask const use_repr: uint = 1u; /* Dependency on size/alignment/mode and diff --git a/src/librustc/middle/trans/uniq.rs b/src/librustc/middle/trans/uniq.rs index 6a1fe50776d..30d47d60e58 100644 --- a/src/librustc/middle/trans/uniq.rs +++ b/src/librustc/middle/trans/uniq.rs @@ -8,12 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use syntax::ast; use lib::llvm::ValueRef; -use common::*; -use build::*; -use base::*; -use datum::immediate_rvalue; +use middle::trans::base::*; +use middle::trans::build::*; +use middle::trans::common::*; +use middle::trans::datum::immediate_rvalue; + +use syntax::ast; export make_free_glue, autoderef, duplicate; diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index f037bffb483..37958f84d59 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -52,12 +52,13 @@ * an rptr (`&r.T`) use the region `r` that appears in the rptr. */ -use check::fn_ctxt; -use rscope::{anon_rscope, binding_rscope, empty_rscope, in_anon_rscope}; -use rscope::{in_binding_rscope, region_scope, type_rscope}; -use ty::{FnTyBase, FnMeta, FnSig}; +use middle::ty::{FnTyBase, FnMeta, FnSig}; +use middle::typeck::check::fn_ctxt; +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}; -trait ast_conv { +pub trait ast_conv { fn tcx() -> ty::ctxt; fn ccx() -> @crate_ctxt; fn get_item_ty(id: ast::def_id) -> ty::ty_param_bounds_and_ty; @@ -141,7 +142,7 @@ fn ast_path_to_substs_and_ty( {substs: substs, ty: ty::subst(tcx, &substs, decl_ty)} } -fn ast_path_to_ty( +pub fn ast_path_to_ty( self: AC, rscope: RS, did: ast::def_id, diff --git a/src/librustc/middle/typeck/check/alt.rs b/src/librustc/middle/typeck/check/alt.rs index ec39c659cf5..9432ca186f9 100644 --- a/src/librustc/middle/typeck/check/alt.rs +++ b/src/librustc/middle/typeck/check/alt.rs @@ -8,9 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use middle::pat_util::{pat_is_binding, pat_is_const}; +use middle::pat_util::{pat_is_variant_or_struct}; + +use syntax::ast_util::walk_pat; use syntax::print::pprust; -use syntax::ast_util::{walk_pat}; -use pat_util::{pat_is_binding, pat_is_const, pat_is_variant_or_struct}; fn check_alt(fcx: @fn_ctxt, expr: @ast::expr, diff --git a/src/librustc/middle/typeck/check/demand.rs b/src/librustc/middle/typeck/check/demand.rs index a7e1da6ed7d..89726e22283 100644 --- a/src/librustc/middle/typeck/check/demand.rs +++ b/src/librustc/middle/typeck/check/demand.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use check::fn_ctxt; +use middle::typeck::check::fn_ctxt; // Requires that the two types unify, and prints an error message if they // don't. @@ -18,10 +18,10 @@ fn suptype(fcx: @fn_ctxt, sp: span, |sp, e, a, s| { fcx.report_mismatched_types(sp, e, a, s) }) } -fn suptype_with_fn(fcx: @fn_ctxt, sp: span, - expected: ty::t, actual: ty::t, +fn suptype_with_fn(fcx: @fn_ctxt, + sp: span, + expected: ty::t, actual: ty::t, handle_err: fn(span, ty::t, ty::t, &ty::type_err)) { - // n.b.: order of actual, expected is reversed match infer::mk_subty(fcx.infcx(), false, sp, actual, expected) { @@ -32,9 +32,7 @@ fn suptype_with_fn(fcx: @fn_ctxt, sp: span, } } -fn eqtype(fcx: @fn_ctxt, sp: span, - expected: ty::t, actual: ty::t) { - +fn eqtype(fcx: @fn_ctxt, sp: span, expected: ty::t, actual: ty::t) { match infer::mk_eqty(fcx.infcx(), false, sp, actual, expected) { Ok(()) => { /* ok */ } Err(ref err) => { diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index 2b1078e7dd4..8dfcb8c7bd9 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -79,16 +79,18 @@ obtained the type `Foo`, we would never match this method. */ -use coherence::get_base_type_def_id; use middle::resolve::{Impl, MethodInfo}; use middle::ty::*; -use syntax::ast::{def_id, sty_by_ref, sty_value, sty_region, sty_box, - sty_uniq, sty_static, node_id, by_copy, by_ref, - m_const, m_mutbl, m_imm}; +use middle::typeck::check; +use middle::typeck::coherence::get_base_type_def_id; + +use core::dvec::DVec; +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_map; use syntax::ast_map::node_id_to_str; use syntax::ast_util::dummy_sp; -use dvec::DVec; fn lookup( fcx: @fn_ctxt, diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 7611f62609f..ace51539727 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -76,35 +76,51 @@ type parameter). */ -use astconv::{ast_conv, ast_path_to_ty, ast_ty_to_ty}; -use astconv::{ast_region_to_region}; use middle::ty::{TyVid, vid, FnTyBase, FnMeta, FnSig, VariantInfo_}; -use regionmanip::{replace_bound_regions_in_fn_ty}; -use rscope::{anon_rscope, binding_rscope, empty_rscope, in_anon_rscope}; -use rscope::{in_binding_rscope, region_scope, type_rscope, - bound_self_region}; -use syntax::ast::ty_i; -use typeck::infer::{resolve_type, force_tvar}; -use result::{Result, Ok, Err}; -use syntax::print::pprust; -use syntax::parse::token::special_idents; -use syntax::ast_util::{is_local, visibility_to_privacy, Private, Public}; -use vtable::{LocationInfo, VtableContext}; +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::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::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 util::ppaux; +use core::result::{Result, Ok, Err}; use std::map::HashMap; +use syntax::ast::ty_i; +use syntax::ast_util::{is_local, visibility_to_privacy, Private, Public}; +use syntax::parse::token::special_idents; +use syntax::print::pprust; + +export alt; +export vtable; +export writeback; +export regionmanip; +export regionck; +export demand; +export method; +export fn_ctxt; +export lookup_local; +export impl_self_ty; +export DerefArgs; +export DontDerefArgs; +export DoDerefArgs; +export check_item_types; #[legacy_exports] -mod alt; +pub mod alt; #[legacy_exports] -mod vtable; +pub mod vtable; #[legacy_exports] -mod writeback; +pub mod writeback; #[legacy_exports] -mod regionmanip; +pub mod regionmanip; #[legacy_exports] -mod regionck; +pub mod regionck; #[legacy_exports] -mod demand; +pub mod demand; #[legacy_exports] pub mod method; @@ -135,7 +151,7 @@ struct inherited { enum FnKind { ForLoop, DoBlock, Vanilla } -struct fn_ctxt { +pub struct fn_ctxt { // var_bindings, locals and next_var_id are shared // with any nested functions that capture the environment // (and with any functions whose environment is being captured). @@ -252,9 +268,9 @@ fn check_fn(ccx: @crate_ctxt, let ret_ty = fn_ty.sig.output; debug!("check_fn(arg_tys=%?, ret_ty=%?, self_info.self_ty=%?)", - arg_tys.map(|a| ty_to_str(tcx, *a)), - ty_to_str(tcx, ret_ty), - option::map(&self_info, |s| ty_to_str(tcx, s.self_ty))); + arg_tys.map(|a| ppaux::ty_to_str(tcx, *a)), + ppaux::ty_to_str(tcx, ret_ty), + option::map(&self_info, |s| ppaux::ty_to_str(tcx, s.self_ty))); // ______________________________________________________________________ // Create the function context. This is either derived from scratch or, @@ -631,7 +647,7 @@ impl @fn_ctxt { #[inline(always)] fn write_ty(node_id: ast::node_id, ty: ty::t) { debug!("write_ty(%d, %s) in fcx %s", - node_id, ty_to_str(self.tcx(), ty), self.tag()); + node_id, ppaux::ty_to_str(self.tcx(), ty), self.tag()); self.inh.node_types.insert(node_id, ty); } @@ -793,12 +809,13 @@ impl @fn_ctxt { self.tcx().sess.span_err(sp, fmt!("A for-loop body must \ return (), but it returns %s here. \ Perhaps you meant to write a `do`-block?", - ty_to_str(self.tcx(), a))), + ppaux::ty_to_str(self.tcx(), a))), DoBlock if ty::type_is_bool(e) && ty::type_is_nil(a) => // If we expected bool and got ()... self.tcx().sess.span_err(sp, fmt!("Do-block body must \ return %s, but returns () here. Perhaps you meant \ - to write a `for`-loop?", ty_to_str(self.tcx(), e))), + to write a `for`-loop?", + ppaux::ty_to_str(self.tcx(), e))), _ => self.infcx().report_mismatched_types(sp, e, a, err) } } @@ -921,10 +938,11 @@ fn check_expr(fcx: @fn_ctxt, expr: @ast::expr, // declared on the impl declaration e.g., `impl for ~[(A,B)]` // would return ($0, $1) where $0 and $1 are freshly instantiated type // variables. -fn impl_self_ty(vcx: &VtableContext, - location_info: &LocationInfo, // (potential) receiver for - // this impl - did: ast::def_id) -> ty_param_substs_and_ty { +pub fn impl_self_ty(vcx: &VtableContext, + location_info: &LocationInfo, // (potential) receiver for + // this impl + did: ast::def_id) + -> ty_param_substs_and_ty { let tcx = vcx.tcx(); let {n_tps, region_param, raw_ty} = if did.crate == ast::local_crate { @@ -1540,7 +1558,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, // (1) verify that the class id actually has a field called // field - debug!("class named %s", ty_to_str(tcx, base_t)); + debug!("class named %s", ppaux::ty_to_str(tcx, base_t)); let cls_items = ty::lookup_struct_fields(tcx, base_id); match lookup_field_ty(tcx, base_id, cls_items, field, &(*substs)) { @@ -2400,9 +2418,9 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, debug!("type of expr %s is %s, expected is %s", syntax::print::pprust::expr_to_str(expr, tcx.sess.intr()), - ty_to_str(tcx, fcx.expr_ty(expr)), + ppaux::ty_to_str(tcx, fcx.expr_ty(expr)), match expected { - Some(t) => ty_to_str(tcx, t), + Some(t) => ppaux::ty_to_str(tcx, t), _ => ~"empty" }); @@ -2565,7 +2583,7 @@ fn check_instantiable(tcx: ty::ctxt, tcx.sess.span_err(sp, fmt!("this type cannot be instantiated \ without an instance of itself; \ consider using `option<%s>`", - ty_to_str(tcx, item_ty))); + ppaux::ty_to_str(tcx, item_ty))); } } @@ -2678,7 +2696,7 @@ fn check_enum_variants(ccx: @crate_ctxt, check_instantiable(ccx.tcx, sp, id); } -fn lookup_local(fcx: @fn_ctxt, sp: span, id: ast::node_id) -> TyVid { +pub fn lookup_local(fcx: @fn_ctxt, sp: span, id: ast::node_id) -> TyVid { match fcx.inh.locals.find(id) { Some(x) => x, _ => { @@ -2893,7 +2911,7 @@ fn check_bounds_are_used(ccx: @crate_ctxt, tps: ~[ast::ty_param], ty: ty::t) { debug!("check_bounds_are_used(n_tps=%u, ty=%s)", - tps.len(), ty_to_str(ccx.tcx, ty)); + tps.len(), ppaux::ty_to_str(ccx.tcx, ty)); // make a vector of booleans initially false, set to true when used if tps.len() == 0u { return; } @@ -3158,6 +3176,6 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::foreign_item) { tcx, None, false, it.span, i_ty.ty, fty, || fmt!("intrinsic has wrong type: \ expected `%s`", - ty_to_str(ccx.tcx, fty))); + ppaux::ty_to_str(ccx.tcx, fty))); } } diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs index 0f4511218ec..e58add83c09 100644 --- a/src/librustc/middle/typeck/check/regionck.rs +++ b/src/librustc/middle/typeck/check/regionck.rs @@ -27,18 +27,18 @@ this point a bit better. */ -use util::ppaux; -use ppaux::{note_and_explain_region, ty_to_str}; -use syntax::print::pprust; -use infer::{resolve_and_force_all_but_regions, fres}; -use syntax::ast::{def_arg, def_binding, def_local, def_self, def_upvar}; -use syntax::ast::{ProtoBare, ProtoBox, ProtoUniq, ProtoBorrowed}; use middle::freevars::get_freevars; use middle::kind::check_owned; 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::typeck::infer::{resolve_and_force_all_but_regions, fres}; +use util::ppaux::{note_and_explain_region, ty_to_str}; + +use syntax::ast::{ProtoBare, ProtoBox, ProtoUniq, ProtoBorrowed}; +use syntax::ast::{def_arg, def_binding, def_local, def_self, def_upvar}; +use syntax::print::pprust; 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 8431c175eff..0bcb032d825 100644 --- a/src/librustc/middle/typeck/check/regionmanip.rs +++ b/src/librustc/middle/typeck/check/regionmanip.rs @@ -11,6 +11,8 @@ // #[warn(deprecated_mode)]; // #[warn(deprecated_pattern)]; +use util::ppaux; + use syntax::print::pprust::{expr_to_str}; // Helper functions related to manipulating region types. @@ -47,9 +49,9 @@ fn replace_bound_regions_in_fn_ty( debug!("replace_bound_regions_in_fn_ty(self_info.self_ty=%?, fn_ty=%s, \ all_tys=%?)", - self_ty.map(|t| ty_to_str(tcx, *t)), - ty_to_str(tcx, ty::mk_fn(tcx, *fn_ty)), - all_tys.map(|t| ty_to_str(tcx, *t))); + self_ty.map(|t| ppaux::ty_to_str(tcx, *t)), + ppaux::ty_to_str(tcx, ty::mk_fn(tcx, *fn_ty)), + all_tys.map(|t| ppaux::ty_to_str(tcx, *t))); let _i = indenter(); let isr = do create_bound_region_mapping(tcx, isr, all_tys) |br| { @@ -64,8 +66,8 @@ fn replace_bound_regions_in_fn_ty( debug!("result of replace_bound_regions_in_fn_ty: self_info.self_ty=%?, \ fn_ty=%s", - t_self.map(|t| ty_to_str(tcx, *t)), - ty_to_str(tcx, t_fn)); + t_self.map(|t| ppaux::ty_to_str(tcx, *t)), + ppaux::ty_to_str(tcx, t_fn)); // Glue updated self_ty back together with its original def_id. diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs index 0494f1563cf..5751a462760 100644 --- a/src/librustc/middle/typeck/check/vtable.rs +++ b/src/librustc/middle/typeck/check/vtable.rs @@ -8,13 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use check::{fn_ctxt, impl_self_ty}; -use infer::{infer_ctxt, resolve_type, resolve_and_force_all_but_regions, - fixup_err_to_str}; +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 util::common::indenter; +use util::ppaux; + +use result::{Result, Ok, Err}; use syntax::codemap::span; use syntax::print::pprust; -use result::{Result, Ok, Err}; -use util::common::indenter; // vtable resolution looks for places where trait bounds are // subsituted in and figures out which vtable is used. There is some @@ -81,14 +83,14 @@ fn lookup_vtables(vcx: &VtableContext, tcx, bounds[i]) |trait_ty| { debug!("about to subst: %?, %?", - ty_to_str(tcx, trait_ty), + ppaux::ty_to_str(tcx, trait_ty), ty::substs_to_str(tcx, substs)); let new_substs = {self_ty: Some(*ty), ..*substs}; let trait_ty = ty::subst(tcx, &new_substs, trait_ty); debug!("after subst: %?", - ty_to_str(tcx, trait_ty)); + ppaux::ty_to_str(tcx, trait_ty)); match lookup_vtable(vcx, location_info, *ty, trait_ty, allow_unsafe, is_early) { @@ -98,8 +100,8 @@ fn lookup_vtables(vcx: &VtableContext, location_info.span, fmt!("failed to find an implementation of \ trait %s for %s", - ty_to_str(vcx.tcx(), trait_ty), - ty_to_str(vcx.tcx(), *ty))); + ppaux::ty_to_str(vcx.tcx(), trait_ty), + ppaux::ty_to_str(vcx.tcx(), *ty))); } } } @@ -664,8 +666,8 @@ fn early_resolve_expr(ex: @ast::expr, &&fcx: @fn_ctxt, is_early: bool) { ex.span, fmt!("failed to find an implementation of trait \ %s for %s", - ty_to_str(fcx.tcx(), target_ty), - ty_to_str(fcx.tcx(), ty))); + ppaux::ty_to_str(fcx.tcx(), target_ty), + ppaux::ty_to_str(fcx.tcx(), ty))); } } Some(vtable) => { diff --git a/src/librustc/middle/typeck/check/writeback.rs b/src/librustc/middle/typeck/check/writeback.rs index 12d8f06a3f6..dd3f240f343 100644 --- a/src/librustc/middle/typeck/check/writeback.rs +++ b/src/librustc/middle/typeck/check/writeback.rs @@ -12,11 +12,15 @@ // unresolved type variables and replaces "ty_var" types with their // substitutions. -use check::{fn_ctxt, lookup_local}; -use infer::{resolve_type, resolve_region, resolve_all, force_all}; +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 util::ppaux; + +use result::{Result, Ok, Err}; + export resolve_type_vars_in_fn; export resolve_type_vars_in_expr; -use result::{Result, Ok, Err}; fn resolve_type_vars_in_type(fcx: @fn_ctxt, sp: span, typ: ty::t) -> Option @@ -97,7 +101,7 @@ fn resolve_type_vars_for_node(wbcx: wb_ctxt, sp: span, id: ast::node_id) Some(t) => { debug!("resolve_type_vars_for_node(id=%d, n_ty=%s, t=%s)", - id, ty_to_str(tcx, n_ty), ty_to_str(tcx, t)); + id, ppaux::ty_to_str(tcx, n_ty), ppaux::ty_to_str(tcx, t)); write_ty_to_tcx(tcx, id, t); match fcx.opt_node_ty_substs(id) { Some(ref substs) => { diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs index 3e5986f5236..3ab3ac387f9 100644 --- a/src/librustc/middle/typeck/coherence.rs +++ b/src/librustc/middle/typeck/coherence.rs @@ -43,11 +43,11 @@ use syntax::visit::{mk_simple_visitor, mk_vt, visit_crate, visit_item}; use syntax::visit::{visit_mod}; use util::ppaux::ty_to_str; -use dvec::DVec; -use result::Ok; +use core::dvec::DVec; +use core::result::Ok; use std::map::HashMap; -use uint::range; -use vec::{len, push}; +use core::uint::range; +use core::vec::{len, push}; fn get_base_type(inference_context: infer_ctxt, span: span, original_type: t) -> Option { diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 5614c3aac80..8e8d7380f8f 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -30,14 +30,16 @@ are represented as `ty_param()` instances. */ -use astconv::{ast_conv, ty_of_fn_decl, ty_of_arg, ast_ty_to_ty}; -use ast_util::trait_method_to_ty_method; -use middle::ty::{FnMeta, FnSig, FnTyBase}; -use rscope::*; -use ty::{FnTyBase, FnMeta, FnSig, InstantiatedTraitRef}; +use middle::ty::{FnMeta, FnSig, FnTyBase, InstantiatedTraitRef}; +use middle::typeck::astconv::{ast_conv, ty_of_fn_decl, ty_of_arg}; +use middle::typeck::astconv::{ast_ty_to_ty}; +use middle::typeck::rscope::*; use util::common::pluralize; +use util::ppaux; use util::ppaux::bound_to_str; +use syntax::ast_util::trait_method_to_ty_method; + fn collect_item_types(ccx: @crate_ctxt, crate: @ast::crate) { // FIXME (#2592): hooking into the "intrinsic" root module is crude. @@ -403,10 +405,10 @@ fn compare_impl_method(tcx: ty::ctxt, // - replace self region with a fresh, dummy region let impl_fty = { let impl_fty = ty::mk_fn(tcx, impl_m.fty); - debug!("impl_fty (pre-subst): %s", ty_to_str(tcx, impl_fty)); + debug!("impl_fty (pre-subst): %s", ppaux::ty_to_str(tcx, impl_fty)); replace_bound_self(tcx, impl_fty, dummy_self_r) }; - debug!("impl_fty: %s", ty_to_str(tcx, impl_fty)); + debug!("impl_fty: %s", ppaux::ty_to_str(tcx, impl_fty)); let trait_fty = { let dummy_tps = do vec::from_fn((*trait_m.tps).len()) |i| { // hack: we don't know the def id of the impl tp, but it @@ -421,7 +423,7 @@ fn compare_impl_method(tcx: ty::ctxt, tps: vec::append(trait_tps, dummy_tps) }; let trait_fty = ty::mk_fn(tcx, trait_m.fty); - debug!("trait_fty (pre-subst): %s", ty_to_str(tcx, trait_fty)); + debug!("trait_fty (pre-subst): %s", ppaux::ty_to_str(tcx, trait_fty)); ty::subst(tcx, &substs, trait_fty) }; @@ -574,7 +576,7 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) { ast::item_trait(tps, supertraits, ref trait_methods) => { let tpt = ty_of_item(ccx, it); debug!("item_trait(it.id=%d, tpt.ty=%s)", - it.id, ty_to_str(tcx, tpt.ty)); + it.id, ppaux::ty_to_str(tcx, tpt.ty)); write_ty_to_tcx(tcx, it.id, tpt.ty); ensure_trait_methods(ccx, it.id, tpt.ty); ensure_supertraits(ccx, it.id, it.span, rp, supertraits); @@ -774,7 +776,9 @@ fn ty_of_item(ccx: @crate_ctxt, it: @ast::item) region_param: None, ty: ty::mk_fn(ccx.tcx, tofd)}; debug!("type of %s (id %d) is %s", - tcx.sess.str_of(it.ident), it.id, ty_to_str(tcx, tpt.ty)); + tcx.sess.str_of(it.ident), + it.id, + ppaux::ty_to_str(tcx, tpt.ty)); ccx.tcx.tcache.insert(local_def(it.id), tpt); return tpt; } diff --git a/src/librustc/middle/typeck/infer/assignment.rs b/src/librustc/middle/typeck/infer/assignment.rs index 2ceff545eb7..1abe2156a1e 100644 --- a/src/librustc/middle/typeck/infer/assignment.rs +++ b/src/librustc/middle/typeck/infer/assignment.rs @@ -58,8 +58,8 @@ // A. But this upper-bound might be stricter than what is truly // needed. -use to_str::ToStr; -use combine::combine_fields; +use middle::typeck::infer::combine::combine_fields; +use middle::typeck::infer::to_str::ToStr; fn to_ares(+c: cres) -> ares { match c { diff --git a/src/librustc/middle/typeck/infer/combine.rs b/src/librustc/middle/typeck/infer/combine.rs index 1972be22b02..da66ecd922b 100644 --- a/src/librustc/middle/typeck/infer/combine.rs +++ b/src/librustc/middle/typeck/infer/combine.rs @@ -54,8 +54,9 @@ // terms of error reporting, although we do not do that properly right // now. -use to_str::ToStr; -use ty::{FnTyBase, FnMeta, FnSig}; +use middle::ty::{FnTyBase, FnMeta, FnSig}; +use middle::typeck::infer::to_str::ToStr; + use syntax::ast::Onceness; fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export. @@ -92,7 +93,7 @@ trait combine { a: ty::vstore, b: ty::vstore) -> cres; } -struct combine_fields { +pub struct combine_fields { infcx: infer_ctxt, a_is_expected: bool, span: span, @@ -108,7 +109,7 @@ fn expected_found( } } -fn eq_tys(self: &C, a: ty::t, b: ty::t) -> ures { +pub fn eq_tys(self: &C, a: ty::t, b: ty::t) -> ures { let suber = self.sub(); do self.infcx().try { do suber.tys(a, b).chain |_ok| { diff --git a/src/librustc/middle/typeck/infer/floating.rs b/src/librustc/middle/typeck/infer/floating.rs index 48b49c9c59c..9537325c097 100644 --- a/src/librustc/middle/typeck/infer/floating.rs +++ b/src/librustc/middle/typeck/infer/floating.rs @@ -14,8 +14,8 @@ Code related to floating-point type inference. */ -use to_str::ToStr; use middle::ty::ty_float; +use middle::typeck::infer::to_str::ToStr; // 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 4d00b5f7d3c..b6e179d27a9 100644 --- a/src/librustc/middle/typeck/infer/glb.rs +++ b/src/librustc/middle/typeck/infer/glb.rs @@ -8,9 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use combine::*; -use lattice::*; -use to_str::ToStr; +use middle::typeck::infer::combine::*; +use middle::typeck::infer::lattice::*; +use middle::typeck::infer::to_str::ToStr; + use syntax::ast::{Many, Once}; enum Glb = combine_fields; // "greatest lower bound" (common subtype) diff --git a/src/librustc/middle/typeck/infer/integral.rs b/src/librustc/middle/typeck/infer/integral.rs index 40f0bb1ac3e..f3e5e1ac73e 100644 --- a/src/librustc/middle/typeck/infer/integral.rs +++ b/src/librustc/middle/typeck/infer/integral.rs @@ -14,7 +14,7 @@ Code related to integral type inference. */ -use to_str::ToStr; +use middle::typeck::infer::to_str::ToStr; // 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 fba0c565004..b47dd206452 100644 --- a/src/librustc/middle/typeck/infer/lattice.rs +++ b/src/librustc/middle/typeck/infer/lattice.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use combine::*; -use unify::*; -use to_str::ToStr; +use middle::typeck::infer::combine::*; +use middle::typeck::infer::unify::*; +use middle::typeck::infer::to_str::ToStr; // ______________________________________________________________________ // Lattice operations on variables diff --git a/src/librustc/middle/typeck/infer/lub.rs b/src/librustc/middle/typeck/infer/lub.rs index 563435d4600..cfb93e93a65 100644 --- a/src/librustc/middle/typeck/infer/lub.rs +++ b/src/librustc/middle/typeck/infer/lub.rs @@ -8,9 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use combine::*; -use lattice::*; -use to_str::ToStr; +use middle::typeck::infer::combine::*; +use middle::typeck::infer::lattice::*; +use middle::typeck::infer::to_str::ToStr; + 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 0d0a1d761cc..fb8ca563291 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -259,40 +259,40 @@ section on "Type Combining" below for details. #[warn(deprecated_mode)]; #[warn(deprecated_pattern)]; -use std::smallintmap; -use std::smallintmap::smallintmap; -use std::map::HashMap; +use middle::ty::{TyVid, IntVid, FloatVid, RegionVid, vid}; +use middle::ty::{mk_fn, type_is_bot}; +use middle::ty::{ty_int, ty_uint, get, terr_fn, TyVar, IntVar, FloatVar}; use middle::ty; -use middle::ty::{TyVid, IntVid, FloatVid, RegionVid, vid, - ty_int, ty_uint, get, terr_fn, TyVar, IntVar, FloatVar}; -use syntax::{ast, ast_util}; -use syntax::ast::{ret_style, purity}; -use util::ppaux::{ty_to_str, mt_to_str}; -use result::{Result, Ok, Err, map_vec, map_vec2, iter_vec2}; -use ty::{mk_fn, type_is_bot}; -use check::regionmanip::{replace_bound_regions_in_fn_ty}; +use middle::typeck::check::regionmanip::{replace_bound_regions_in_fn_ty}; +use middle::typeck::infer::assignment::Assign; +use middle::typeck::infer::combine::{combine_fields, eq_tys}; +use middle::typeck::infer::floating::{float_ty_set, float_ty_set_all}; +use middle::typeck::infer::glb::Glb; +use middle::typeck::infer::integral::{int_ty_set, int_ty_set_all}; +use middle::typeck::infer::lub::Lub; +use middle::typeck::infer::region_inference::{RegionVarBindings}; +use middle::typeck::infer::resolve::{force_all, not_regions}; +use middle::typeck::infer::resolve::{force_tvar, force_rvar, force_ivar}; +use middle::typeck::infer::resolve::{resolve_and_force_all_but_regions}; +use middle::typeck::infer::resolve::{resolve_ivar, resolve_all}; +use middle::typeck::infer::resolve::{resolve_nested_tvar, resolve_rvar}; +use middle::typeck::infer::resolve::{resolver}; +use middle::typeck::infer::sub::Sub; +use middle::typeck::infer::to_str::ToStr; +use middle::typeck::infer::unify::{vals_and_bindings, root}; use util::common::{indent, indenter}; -use ast::{unsafe_fn, impure_fn, pure_fn, extern_fn}; -use ast::{m_const, m_imm, m_mutbl}; -use dvec::DVec; -use region_inference::{RegionVarBindings}; -use ast_util::dummy_sp; -use cmp::Eq; +use util::ppaux::{ty_to_str, mt_to_str}; -// From submodules: -use resolve::{resolve_nested_tvar, resolve_rvar, resolve_ivar, resolve_all, - force_tvar, force_rvar, force_ivar, force_all, not_regions, - resolve_and_force_all_but_regions, resolver}; -use unify::{vals_and_bindings, root}; -use integral::{int_ty_set, int_ty_set_all}; -use floating::{float_ty_set, float_ty_set_all}; -use combine::{combine_fields, eq_tys}; -use assignment::Assign; -use to_str::ToStr; - -use sub::Sub; -use lub::Lub; -use glb::Glb; +use core::cmp::Eq; +use core::dvec::DVec; +use core::result::{Result, Ok, Err, map_vec, map_vec2, iter_vec2}; +use std::map::HashMap; +use std::smallintmap; +use syntax::ast::{ret_style, purity}; +use syntax::ast::{m_const, m_imm, m_mutbl}; +use syntax::ast::{unsafe_fn, impure_fn, pure_fn, extern_fn}; +use syntax::ast_util::dummy_sp; +use syntax::{ast, ast_util}; export infer_ctxt; export new_infer_ctxt; @@ -311,6 +311,18 @@ export cres, fres, fixup_err, fixup_err_to_str; export assignment; export root, to_str; export int_ty_set_all; +export assignment; +export combine; +export floating; +export glb; +export integral; +export lattice; +export lub; +export region_inference; +export resolve; +export sub; +export to_str; +export unify; #[legacy_exports] mod assignment; diff --git a/src/librustc/middle/typeck/infer/region_inference.rs b/src/librustc/middle/typeck/infer/region_inference.rs index f49d1740018..99d636559db 100644 --- a/src/librustc/middle/typeck/infer/region_inference.rs +++ b/src/librustc/middle/typeck/infer/region_inference.rs @@ -453,20 +453,20 @@ write it) #[warn(deprecated_mode)]; #[warn(deprecated_pattern)]; -use dvec::DVec; +use middle::region::is_subregion_of; +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::dvec::DVec; use result::Result; use result::{Ok, Err}; use std::map::HashMap; use std::cell::{Cell, empty_cell}; use std::list::{List, Nil, Cons}; -use region::is_subregion_of; -use ty::{Region, RegionVid, re_static, re_infer, re_free, re_bound, - re_scope, ReVar, ReSkolemized}; -use syntax::codemap; -use to_str::ToStr; -use util::ppaux::note_and_explain_region; - export RegionVarBindings; export make_subregion; export lub_regions; diff --git a/src/librustc/middle/typeck/infer/resolve.rs b/src/librustc/middle/typeck/infer/resolve.rs index 437d5ade6bd..91689ff06dd 100644 --- a/src/librustc/middle/typeck/infer/resolve.rs +++ b/src/librustc/middle/typeck/infer/resolve.rs @@ -46,9 +46,9 @@ // future). If you want to resolve everything but one type, you are // probably better off writing `resolve_all - resolve_ivar`. -use integral::*; -use floating::*; -use to_str::ToStr; +use middle::typeck::infer::floating::*; +use middle::typeck::infer::integral::*; +use middle::typeck::infer::to_str::ToStr; const resolve_nested_tvar: uint = 0b00000001; const resolve_rvar: uint = 0b00000010; diff --git a/src/librustc/middle/typeck/infer/sub.rs b/src/librustc/middle/typeck/infer/sub.rs index b7769ac876d..1cec971f156 100644 --- a/src/librustc/middle/typeck/infer/sub.rs +++ b/src/librustc/middle/typeck/infer/sub.rs @@ -8,9 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use combine::*; -use unify::*; -use to_str::ToStr; +use middle::typeck::infer::combine::*; +use middle::typeck::infer::to_str::ToStr; +use middle::typeck::infer::unify::*; + use std::list; fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export. diff --git a/src/librustc/middle/typeck/infer/to_str.rs b/src/librustc/middle/typeck/infer/to_str.rs index a882f20c04b..166907ba7a8 100644 --- a/src/librustc/middle/typeck/infer/to_str.rs +++ b/src/librustc/middle/typeck/infer/to_str.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use integral::{int_ty_set}; -use floating::{float_ty_set}; -use unify::{var_value, redirect, root}; +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}; trait ToStr { fn to_str(cx: infer_ctxt) -> ~str; diff --git a/src/librustc/middle/typeck/infer/unify.rs b/src/librustc/middle/typeck/infer/unify.rs index 452e950dba6..2ec356a6dc8 100644 --- a/src/librustc/middle/typeck/infer/unify.rs +++ b/src/librustc/middle/typeck/infer/unify.rs @@ -8,10 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use combine::combine; -use integral::*; -use floating::*; -use to_str::ToStr; +use middle::typeck::infer::combine::combine; +use middle::typeck::infer::floating::*; +use middle::typeck::infer::integral::*; +use middle::typeck::infer::to_str::ToStr; + use std::smallintmap::SmallIntMap; enum var_value { diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs index e128f6a03fb..aaf53e01738 100644 --- a/src/librustc/middle/typeck/mod.rs +++ b/src/librustc/middle/typeck/mod.rs @@ -50,31 +50,31 @@ independently: #[legacy_exports]; -use result::Result; -use syntax::{ast, ast_util, ast_map}; -use ast::spanned; -use ast::{required, provided}; -use syntax::ast_map::node_id_to_str; -use syntax::ast_util::{local_def, respan, split_trait_methods, - has_legacy_export_attr}; -use syntax::visit; use metadata::csearch; -use util::common::{block_query, loop_query}; -use syntax::codemap::span; -use pat_util::{pat_id_map, PatIdMap}; -use middle::ty; +use middle::pat_util::{pat_id_map, PatIdMap}; 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 std::smallintmap; -use std::map; -use std::map::HashMap; -use syntax::print::pprust::*; -use util::ppaux::{ty_to_str, tys_to_str, region_to_str, - bound_region_to_str, vstore_to_str, expr_repr}; -use util::common::{indent, indenter}; +use middle::ty; +use util::common::{block_query, indent, indenter, loop_query}; +use util::ppaux::{bound_region_to_str, vstore_to_str, expr_repr}; +use util::ppaux::{ty_to_str, tys_to_str, region_to_str}; +use util::ppaux; + +use core::dvec::DVec; +use core::result::Result; +use std::list::{List, Nil, Cons}; use std::list; -use list::{List, Nil, Cons}; -use dvec::DVec; +use std::map::HashMap; +use std::map; +use std::smallintmap; +use syntax::ast::{provided, required, spanned}; +use syntax::ast_map::node_id_to_str; +use syntax::ast_util::{has_legacy_export_attr}; +use syntax::ast_util::{local_def, respan, split_trait_methods}; +use syntax::codemap::span; +use syntax::print::pprust::*; +use syntax::visit; +use syntax::{ast, ast_util, ast_map}; export check; export check_crate; @@ -89,24 +89,31 @@ export method_static, method_param, method_trait, method_self; export vtable_static, vtable_param, vtable_trait; export provided_methods_map; export coherence; +export check; +export rscope; +export astconv; +export infer; +export collect; +export coherence; +export deriving; #[legacy_exports] #[path = "check/mod.rs"] pub mod check; #[legacy_exports] -mod rscope; +pub mod rscope; #[legacy_exports] -mod astconv; +pub mod astconv; #[path = "infer/mod.rs"] -mod infer; +pub mod infer; #[legacy_exports] -mod collect; +pub mod collect; #[legacy_exports] -mod coherence; +pub mod coherence; #[auto_serialize] #[auto_deserialize] -enum method_origin { +pub enum method_origin { // fully statically resolved method method_static(ast::def_id), @@ -139,7 +146,7 @@ type method_param = { bound_num: uint }; -type method_map_entry = { +pub type method_map_entry = { // the type and mode of the self parameter, which is not reflected // in the fn type (FIXME #3446) self_arg: ty::arg, @@ -153,12 +160,12 @@ type method_map_entry = { // maps from an expression id that corresponds to a method call to the details // of the method to be invoked -type method_map = HashMap; +pub type method_map = HashMap; // Resolutions for bounds of all parameters, left to right, for a given path. -type vtable_res = @~[vtable_origin]; +pub type vtable_res = @~[vtable_origin]; -enum vtable_origin { +pub enum vtable_origin { /* Statically known vtable. def_id gives the class or impl item from whence comes the vtable, and tys are the type substs. @@ -198,7 +205,7 @@ impl vtable_origin { vtable_trait(def_id, ref tys) => { fmt!("vtable_trait(%?:%s, %?)", def_id, ty::item_path_str(tcx, def_id), - tys.map(|t| ty_to_str(tcx, *t))) + tys.map(|t| ppaux::ty_to_str(tcx, *t))) } } } @@ -220,7 +227,7 @@ enum crate_ctxt { // Functions that write types into the node type table fn write_ty_to_tcx(tcx: ty::ctxt, node_id: ast::node_id, ty: ty::t) { - debug!("write_ty_to_tcx(%d, %s)", node_id, ty_to_str(tcx, ty)); + debug!("write_ty_to_tcx(%d, %s)", node_id, ppaux::ty_to_str(tcx, ty)); smallintmap::insert(*tcx.node_types, node_id as uint, ty); } fn write_substs_to_tcx(tcx: ty::ctxt, @@ -228,7 +235,7 @@ fn write_substs_to_tcx(tcx: ty::ctxt, +substs: ~[ty::t]) { if substs.len() > 0u { debug!("write_substs_to_tcx(%d, %?)", node_id, - substs.map(|t| ty_to_str(tcx, *t))); + substs.map(|t| ppaux::ty_to_str(tcx, *t))); tcx.node_type_substs.insert(node_id, substs); } } @@ -356,13 +363,13 @@ fn check_main_fn_ty(ccx: @crate_ctxt, main_span, fmt!("Wrong type in main function: found `%s`, \ expected `fn() -> ()`", - ty_to_str(tcx, main_t))); + ppaux::ty_to_str(tcx, main_t))); } } _ => { tcx.sess.span_bug(main_span, ~"main has a non-function type: found `" + - ty_to_str(tcx, main_t) + ~"`"); + ppaux::ty_to_str(tcx, main_t) + ~"`"); } } } diff --git a/src/librustc/middle/typeck/rscope.rs b/src/librustc/middle/typeck/rscope.rs index 5ae52252dc2..cbbb417eae6 100644 --- a/src/librustc/middle/typeck/rscope.rs +++ b/src/librustc/middle/typeck/rscope.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use result::Result; +use core::result::Result; use syntax::parse::token::special_idents; trait region_scope { diff --git a/src/librustc/rustc.rc b/src/librustc/rustc.rc index 584f165b75d..45aa78be026 100644 --- a/src/librustc/rustc.rc +++ b/src/librustc/rustc.rc @@ -145,7 +145,7 @@ mod middle { #[path = "middle/lint.rs"] mod lint; #[path = "middle/borrowck/mod.rs"] - mod borrowck; + pub mod borrowck; #[legacy_exports] #[path = "middle/mem_categorization.rs"] mod mem_categorization; diff --git a/src/librustdoc/astsrv.rs b/src/librustdoc/astsrv.rs index a11943fbf4b..a0685c4b3ac 100644 --- a/src/librustdoc/astsrv.rs +++ b/src/librustdoc/astsrv.rs @@ -17,19 +17,19 @@ query AST-related information, shielding the rest of Rustdoc from its non-sendableness. */ -use std::map::HashMap; -use rustc::driver::session; -use session::{basic_options, options}; -use session::Session; -use rustc::driver::driver; -use syntax::diagnostic; -use syntax::diagnostic::handler; -use syntax::ast; -use syntax::codemap; -use syntax::ast_map; use rustc::back::link; -use rustc::metadata::filesearch; +use rustc::driver::driver; +use rustc::driver::session::Session; +use rustc::driver::session::{basic_options, options}; +use rustc::driver::session; use rustc::front; +use rustc::metadata::filesearch; +use std::map::HashMap; +use syntax::ast; +use syntax::ast_map; +use syntax::codemap; +use syntax::diagnostic::handler; +use syntax::diagnostic; pub type Ctxt = { ast: @ast::crate, diff --git a/src/librustdoc/parse.rs b/src/librustdoc/parse.rs index 7351f2f7b30..db97f34f201 100644 --- a/src/librustdoc/parse.rs +++ b/src/librustdoc/parse.rs @@ -10,12 +10,12 @@ //! AST-parsing helpers +use rustc::driver::driver::{file_input, str_input}; use rustc::driver::driver; -use driver::{file_input, str_input}; use rustc::driver::session; -use syntax::diagnostic; use syntax::ast; use syntax::codemap; +use syntax::diagnostic; use syntax::parse; pub fn from_file(file: &Path) -> @ast::crate { diff --git a/src/librusti/rusti.rc b/src/librusti/rusti.rc index 9393168905a..a2e1167eaa8 100644 --- a/src/librusti/rusti.rc +++ b/src/librusti/rusti.rc @@ -28,7 +28,7 @@ extern mod rustc(vers = "0.5"); extern mod syntax(vers = "0.5"); use core::*; -use io::{ReaderUtil, WriterUtil}; +use core::io::{ReaderUtil, WriterUtil}; use rustc::back; use rustc::driver::{driver, session}; use rustc::front; @@ -38,8 +38,8 @@ use rustc::middle::{freevars, kind, lint, trans, ty, typeck}; use rustc::middle; use syntax::{ast, ast_util, codemap, diagnostic, fold, parse, print, visit}; use syntax::ast_util::*; -use parse::token; -use print::{pp, pprust}; +use syntax::parse::token; +use syntax::print::{pp, pprust}; use std::rl; /** diff --git a/src/libstd/serialization.rs b/src/libstd/serialization.rs index d41aa1227ce..8a3e6213325 100644 --- a/src/libstd/serialization.rs +++ b/src/libstd/serialization.rs @@ -582,4 +582,4 @@ pub impl D: DeserializerHelpers { } } -pub use traits::*; +pub use serialization::traits::*; diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index a53c03d6d2c..c9754ad9980 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -12,9 +12,8 @@ #[forbid(deprecated_mode)]; -use uv = uv; use uv::iotask; -use iotask::IoTask; +use uv::iotask::IoTask; use comm = core::comm; /** diff --git a/src/libstd/uv_global_loop.rs b/src/libstd/uv_global_loop.rs index be503216edb..58b9a8d3d94 100644 --- a/src/libstd/uv_global_loop.rs +++ b/src/libstd/uv_global_loop.rs @@ -15,10 +15,10 @@ use ll = uv_ll; use iotask = uv_iotask; use get_gl = get; -use iotask::{IoTask, spawn_iotask}; +use uv_iotask::{IoTask, spawn_iotask}; use private::{chan_from_global_ptr, weaken_task}; use comm = core::comm; -use comm::{Port, Chan, select2, listen}; +use core::comm::{Port, Chan, select2, listen}; use task::TaskBuilder; use either::{Left, Right}; diff --git a/src/libstd/uv_iotask.rs b/src/libstd/uv_iotask.rs index b718c84b65e..19f5997a57d 100644 --- a/src/libstd/uv_iotask.rs +++ b/src/libstd/uv_iotask.rs @@ -19,7 +19,7 @@ use libc::c_void; use ptr::addr_of; use comm = core::comm; -use comm::{Port, Chan, listen}; +use core::comm::{Port, Chan, listen}; use task::TaskBuilder; use ll = uv_ll; diff --git a/src/libsyntax/ext/auto_serialize.rs b/src/libsyntax/ext/auto_serialize.rs index 9830a5b1434..359414cff42 100644 --- a/src/libsyntax/ext/auto_serialize.rs +++ b/src/libsyntax/ext/auto_serialize.rs @@ -88,7 +88,7 @@ node twice. */ -use base::*; +use ext::base::*; use codemap::span; use std::map; use std::map::HashMap; diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 04a59d1fe41..0d40ede4dbc 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -9,7 +9,7 @@ // except according to those terms. use codemap::span; -use base::ext_ctxt; +use ext::base::ext_ctxt; fn mk_expr(cx: ext_ctxt, sp: codemap::span, expr: ast::expr_) -> @ast::expr { diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs index a47b64bea3a..d84d79082a4 100644 --- a/src/libsyntax/ext/concat_idents.rs +++ b/src/libsyntax/ext/concat_idents.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use 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 434c00e7487..f0eaf2115b8 100644 --- a/src/libsyntax/ext/deriving.rs +++ b/src/libsyntax/ext/deriving.rs @@ -18,7 +18,7 @@ use ast::{pat_ident, pat_wild, public, pure_fn, re_anon, stmt, struct_def}; 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 base::ext_ctxt; +use ext::base::ext_ctxt; use codemap::span; use parse::token::special_idents::clownshoes_extensions; diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs index 68db1b41781..b5c55437d70 100644 --- a/src/libsyntax/ext/env.rs +++ b/src/libsyntax/ext/env.rs @@ -14,8 +14,8 @@ * should all get sucked into either the compiler syntax extension plugin * interface. */ -use base::*; -use build::mk_uniq_str; +use ext::base::*; +use ext::build::mk_uniq_str; export expand_syntax_ext; fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: ~[ast::token_tree]) diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index 46003624a76..2b5f95c4066 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -16,7 +16,7 @@ * compiler syntax extension plugin interface. */ use extfmt::ct::*; -use base::*; +use ext::base::*; use codemap::span; use ext::build::*; export expand_syntax_ext; diff --git a/src/libsyntax/ext/log_syntax.rs b/src/libsyntax/ext/log_syntax.rs index 00462207b4b..47096182fe8 100644 --- a/src/libsyntax/ext/log_syntax.rs +++ b/src/libsyntax/ext/log_syntax.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use base::*; +use ext::base::*; use io::WriterUtil; fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, tt: ~[ast::token_tree]) diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index 2a7b09795ce..56f426e3853 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -17,7 +17,7 @@ use ast::{ident, node_id}; use ast_util::{ident_to_path, respan, dummy_sp}; use codemap::span; use ext::base::mk_ctxt; -use quote::rt::*; +use ext::quote::rt::*; // Transitional reexports so qquote can find the paths it is looking for mod syntax { diff --git a/src/libsyntax/ext/pipes/check.rs b/src/libsyntax/ext/pipes/check.rs index cd76655fef6..7193a00950e 100644 --- a/src/libsyntax/ext/pipes/check.rs +++ b/src/libsyntax/ext/pipes/check.rs @@ -31,7 +31,7 @@ that. use ext::base::ext_ctxt; -use proto::{state, protocol, next_state}; +use ext::pipes::proto::{state, protocol, next_state}; impl ext_ctxt: proto::visitor<(), (), ()> { fn visit_proto(_proto: protocol, diff --git a/src/libsyntax/ext/pipes/mod.rs b/src/libsyntax/ext/pipes/mod.rs index 7085ca40ed3..0a02bca88ca 100644 --- a/src/libsyntax/ext/pipes/mod.rs +++ b/src/libsyntax/ext/pipes/mod.rs @@ -49,9 +49,8 @@ use ast::tt_delim; use parse::lexer::{new_tt_reader, reader}; use parse::parser::Parser; -use pipes::parse_proto::proto_parser; - -use pipes::proto::{visit, protocol}; +use ext::pipes::parse_proto::proto_parser; +use ext::pipes::proto::{visit, protocol}; #[legacy_exports] mod ast_builder; diff --git a/src/libsyntax/ext/pipes/parse_proto.rs b/src/libsyntax/ext/pipes/parse_proto.rs index ffc063d2b77..0f6b9dbda28 100644 --- a/src/libsyntax/ext/pipes/parse_proto.rs +++ b/src/libsyntax/ext/pipes/parse_proto.rs @@ -13,7 +13,7 @@ use parse::parser; use parse::token; -use pipec::*; +use ext::pipes::pipec::*; trait proto_parser { fn parse_proto(id: ~str) -> protocol; diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index 5ce3898b3e8..c07170e5c36 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -19,16 +19,9 @@ use ast_util::dummy_sp; use util::interner; use ext::base::ext_ctxt; use parse::*; -use proto::*; -use quote::rt::*; -use ast_builder::{append_types, path}; - -// Transitional reexports so qquote can find the paths it is looking for -mod syntax { - #[legacy_exports]; - pub use ext; - pub use parse; -} +use ext::pipes::proto::*; +use ext::quote::rt::*; +use ext::pipes::ast_builder::{append_types, path}; trait gen_send { fn gen_send(cx: ext_ctxt, try: bool) -> @ast::item; diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs index af75c9e71dc..76757d027a5 100644 --- a/src/libsyntax/ext/pipes/proto.rs +++ b/src/libsyntax/ext/pipes/proto.rs @@ -11,7 +11,7 @@ use to_str::ToStr; use dvec::DVec; -use ast_builder::{path, append_types}; +use ext::pipes::ast_builder::{path, append_types}; enum direction { send, recv } diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 1e5d4ea8d16..c498c3407c2 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -13,7 +13,7 @@ use mod parse::token; use codemap::{span, BytePos}; use ext::base::ext_ctxt; -use token::*; +use parse::token::*; /** * @@ -34,7 +34,7 @@ pub mod rt { pub use codemap::span; use print::pprust; - use pprust::{item_to_str, ty_to_str}; + use print::pprust::{item_to_str, ty_to_str}; trait ToTokens { pub fn to_tokens(_cx: ext_ctxt) -> ~[token_tree]; diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 8d2b9163f15..099764a3278 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use base::*; +use ext::base::*; use codemap::{span, Loc, FileMap}; use print::pprust; -use build::{mk_base_vec_e,mk_uint,mk_u8,mk_uniq_str}; +use ext::build::{mk_base_vec_e, mk_uint, mk_u8, mk_uniq_str}; export expand_line; export expand_col; diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index f33c8b80204..e93f3d6e38b 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -8,15 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use base::{ext_ctxt, mac_result, mr_any, mr_def, normal_tt}; +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 macro_parser::{parse, parse_or_else, success, failure, named_match, - matched_seq, matched_nonterminal, error}; +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_util::dummy_sp; diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 19b5975c147..a68482ea46b 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -10,7 +10,7 @@ use diagnostic::span_handler; use ast::{token_tree, tt_delim, tt_tok, tt_seq, tt_nonterminal,ident}; -use macro_parser::{named_match, matched_seq, matched_nonterminal}; +use ext::tt::macro_parser::{named_match, matched_seq, matched_nonterminal}; use codemap::span; use parse::token::{EOF, INTERPOLATED, IDENT, Token, nt_ident, ident_interner}; use std::map::HashMap; diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index 7248a0e2244..a4bef47fdf2 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -10,7 +10,7 @@ use either::{Either, Left, Right}; use ast_util::spanned; -use common::*; //resolve bug? +use parse::common::*; //resolve bug? export parser_attr; diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index e5a52628627..22b40736748 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -8,11 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use io::println;//XXXXXXXXxxx use io::ReaderUtil; use util::interner; -use lexer::{string_reader, bump, is_eof, nextch, - is_whitespace, get_str_from, reader}; +use parse::lexer::{string_reader, bump, is_eof, nextch, + is_whitespace, get_str_from, reader}; use codemap::{FileMap, CharPos}; export cmnt; diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index a48e33c9405..246a8fa9c7c 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -10,8 +10,8 @@ use std::map::{HashMap}; use ast_util::spanned; -use parser::Parser; -use lexer::reader; +use parse::parser::Parser; +use parse::lexer::reader; type seq_sep = { sep: Option, diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 5a7b62f1ff6..803135f7599 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -20,6 +20,7 @@ export comments; export prec; export classify; export attr; +export obsolete; export parse_sess; export new_parse_sess, new_parse_sess_special_handler; @@ -35,14 +36,14 @@ export parse_stmt_from_source_str; export parse_tts_from_source_str; export parse_from_source_str; -use parser::Parser; -use attr::parser_attr; use ast::node_id; -use util::interner; -use diagnostic::{span_handler, mk_span_handler, mk_handler, emitter}; -use lexer::{reader, string_reader}; -use parse::token::{ident_interner, mk_ident_interner}; 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] diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index aa52575ef45..3db635f3b43 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -20,7 +20,7 @@ removed. use codemap::span; use ast::{expr, expr_lit, lit_nil}; use ast_util::{respan}; -use token::Token; +use parse::token::Token; /// The specific types of unsupported syntax pub enum ObsoleteSyntax { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 0f1c3467625..47f65ed2f8d 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -13,19 +13,19 @@ use print::pprust::expr_to_str; use result::Result; use either::{Either, Left, Right}; use std::map::HashMap; -use token::{can_begin_expr, is_ident, is_ident_or_path, is_plain_ident, - INTERPOLATED, special_idents}; +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_util::{spanned, respan, mk_sp, ident_to_path, operator_prec}; -use lexer::reader; -use prec::{as_prec, token_to_binop}; -use attr::parser_attr; -use common::{seq_sep_trailing_disallowed, seq_sep_trailing_allowed, - seq_sep_none, token_to_str}; +use parse::lexer::reader; +use parse::prec::{as_prec, token_to_binop}; +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 obsolete::{ +use parse::obsolete::{ ObsoleteSyntax, ObsoleteLowerCaseKindBounds, ObsoleteLet, ObsoleteFieldTerminator, ObsoleteStructCtor, diff --git a/src/libsyntax/parse/prec.rs b/src/libsyntax/parse/prec.rs index 8dada97e35d..4663b875bb5 100644 --- a/src/libsyntax/parse/prec.rs +++ b/src/libsyntax/parse/prec.rs @@ -12,8 +12,8 @@ export as_prec; export unop_prec; export token_to_binop; -use token::*; -use token::Token; +use parse::token::*; +use parse::token::Token; use ast::*; /// Unary operators have higher precedence than binary diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index fa384341fb9..e977327e919 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -10,8 +10,8 @@ use parse::{comments, lexer, token}; use codemap::{CodeMap, BytePos}; -use pp::{break_offset, word, printer, space, zerobreak, hardbreak, breaks}; -use pp::{consistent, inconsistent, eof}; +use print::pp::{break_offset, word, printer, space, zerobreak, hardbreak}; +use print::pp::{breaks, consistent, inconsistent, eof}; use ast::{required, provided}; use ast_util::{operator_prec}; use dvec::DVec; diff --git a/src/libsyntax/syntax.rc b/src/libsyntax/syntax.rc index fbc5f10fcd6..119e1e25fb7 100644 --- a/src/libsyntax/syntax.rc +++ b/src/libsyntax/syntax.rc @@ -31,6 +31,11 @@ extern mod std(vers = "0.5"); use core::*; +pub mod syntax { + pub use ext; + pub use parse; +} + #[legacy_exports] mod attr; #[legacy_exports] diff --git a/src/test/auxiliary/cci_capture_clause.rs b/src/test/auxiliary/cci_capture_clause.rs index 8c885f1b797..5e7424cf41e 100644 --- a/src/test/auxiliary/cci_capture_clause.rs +++ b/src/test/auxiliary/cci_capture_clause.rs @@ -12,7 +12,7 @@ export foo; -use comm::*; +use core::comm::*; fn foo(x: T) -> Port { let p = Port(); diff --git a/src/test/auxiliary/pub_use_mods_xcrate.rs b/src/test/auxiliary/pub_use_mods_xcrate.rs index efd42fb588c..162f7de4b1b 100644 --- a/src/test/auxiliary/pub_use_mods_xcrate.rs +++ b/src/test/auxiliary/pub_use_mods_xcrate.rs @@ -16,6 +16,6 @@ pub mod a { } } - pub use b::c; + pub use a::b::c; } diff --git a/src/test/compile-fail/super-at-top-level.rs b/src/test/compile-fail/super-at-top-level.rs new file mode 100644 index 00000000000..21b9e5292b1 --- /dev/null +++ b/src/test/compile-fail/super-at-top-level.rs @@ -0,0 +1,7 @@ +use super::f; //~ ERROR unresolved name +//~^ ERROR failed to resolve import + +fn main() { + +} + diff --git a/src/test/run-pass/alias-uninit-value.rs b/src/test/run-pass/alias-uninit-value.rs index 7dbaee44135..beb1a5fc6c2 100644 --- a/src/test/run-pass/alias-uninit-value.rs +++ b/src/test/run-pass/alias-uninit-value.rs @@ -11,8 +11,6 @@ // Regression test for issue #374 -extern mod std; -use option::None; enum sty { ty_nil, } diff --git a/src/test/run-pass/alt-pattern-drop.rs b/src/test/run-pass/alt-pattern-drop.rs index edc5c6bb977..c90bec114ed 100644 --- a/src/test/run-pass/alt-pattern-drop.rs +++ b/src/test/run-pass/alt-pattern-drop.rs @@ -11,12 +11,10 @@ // -*- rust -*- -use core::sys; - enum t { make_t(@int), clam, } fn foo(s: @int) { - let count = sys::refcount(s); + let count = core::sys::refcount(s); let x: t = make_t(s); // ref up match x { @@ -26,20 +24,20 @@ fn foo(s: @int) { } _ => { debug!("?"); fail; } } - log(debug, sys::refcount(s)); - assert (sys::refcount(s) == count + 1u); - let _ = sys::refcount(s); // don't get bitten by last-use. + log(debug, core::sys::refcount(s)); + assert (core::sys::refcount(s) == count + 1u); + let _ = core::sys::refcount(s); // don't get bitten by last-use. } fn main() { let s: @int = @0; // ref up - let count = sys::refcount(s); + let count = core::sys::refcount(s); foo(s); // ref up then down - log(debug, sys::refcount(s)); - let count2 = sys::refcount(s); - let _ = sys::refcount(s); // don't get bitten by last-use. + log(debug, core::sys::refcount(s)); + let count2 = core::sys::refcount(s); + let _ = core::sys::refcount(s); // don't get bitten by last-use. assert count == count2; } diff --git a/src/test/run-pass/auto-ref-bounded-ty-param.rs b/src/test/run-pass/auto-ref-bounded-ty-param.rs index 943896943fe..bd0e91f153e 100644 --- a/src/test/run-pass/auto-ref-bounded-ty-param.rs +++ b/src/test/run-pass/auto-ref-bounded-ty-param.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use to_str::ToStr; - trait Foo { fn f(&self); } @@ -37,4 +35,4 @@ impl Bar : Baz { fn main() { let y = Bar { x: 42 }; y.f(); -} \ No newline at end of file +} diff --git a/src/test/run-pass/auto_serialize.rs b/src/test/run-pass/auto_serialize.rs index fd9b30935cc..5472903f32b 100644 --- a/src/test/run-pass/auto_serialize.rs +++ b/src/test/run-pass/auto_serialize.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/basic-1.rs b/src/test/run-pass/basic-1.rs index 31ca6b7e1d1..834040e0e57 100644 --- a/src/test/run-pass/basic-1.rs +++ b/src/test/run-pass/basic-1.rs @@ -10,31 +10,25 @@ // except according to those terms. -extern mod std; -use comm::Chan; -use comm::Port; -use comm::send; -use comm::recv; - -fn a(c: Chan) { send(c, 10); } +fn a(c: core::comm::Chan) { core::comm::send(c, 10); } fn main() { - let p = Port(); - let ch = Chan(&p); + let p = core::comm::Port(); + let ch = core::comm::Chan(&p); task::spawn(|| a(ch) ); task::spawn(|| a(ch) ); let mut n: int = 0; - n = recv(p); - n = recv(p); + n = core::comm::recv(p); + n = core::comm::recv(p); // debug!("Finished."); } -fn b(c: Chan) { +fn b(c: core::comm::Chan) { // debug!("task b0"); // debug!("task b1"); // debug!("task b2"); // debug!("task b3"); // debug!("task b4"); // debug!("task b5"); - send(c, 10); + core::comm::send(c, 10); } diff --git a/src/test/run-pass/basic-2.rs b/src/test/run-pass/basic-2.rs index 6d2e096b8da..df8eb39da30 100644 --- a/src/test/run-pass/basic-2.rs +++ b/src/test/run-pass/basic-2.rs @@ -10,30 +10,28 @@ // except according to those terms. -extern mod std; -use comm::Port; -use comm::send; -use comm::Chan; -use comm::recv; - -fn a(c: Chan) { debug!("task a0"); debug!("task a1"); send(c, 10); } +fn a(c: core::comm::Chan) { + debug!("task a0"); + debug!("task a1"); + core::comm::send(c, 10); +} fn main() { - let p = Port(); - let ch = Chan(&p); + let p = core::comm::Port(); + let ch = core::comm::Chan(&p); task::spawn(|| a(ch) ); task::spawn(|| b(ch) ); let mut n: int = 0; - n = recv(p); - n = recv(p); + n = core::comm::recv(p); + n = core::comm::recv(p); debug!("Finished."); } -fn b(c: Chan) { +fn b(c: core::comm::Chan) { debug!("task b0"); debug!("task b1"); debug!("task b2"); debug!("task b2"); debug!("task b3"); - send(c, 10); + core::comm::send(c, 10); } diff --git a/src/test/run-pass/basic.rs b/src/test/run-pass/basic.rs index d58791f4bf1..bc7b194d7b4 100644 --- a/src/test/run-pass/basic.rs +++ b/src/test/run-pass/basic.rs @@ -10,12 +10,7 @@ // except according to those terms. -extern mod std; -use comm::send; -use comm::Chan; -use comm::recv; - -fn a(c: Chan) { +fn a(c: core::comm::Chan) { if true { debug!("task a"); debug!("task a"); @@ -23,7 +18,7 @@ fn a(c: Chan) { debug!("task a"); debug!("task a"); } - send(c, 10); + core::comm::send(c, 10); } fn k(x: int) -> int { return 15; } @@ -39,18 +34,18 @@ fn main() { let mut n: int = 2 + 3 * 7; let s: ~str = ~"hello there"; let p = comm::Port(); - let ch = comm::Chan(&p); + let ch = core::comm::Chan(&p); task::spawn(|| a(ch) ); task::spawn(|| b(ch) ); let mut x: int = 10; x = g(n, s); log(debug, x); - n = recv(p); - n = recv(p); + n = core::comm::recv(p); + n = core::comm::recv(p); debug!("children finished, root finishing"); } -fn b(c: Chan) { +fn b(c: core::comm::Chan) { if true { debug!("task b"); debug!("task b"); @@ -59,5 +54,5 @@ fn b(c: Chan) { debug!("task b"); debug!("task b"); } - send(c, 10); + core::comm::send(c, 10); } diff --git a/src/test/run-pass/bind-by-move.rs b/src/test/run-pass/bind-by-move.rs index 768551dddfc..9c2a16e3e37 100644 --- a/src/test/run-pass/bind-by-move.rs +++ b/src/test/run-pass/bind-by-move.rs @@ -9,6 +9,7 @@ // except according to those terms. // xfail-test +// xfail-fast extern mod std; use std::arc; fn dispose(+_x: arc::ARC) unsafe { } diff --git a/src/test/run-pass/binops.rs b/src/test/run-pass/binops.rs index a1cd6c0544e..72299e2b329 100644 --- a/src/test/run-pass/binops.rs +++ b/src/test/run-pass/binops.rs @@ -10,9 +10,6 @@ // Binop corner cases -extern mod std; -use cast::reinterpret_cast; - fn test_nil() { assert (() == ()); assert (!(() != ())); @@ -66,9 +63,9 @@ fn test_box() { } fn test_ptr() unsafe { - let p1: *u8 = cast::reinterpret_cast(&0); - let p2: *u8 = cast::reinterpret_cast(&0); - let p3: *u8 = cast::reinterpret_cast(&1); + let p1: *u8 = core::cast::reinterpret_cast(&0); + let p2: *u8 = core::cast::reinterpret_cast(&0); + let p3: *u8 = core::cast::reinterpret_cast(&1); assert p1 == p2; assert p1 != p3; @@ -113,8 +110,8 @@ fn test_class() { unsafe { error!("q = %x, r = %x", - (cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(&q))), - (cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(&r)))); + (core::cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(&q))), + (core::cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(&r)))); } assert(q == r); r.y = 17; diff --git a/src/test/run-pass/bitv-perf-test.rs b/src/test/run-pass/bitv-perf-test.rs index 0017d760402..ff0de7a4696 100644 --- a/src/test/run-pass/bitv-perf-test.rs +++ b/src/test/run-pass/bitv-perf-test.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/borrowck-borrow-from-expr-block.rs b/src/test/run-pass/borrowck-borrow-from-expr-block.rs index ef82884e690..93ab2ba2c41 100644 --- a/src/test/run-pass/borrowck-borrow-from-expr-block.rs +++ b/src/test/run-pass/borrowck-borrow-from-expr-block.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ptr::to_uint; - fn borrow(x: &int, f: fn(x: &int)) { f(x) } @@ -18,11 +16,11 @@ fn test1(x: @~int) { // Right now, at least, this induces a copy of the unique pointer: do borrow({*x}) |p| { let x_a = ptr::addr_of(&(**x)); - assert (x_a as uint) != to_uint(p); + assert (x_a as uint) != ptr::to_uint(p); assert unsafe{*x_a} == *p; } } fn main() { test1(@~22); -} \ No newline at end of file +} diff --git a/src/test/run-pass/call-closure-from-overloaded-op.rs b/src/test/run-pass/call-closure-from-overloaded-op.rs index 7bd17872602..3eaf273a578 100644 --- a/src/test/run-pass/call-closure-from-overloaded-op.rs +++ b/src/test/run-pass/call-closure-from-overloaded-op.rs @@ -8,12 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use dvec::DVec; - fn foo() -> int { 22 } fn main() { - let x = DVec::<@fn() -> int>(); + let x = dvec::DVec::<@fn() -> int>(); x.push(foo); assert (x[0])() == 22; -} \ No newline at end of file +} diff --git a/src/test/run-pass/capture_nil.rs b/src/test/run-pass/capture_nil.rs index 565c0430902..c82fc0bcd68 100644 --- a/src/test/run-pass/capture_nil.rs +++ b/src/test/run-pass/capture_nil.rs @@ -9,7 +9,6 @@ // except according to those terms. // compile-flags:-Z no-opt -use comm::*; // This test has to be setup just so to trigger // the condition which was causing us a crash. @@ -25,9 +24,9 @@ use comm::*; // course preferable, as the value itself is // irrelevant). -fn foo(&&x: ()) -> Port<()> { - let p = Port(); - let c = Chan(&p); +fn foo(&&x: ()) -> core::comm::Port<()> { + let p = core::comm::Port(); + let c = core::comm::Chan(&p); do task::spawn() |copy c, copy x| { c.send(x); } diff --git a/src/test/run-pass/chan-leak.rs b/src/test/run-pass/chan-leak.rs index c0cdc8ebfe0..b88799c4475 100644 --- a/src/test/run-pass/chan-leak.rs +++ b/src/test/run-pass/chan-leak.rs @@ -10,38 +10,32 @@ // Issue #763 -extern mod std; -use comm::Chan; -use comm::send; -use comm::Port; -use comm::recv; +enum request { quit, close(core::comm::Chan), } -enum request { quit, close(Chan), } +type ctx = core::comm::Chan; -type ctx = Chan; - -fn request_task(c: Chan) { - let p = Port(); - send(c, Chan(&p)); +fn request_task(c: core::comm::Chan) { + let p = core::comm::Port(); + core::comm::send(c, core::comm::Chan(&p)); let mut req: request; - req = recv(p); + req = core::comm::recv(p); // Need to drop req before receiving it again - req = recv(p); + req = core::comm::recv(p); } fn new_cx() -> ctx { - let p = Port(); - let ch = Chan(&p); + let p = core::comm::Port(); + let ch = core::comm::Chan(&p); let t = task::spawn(|| request_task(ch) ); let mut cx: ctx; - cx = recv(p); + cx = core::comm::recv(p); return cx; } fn main() { let cx = new_cx(); - let p = Port::(); - send(cx, close(Chan(&p))); - send(cx, quit); + let p = core::comm::Port::(); + core::comm::send(cx, close(core::comm::Chan(&p))); + core::comm::send(cx, quit); } diff --git a/src/test/run-pass/class-exports.rs b/src/test/run-pass/class-exports.rs index 72e10bd22f2..b3e85c51895 100644 --- a/src/test/run-pass/class-exports.rs +++ b/src/test/run-pass/class-exports.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/comm.rs b/src/test/run-pass/comm.rs index 7b0cf49ee22..cae462c4d5d 100644 --- a/src/test/run-pass/comm.rs +++ b/src/test/run-pass/comm.rs @@ -10,23 +10,18 @@ // except according to those terms. -extern mod std; -use comm::Chan; -use comm::send; -use comm::recv; - fn main() { let p = comm::Port(); - let ch = comm::Chan(&p); + let ch = core::comm::Chan(&p); let t = task::spawn(|| child(ch) ); - let y = recv(p); + let y = core::comm::recv(p); error!("received"); log(error, y); assert (y == 10); } -fn child(c: Chan) { +fn child(c: core::comm::Chan) { error!("sending"); - send(c, 10); + core::comm::send(c, 10); error!("value sent"); } diff --git a/src/test/run-pass/conditional-compile.rs b/src/test/run-pass/conditional-compile.rs index c41644585ef..5ddea605587 100644 --- a/src/test/run-pass/conditional-compile.rs +++ b/src/test/run-pass/conditional-compile.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/core-export-f64-sqrt.rs b/src/test/run-pass/core-export-f64-sqrt.rs index 9200610c4cf..a78ca37172b 100644 --- a/src/test/run-pass/core-export-f64-sqrt.rs +++ b/src/test/run-pass/core-export-f64-sqrt.rs @@ -10,11 +10,9 @@ // Regression test that f64 exports things properly -use io::println; - fn main() { let digits: uint = 10 as uint; - println(float::to_str(f64::sqrt(42.0f64) as float, digits)); -} \ No newline at end of file + core::io::println(float::to_str(f64::sqrt(42.0f64) as float, digits)); +} diff --git a/src/test/run-pass/decl-with-recv.rs b/src/test/run-pass/decl-with-recv.rs index cd745241450..4d1ad84225d 100644 --- a/src/test/run-pass/decl-with-recv.rs +++ b/src/test/run-pass/decl-with-recv.rs @@ -10,19 +10,13 @@ // except according to those terms. -extern mod std; -use comm::Port; -use comm::Chan; -use comm::send; -use comm::recv; - fn main() { - let po = Port(); - let ch = Chan(&po); - send(ch, 10); - let i = recv(po); + let po = core::comm::Port(); + let ch = core::comm::Chan(&po); + core::comm::send(ch, 10); + let i = core::comm::recv(po); assert (i == 10); - send(ch, 11); - let j = recv(po); + core::comm::send(ch, 11); + let j = core::comm::recv(po); assert (j == 11); } diff --git a/src/test/run-pass/dvec-test.rs b/src/test/run-pass/dvec-test.rs index c3c54312bfc..f569e9116e3 100644 --- a/src/test/run-pass/dvec-test.rs +++ b/src/test/run-pass/dvec-test.rs @@ -8,10 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use dvec::DVec; - fn main() { - let d = DVec(); + let d = dvec::DVec(); d.push(3); d.push(4); assert d.get() == ~[3, 4]; diff --git a/src/test/run-pass/export-glob-imports-target.rs b/src/test/run-pass/export-glob-imports-target.rs index 5c7c6636f67..5f547e09c89 100644 --- a/src/test/run-pass/export-glob-imports-target.rs +++ b/src/test/run-pass/export-glob-imports-target.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -15,7 +17,7 @@ mod foo { #[legacy_exports]; - use bar::*; + use foo::bar::*; mod bar { #[legacy_exports]; const a : int = 10; diff --git a/src/test/run-pass/export-glob.rs b/src/test/run-pass/export-glob.rs index 3d647072b5c..4c0287843fc 100644 --- a/src/test/run-pass/export-glob.rs +++ b/src/test/run-pass/export-glob.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -15,8 +17,9 @@ mod foo { #[legacy_exports]; - use bar::*; + use foo::bar::*; export a; + export bar; mod bar { #[legacy_exports]; const a : int = 10; diff --git a/src/test/run-pass/export-multi.rs b/src/test/run-pass/export-multi.rs index bd2d6d2fcab..c9d7fe4d6b9 100644 --- a/src/test/run-pass/export-multi.rs +++ b/src/test/run-pass/export-multi.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/extern-mod-syntax.rs b/src/test/run-pass/extern-mod-syntax.rs index 2abc0881370..badff7bdfd6 100644 --- a/src/test/run-pass/extern-mod-syntax.rs +++ b/src/test/run-pass/extern-mod-syntax.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/getopts_ref.rs b/src/test/run-pass/getopts_ref.rs index 8e59058f818..166625ce1a8 100644 --- a/src/test/run-pass/getopts_ref.rs +++ b/src/test/run-pass/getopts_ref.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/guards-not-exhaustive.rs b/src/test/run-pass/guards-not-exhaustive.rs index ab1aca4d761..66e48d1e7a9 100644 --- a/src/test/run-pass/guards-not-exhaustive.rs +++ b/src/test/run-pass/guards-not-exhaustive.rs @@ -1,5 +1,3 @@ -use option::*; - enum Q { R(Option) } fn xyzzy(q: Q) -> uint { @@ -12,4 +10,4 @@ fn xyzzy(q: Q) -> uint { fn main() { assert xyzzy(R(Some(5))) == 0; -} \ No newline at end of file +} diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index fb4a474f0c0..9a3b67e42dc 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -16,8 +18,6 @@ extern mod std; -use option::Some; -use option::None; use std::map; use std::map::HashMap; use comm::Chan; diff --git a/src/test/run-pass/import-from-foreign.rs b/src/test/run-pass/import-from-foreign.rs index 83c7d3d6f59..9106f4a5e75 100644 --- a/src/test/run-pass/import-from-foreign.rs +++ b/src/test/run-pass/import-from-foreign.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import-from.rs b/src/test/run-pass/import-from.rs index e334e4bed50..390ccf35e37 100644 --- a/src/test/run-pass/import-from.rs +++ b/src/test/run-pass/import-from.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import-glob-0.rs b/src/test/run-pass/import-glob-0.rs index cf4234358e8..5297ee61d20 100644 --- a/src/test/run-pass/import-glob-0.rs +++ b/src/test/run-pass/import-glob-0.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import-glob-1.rs b/src/test/run-pass/import-glob-1.rs index 612078ecf78..32770f39c0e 100644 --- a/src/test/run-pass/import-glob-1.rs +++ b/src/test/run-pass/import-glob-1.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import-glob-crate.rs b/src/test/run-pass/import-glob-crate.rs index bd73da0ee52..0d3d08b3a39 100644 --- a/src/test/run-pass/import-glob-crate.rs +++ b/src/test/run-pass/import-glob-crate.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import-in-block.rs b/src/test/run-pass/import-in-block.rs index 5283c7e8499..58b45f3d5f8 100644 --- a/src/test/run-pass/import-in-block.rs +++ b/src/test/run-pass/import-in-block.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern mod std; - fn main() { use vec::to_mut; log(debug, vec::len(to_mut(~[1, 2]))); diff --git a/src/test/run-pass/import-trailing-comma.rs b/src/test/run-pass/import-trailing-comma.rs index 9babd89055d..4a1ad3c5100 100644 --- a/src/test/run-pass/import-trailing-comma.rs +++ b/src/test/run-pass/import-trailing-comma.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import.rs b/src/test/run-pass/import.rs index 0e6e986cba7..a3fdefaeba6 100644 --- a/src/test/run-pass/import.rs +++ b/src/test/run-pass/import.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import2.rs b/src/test/run-pass/import2.rs index f8337beb687..34f67340a28 100644 --- a/src/test/run-pass/import2.rs +++ b/src/test/run-pass/import2.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import3.rs b/src/test/run-pass/import3.rs index cbea124c5a0..b3545d9ec8c 100644 --- a/src/test/run-pass/import3.rs +++ b/src/test/run-pass/import3.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import4.rs b/src/test/run-pass/import4.rs index 90ef72c14e2..9941648c4f0 100644 --- a/src/test/run-pass/import4.rs +++ b/src/test/run-pass/import4.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import5.rs b/src/test/run-pass/import5.rs index 0e3eae3a6cb..554aa4154b3 100644 --- a/src/test/run-pass/import5.rs +++ b/src/test/run-pass/import5.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -11,8 +13,9 @@ use foo::bar; mod foo { #[legacy_exports]; - use zed::bar; + use foo::zed::bar; export bar; + export zed; mod zed { #[legacy_exports]; fn bar() { debug!("foo"); } diff --git a/src/test/run-pass/import6.rs b/src/test/run-pass/import6.rs index 8fa362e596a..5ffbc0895bd 100644 --- a/src/test/run-pass/import6.rs +++ b/src/test/run-pass/import6.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import7.rs b/src/test/run-pass/import7.rs index 917e8108daa..579a1e093ce 100644 --- a/src/test/run-pass/import7.rs +++ b/src/test/run-pass/import7.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import8.rs b/src/test/run-pass/import8.rs index b4ca26138a0..d05e88a2b8d 100644 --- a/src/test/run-pass/import8.rs +++ b/src/test/run-pass/import8.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/intrinsics-math.rs b/src/test/run-pass/intrinsics-math.rs index 352cd089cdc..19ce8e8d224 100644 --- a/src/test/run-pass/intrinsics-math.rs +++ b/src/test/run-pass/intrinsics-math.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-1112.rs b/src/test/run-pass/issue-1112.rs index f0eb3fc2405..8eca57eacbf 100644 --- a/src/test/run-pass/issue-1112.rs +++ b/src/test/run-pass/issue-1112.rs @@ -11,9 +11,6 @@ // Issue #1112 // Alignment of interior pointers to dynamic-size types -extern mod std; -use ptr::addr_of; - type x = { a: T, b: u8, @@ -44,4 +41,4 @@ fn bar(x: x) { assert x.e == 11u16; assert x.f == 12u8; assert x.g == 13u8; -} \ No newline at end of file +} diff --git a/src/test/run-pass/issue-1696.rs b/src/test/run-pass/issue-1696.rs index ef757f6394a..72ce678cd23 100644 --- a/src/test/run-pass/issue-1696.rs +++ b/src/test/run-pass/issue-1696.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-2214.rs b/src/test/run-pass/issue-2214.rs index 0c616957557..05c2595931e 100644 --- a/src/test/run-pass/issue-2214.rs +++ b/src/test/run-pass/issue-2214.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -36,4 +38,4 @@ fn main() { let mut y: int = 5; let x: &mut int = &mut y; assert (lgamma(1.0 as c_double, x) == 0.0 as c_double); -} \ No newline at end of file +} diff --git a/src/test/run-pass/issue-2383.rs b/src/test/run-pass/issue-2383.rs index 49661a31cdb..eb7506aa3d2 100644 --- a/src/test/run-pass/issue-2383.rs +++ b/src/test/run-pass/issue-2383.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-2445.rs b/src/test/run-pass/issue-2445.rs index 1cc9783dd5b..7cf681c9f94 100644 --- a/src/test/run-pass/issue-2445.rs +++ b/src/test/run-pass/issue-2445.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use dvec::DVec; - struct c1 { x: T, } diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index 690cc6a4ab7..a8412aacee9 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-2804-2.rs b/src/test/run-pass/issue-2804-2.rs index 750bdbd570f..c79b59f7cd9 100644 --- a/src/test/run-pass/issue-2804-2.rs +++ b/src/test/run-pass/issue-2804-2.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-2804.rs b/src/test/run-pass/issue-2804.rs index ba3bd2869f2..cb81dad98fa 100644 --- a/src/test/run-pass/issue-2804.rs +++ b/src/test/run-pass/issue-2804.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-2895.rs b/src/test/run-pass/issue-2895.rs index 0a7c7ddce2d..a21cad8fd39 100644 --- a/src/test/run-pass/issue-2895.rs +++ b/src/test/run-pass/issue-2895.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use sys::size_of; -extern mod std; - struct Cat { x: int } @@ -25,12 +22,12 @@ impl Kitty : Drop { #[cfg(target_arch = "x86_64")] fn main() { - assert (size_of::() == 8 as uint); - assert (size_of::() == 16 as uint); + assert (sys::size_of::() == 8 as uint); + assert (sys::size_of::() == 16 as uint); } #[cfg(target_arch = "x86")] fn main() { - assert (size_of::() == 4 as uint); - assert (size_of::() == 8 as uint); + assert (sys::size_of::() == 4 as uint); + assert (sys::size_of::() == 8 as uint); } diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index c228c8199f2..506f9dfa64e 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-3026.rs b/src/test/run-pass/issue-3026.rs index a0a7fd5f3ff..04932676f3d 100644 --- a/src/test/run-pass/issue-3026.rs +++ b/src/test/run-pass/issue-3026.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-3052.rs b/src/test/run-pass/issue-3052.rs index 012a827c239..74f67ff9280 100644 --- a/src/test/run-pass/issue-3052.rs +++ b/src/test/run-pass/issue-3052.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use option::*; - type Connection = fn@(~[u8]); fn f() -> Option { diff --git a/src/test/run-pass/issue-3424.rs b/src/test/run-pass/issue-3424.rs index e24384fcc12..6064713b295 100644 --- a/src/test/run-pass/issue-3424.rs +++ b/src/test/run-pass/issue-3424.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-3559.rs b/src/test/run-pass/issue-3559.rs index 3464f3a363f..ee68a546caf 100644 --- a/src/test/run-pass/issue-3559.rs +++ b/src/test/run-pass/issue-3559.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-3702.rs b/src/test/run-pass/issue-3702.rs index 942114eef6c..9045e3aecda 100644 --- a/src/test/run-pass/issue-3702.rs +++ b/src/test/run-pass/issue-3702.rs @@ -8,15 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use io::println; - fn main() { trait Text { fn to_str(&self) -> ~str; } fn to_string(t: Text) { - println(t.to_str()); + io::println(t.to_str()); } } diff --git a/src/test/run-pass/issue-507.rs b/src/test/run-pass/issue-507.rs index 92c8e6494da..5d267f9d914 100644 --- a/src/test/run-pass/issue-507.rs +++ b/src/test/run-pass/issue-507.rs @@ -15,26 +15,19 @@ https://github.com/graydon/rust/issues/507 */ -extern mod std; +fn grandchild(c: core::comm::Chan) { core::comm::send(c, 42); } -use comm::Chan; -use comm::send; -use comm::Port; -use comm::recv; - -fn grandchild(c: Chan) { send(c, 42); } - -fn child(c: Chan) { +fn child(c: core::comm::Chan) { task::spawn(|| grandchild(c) ) } fn main() { - let p = comm::Port(); - let ch = Chan(&p); + let p = core::comm::Port(); + let ch = core::comm::Chan(&p); task::spawn(|| child(ch) ); - let x: int = recv(p); + let x: int = core::comm::recv(p); log(debug, x); diff --git a/src/test/run-pass/issue-687.rs b/src/test/run-pass/issue-687.rs index 890dce22bff..bac6dc67ac2 100644 --- a/src/test/run-pass/issue-687.rs +++ b/src/test/run-pass/issue-687.rs @@ -8,26 +8,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern mod std; -use comm::Chan; -use comm::Port; -use comm::recv; -use comm::send; - enum msg { closed, received(~[u8]), } -fn producer(c: Chan<~[u8]>) { - send(c, ~[1u8, 2u8, 3u8, 4u8]); +fn producer(c: core::comm::Chan<~[u8]>) { + core::comm::send(c, ~[1u8, 2u8, 3u8, 4u8]); let empty: ~[u8] = ~[]; - send(c, empty); + core::comm::send(c, empty); } -fn packager(cb: Chan>, msg: Chan) { - let p: Port<~[u8]> = Port(); - send(cb, Chan(&p)); +fn packager(cb: core::comm::Chan>, msg: core::comm::Chan) { + let p: core::comm::Port<~[u8]> = core::comm::Port(); + core::comm::send(cb, core::comm::Chan(&p)); loop { debug!("waiting for bytes"); - let data = recv(p); + let data = core::comm::recv(p); debug!("got bytes"); if vec::len(data) == 0u { debug!("got empty bytes, quitting"); @@ -35,26 +29,26 @@ fn packager(cb: Chan>, msg: Chan) { } debug!("sending non-empty buffer of length"); log(debug, vec::len(data)); - send(msg, received(data)); + core::comm::send(msg, received(data)); debug!("sent non-empty buffer"); } debug!("sending closed message"); - send(msg, closed); + core::comm::send(msg, closed); debug!("sent closed message"); } fn main() { - let p: Port = Port(); - let ch = Chan(&p); - let recv_reader: Port> = Port(); - let recv_reader_chan = Chan(&recv_reader); + let p: core::comm::Port = core::comm::Port(); + let ch = core::comm::Chan(&p); + let recv_reader: core::comm::Port> = core::comm::Port(); + let recv_reader_chan = core::comm::Chan(&recv_reader); let pack = task::spawn(|| packager(recv_reader_chan, ch) ); - let source_chan: Chan<~[u8]> = recv(recv_reader); + let source_chan: core::comm::Chan<~[u8]> = core::comm::recv(recv_reader); let prod = task::spawn(|| producer(source_chan) ); loop { - let msg = recv(p); + let msg = core::comm::recv(p); match msg { closed => { debug!("Got close message"); break; } received(data) => { diff --git a/src/test/run-pass/issue-783.rs b/src/test/run-pass/issue-783.rs index 5174b57e4f0..2654a738599 100644 --- a/src/test/run-pass/issue-783.rs +++ b/src/test/run-pass/issue-783.rs @@ -8,20 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern mod std; -use comm::*; -use task::spawn; - fn a() { fn doit() { - fn b(c: Chan>) { - let p = Port(); - send(c, Chan(&p)); + fn b(c: core::comm::Chan>) { + let p = core::comm::Port(); + core::comm::send(c, core::comm::Chan(&p)); } - let p = Port(); - let ch = Chan(&p); - spawn(|| b(ch) ); - recv(p); + let p = core::comm::Port(); + let ch = core::comm::Chan(&p); + task::spawn(|| b(ch) ); + core::comm::recv(p); } let mut i = 0; while i < 100 { @@ -32,6 +28,6 @@ fn a() { fn main() { for iter::repeat(100u) { - spawn(|| a() ); + task::spawn(|| a() ); } } diff --git a/src/test/run-pass/ivec-tag.rs b/src/test/run-pass/ivec-tag.rs index b92d20bbe40..4a33d770872 100644 --- a/src/test/run-pass/ivec-tag.rs +++ b/src/test/run-pass/ivec-tag.rs @@ -1,20 +1,13 @@ -extern mod std; - -use comm::Chan; -use comm::Port; -use comm::send; -use comm::recv; - -fn producer(c: Chan<~[u8]>) { - send(c, +fn producer(c: core::comm::Chan<~[u8]>) { + core::comm::send(c, ~[1u8, 2u8, 3u8, 4u8, 5u8, 6u8, 7u8, 8u8, 9u8, 10u8, 11u8, 12u8, 13u8]); } fn main() { - let p: Port<~[u8]> = Port(); - let ch = Chan(&p); + let p: core::comm::Port<~[u8]> = core::comm::Port(); + let ch = core::comm::Chan(&p); let prod = task::spawn(|| producer(ch) ); - let data: ~[u8] = recv(p); + let data: ~[u8] = core::comm::recv(p); } diff --git a/src/test/run-pass/lazychan.rs b/src/test/run-pass/lazychan.rs index dabc211279e..a093b89b70f 100644 --- a/src/test/run-pass/lazychan.rs +++ b/src/test/run-pass/lazychan.rs @@ -9,26 +9,22 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -extern mod std; -use comm::*; - fn main() { - let p = Port(); - let ch = Chan(&p); + let p = core::comm::Port(); + let ch = core::comm::Chan(&p); let mut y: int; task::spawn(|| child(ch) ); - y = recv(p); + y = core::comm::recv(p); debug!("received 1"); log(debug, y); assert (y == 10); task::spawn(|| child(ch) ); - y = recv(p); + y = core::comm::recv(p); debug!("received 2"); log(debug, y); assert (y == 10); } -fn child(c: Chan) { send(c, 10); } +fn child(c: core::comm::Chan) { core::comm::send(c, 10); } diff --git a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs index a47e482908b..af2fe623c44 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/mod-merge-hack-template.rs b/src/test/run-pass/mod-merge-hack-template.rs index 61d10fcbfd6..94edb596b5f 100644 --- a/src/test/run-pass/mod-merge-hack-template.rs +++ b/src/test/run-pass/mod-merge-hack-template.rs @@ -10,7 +10,7 @@ // xfail-test not a test. used by mod-merge-hack.rs -use T = inst::T; +use T = self::inst::T; pub const bits: uint = inst::bits; pub pure fn min(x: T, y: T) -> T { if x < y { x } else { y } } diff --git a/src/test/run-pass/mod-view-items.rs b/src/test/run-pass/mod-view-items.rs index b76d57ddfe7..dd5f7484f10 100644 --- a/src/test/run-pass/mod-view-items.rs +++ b/src/test/run-pass/mod-view-items.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/nested-pattern.rs b/src/test/run-pass/nested-pattern.rs index 0cbd8cc616d..450b697bfb1 100644 --- a/src/test/run-pass/nested-pattern.rs +++ b/src/test/run-pass/nested-pattern.rs @@ -11,9 +11,6 @@ // a bug was causing this to complain about leaked memory on exit -extern mod std; -use option::Some; -use option::None; enum t { foo(int, uint), bar(int, Option), } diff --git a/src/test/run-pass/non-boolean-pure-fns.rs b/src/test/run-pass/non-boolean-pure-fns.rs index daf1b461f90..620bd049053 100644 --- a/src/test/run-pass/non-boolean-pure-fns.rs +++ b/src/test/run-pass/non-boolean-pure-fns.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/pipe-bank-proto.rs b/src/test/run-pass/pipe-bank-proto.rs index 9deba54a1a8..2f863a4211b 100644 --- a/src/test/run-pass/pipe-bank-proto.rs +++ b/src/test/run-pass/pipe-bank-proto.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/pipe-detect-term.rs b/src/test/run-pass/pipe-detect-term.rs index bb86ba8f45a..c2d4be04191 100644 --- a/src/test/run-pass/pipe-detect-term.rs +++ b/src/test/run-pass/pipe-detect-term.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/pipe-peek.rs b/src/test/run-pass/pipe-peek.rs index 7ca81a6d13a..d7d0ccfc404 100644 --- a/src/test/run-pass/pipe-peek.rs +++ b/src/test/run-pass/pipe-peek.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/pipe-pingpong-bounded.rs b/src/test/run-pass/pipe-pingpong-bounded.rs index 5dd23a28fd7..8589bbb8e25 100644 --- a/src/test/run-pass/pipe-pingpong-bounded.rs +++ b/src/test/run-pass/pipe-pingpong-bounded.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/pipe-pingpong-proto.rs b/src/test/run-pass/pipe-pingpong-proto.rs index 8228cf5a19c..88db8953b8c 100644 --- a/src/test/run-pass/pipe-pingpong-proto.rs +++ b/src/test/run-pass/pipe-pingpong-proto.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/pipe-presentation-examples.rs b/src/test/run-pass/pipe-presentation-examples.rs index 82c011f1060..173325834c0 100644 --- a/src/test/run-pass/pipe-presentation-examples.rs +++ b/src/test/run-pass/pipe-presentation-examples.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/pipe-select.rs b/src/test/run-pass/pipe-select.rs index 020d0fe0619..d14b89aff77 100644 --- a/src/test/run-pass/pipe-select.rs +++ b/src/test/run-pass/pipe-select.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/pipe-sleep.rs b/src/test/run-pass/pipe-sleep.rs index c465621ac83..4a6e7b4ce36 100644 --- a/src/test/run-pass/pipe-sleep.rs +++ b/src/test/run-pass/pipe-sleep.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -29,4 +31,4 @@ fn main() { sleep(iotask, 500); signal(move c); -} \ No newline at end of file +} diff --git a/src/test/run-pass/placement-new-arena.rs b/src/test/run-pass/placement-new-arena.rs index 0b3ab7fa746..71023d6c7f4 100644 --- a/src/test/run-pass/placement-new-arena.rs +++ b/src/test/run-pass/placement-new-arena.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/reexport-star.rs b/src/test/run-pass/reexport-star.rs index 0574794deb4..b59ce4d9020 100644 --- a/src/test/run-pass/reexport-star.rs +++ b/src/test/run-pass/reexport-star.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/regions-mock-trans-impls.rs b/src/test/run-pass/regions-mock-trans-impls.rs index 5b4ec1c85c9..0fd1b361b29 100644 --- a/src/test/run-pass/regions-mock-trans-impls.rs +++ b/src/test/run-pass/regions-mock-trans-impls.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/regions-mock-trans.rs b/src/test/run-pass/regions-mock-trans.rs index db5f7345a64..054c29c2a05 100644 --- a/src/test/run-pass/regions-mock-trans.rs +++ b/src/test/run-pass/regions-mock-trans.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use libc, sys, cast; - enum arena = (); type bcx = { diff --git a/src/test/run-pass/rt-circular-buffer.rs b/src/test/run-pass/rt-circular-buffer.rs index a644f9fcb1e..6fde5bef741 100644 --- a/src/test/run-pass/rt-circular-buffer.rs +++ b/src/test/run-pass/rt-circular-buffer.rs @@ -12,13 +12,8 @@ // Regression tests for circular_buffer when using a unit // that has a size that is not a power of two -extern mod std; -use comm::Port; -use comm::Chan; -use comm::send; -use comm::recv; -// A 12-byte unit to send over the channel +// A 12-byte unit to core::comm::send over the channel type record = {val1: u32, val2: u32, val3: u32}; @@ -27,52 +22,52 @@ type record = {val1: u32, val2: u32, val3: u32}; // power of two so needs to be rounded up. Don't trigger any // assertions. fn test_init() { - let myport = Port(); - let mychan = Chan(&myport); + let myport = core::comm::Port(); + let mychan = core::comm::Chan(&myport); let val: record = {val1: 0u32, val2: 0u32, val3: 0u32}; - send(mychan, val); + core::comm::send(mychan, val); } // Dump lots of items into the channel so it has to grow. // Don't trigger any assertions. fn test_grow() { - let myport = Port(); - let mychan = Chan(&myport); + let myport = core::comm::Port(); + let mychan = core::comm::Chan(&myport); for uint::range(0u, 100u) |i| { let val: record = {val1: 0u32, val2: 0u32, val3: 0u32}; - comm::send(mychan, val); + core::comm::send(mychan, val); } } // Don't allow the buffer to shrink below it's original size fn test_shrink1() { - let myport = Port(); - let mychan = Chan(&myport); - send(mychan, 0i8); - let x = recv(myport); + let myport = core::comm::Port(); + let mychan = core::comm::Chan(&myport); + core::comm::send(mychan, 0i8); + let x = core::comm::recv(myport); } fn test_shrink2() { - let myport = Port(); - let mychan = Chan(&myport); + let myport = core::comm::Port(); + let mychan = core::comm::Chan(&myport); for uint::range(0u, 100u) |_i| { let val: record = {val1: 0u32, val2: 0u32, val3: 0u32}; - send(mychan, val); + core::comm::send(mychan, val); } - for uint::range(0u, 100u) |_i| { let x = recv(myport); } + for uint::range(0u, 100u) |_i| { let x = core::comm::recv(myport); } } // Test rotating the buffer when the unit size is not a power of two fn test_rotate() { - let myport = Port(); - let mychan = Chan(&myport); + let myport = core::comm::Port(); + let mychan = core::comm::Chan(&myport); for uint::range(0u, 100u) |i| { let val = {val1: i as u32, val2: i as u32, val3: i as u32}; - send(mychan, val); - let x = recv(myport); + core::comm::send(mychan, val); + let x = core::comm::recv(myport); assert (x.val1 == i as u32); assert (x.val2 == i as u32); assert (x.val3 == i as u32); @@ -83,16 +78,16 @@ fn test_rotate() { // Test rotating and growing the buffer when // the unit size is not a power of two fn test_rotate_grow() { - let myport = Port::(); - let mychan = Chan(&myport); + let myport = core::comm::Port::(); + let mychan = core::comm::Chan(&myport); for uint::range(0u, 10u) |j| { for uint::range(0u, 10u) |i| { let val: record = {val1: i as u32, val2: i as u32, val3: i as u32}; - send(mychan, val); + core::comm::send(mychan, val); } for uint::range(0u, 10u) |i| { - let x = recv(myport); + let x = core::comm::recv(myport); assert (x.val1 == i as u32); assert (x.val2 == i as u32); assert (x.val3 == i as u32); diff --git a/src/test/run-pass/rt-sched-1.rs b/src/test/run-pass/rt-sched-1.rs index 66fd68faada..ed45627a379 100644 --- a/src/test/run-pass/rt-sched-1.rs +++ b/src/test/run-pass/rt-sched-1.rs @@ -10,8 +10,6 @@ // Tests of the runtime's scheduler interface -use ptr::is_null; - type sched_id = int; type task_id = *libc::c_void; diff --git a/src/test/run-pass/self-shadowing-import.rs b/src/test/run-pass/self-shadowing-import.rs index caa614e1a7e..86e6b7f0f50 100644 --- a/src/test/run-pass/self-shadowing-import.rs +++ b/src/test/run-pass/self-shadowing-import.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/send-resource.rs b/src/test/run-pass/send-resource.rs index 3c7fa7cc3d4..75d526aa2c7 100644 --- a/src/test/run-pass/send-resource.rs +++ b/src/test/run-pass/send-resource.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use task::*; -use comm::*; - struct test { f: int, } @@ -26,12 +23,12 @@ fn test(f: int) -> test { } fn main() { - let p = Port(); - let c = Chan(&p); + let p = core::comm::Port(); + let c = core::comm::Chan(&p); - do spawn() { - let p = Port(); - c.send(Chan(&p)); + do task::spawn() { + let p = core::comm::Port(); + c.send(core::comm::Chan(&p)); let _r = p.recv(); } diff --git a/src/test/run-pass/send-type-inference.rs b/src/test/run-pass/send-type-inference.rs index df21dcdda98..664ba09ae4b 100644 --- a/src/test/run-pass/send-type-inference.rs +++ b/src/test/run-pass/send-type-inference.rs @@ -8,16 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern mod std; -use comm::Chan; -use comm::send; -use comm::Port; - // tests that ctrl's type gets inferred properly type command = {key: K, val: V}; -fn cache_server(c: Chan>>) { - let ctrl = Port(); - send(c, Chan(&ctrl)); +fn cache_server(c: core::comm::Chan>>) { + let ctrl = core::comm::Port(); + core::comm::send(c, core::comm::Chan(&ctrl)); } fn main() { } diff --git a/src/test/run-pass/sendfn-deep-copy.rs b/src/test/run-pass/sendfn-deep-copy.rs index 441adda3a23..01a480ff25d 100644 --- a/src/test/run-pass/sendfn-deep-copy.rs +++ b/src/test/run-pass/sendfn-deep-copy.rs @@ -8,11 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern mod std; - -use comm::Chan; -use comm::send; - fn main() { test05(); } fn mk_counter() -> fn~(A) -> (A,uint) { diff --git a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs index 5bbb001cb15..504d7948ffc 100644 --- a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs +++ b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs @@ -8,11 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern mod std; - -use comm::Chan; -use comm::send; - fn main() { test05(); } fn test05_start(&&f: fn~(int)) { diff --git a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs index bfc9079c8d0..4139aedf881 100644 --- a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs +++ b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/spawn-fn.rs b/src/test/run-pass/spawn-fn.rs index 8b67a01420c..5ae5bbaeec9 100644 --- a/src/test/run-pass/spawn-fn.rs +++ b/src/test/run-pass/spawn-fn.rs @@ -10,9 +10,6 @@ // except according to those terms. -extern mod std; -use task::yield; - fn x(s: ~str, n: int) { log(debug, s); log(debug, n); @@ -23,5 +20,5 @@ fn main() { task::spawn(|| x(~"hello from second spawned fn", 66) ); task::spawn(|| x(~"hello from third spawned fn", 67) ); let mut i: int = 30; - while i > 0 { i = i - 1; debug!("parent sleeping"); yield(); } + while i > 0 { i = i - 1; debug!("parent sleeping"); task::yield(); } } diff --git a/src/test/run-pass/spawn2.rs b/src/test/run-pass/spawn2.rs index d358d7d7986..fb3dc1ff741 100644 --- a/src/test/run-pass/spawn2.rs +++ b/src/test/run-pass/spawn2.rs @@ -9,11 +9,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -extern mod std; -use task::spawn; - -fn main() { spawn(|| child((10, 20, 30, 40, 50, 60, 70, 80, 90)) ); } +fn main() { task::spawn(|| child((10, 20, 30, 40, 50, 60, 70, 80, 90)) ); } fn child(&&args: (int, int, int, int, int, int, int, int, int)) { let (i1, i2, i3, i4, i5, i6, i7, i8, i9) = args; diff --git a/src/test/run-pass/tag-exports.rs b/src/test/run-pass/tag-exports.rs index 31a9c2ff698..ff4f5bfe62f 100644 --- a/src/test/run-pass/tag-exports.rs +++ b/src/test/run-pass/tag-exports.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/task-comm-16.rs b/src/test/run-pass/task-comm-16.rs index dcfc6fed207..76788731947 100644 --- a/src/test/run-pass/task-comm-16.rs +++ b/src/test/run-pass/task-comm-16.rs @@ -10,7 +10,6 @@ // except according to those terms. -extern mod std; use pipes::send; use pipes::Port; use pipes::recv; diff --git a/src/test/run-pass/task-comm-4.rs b/src/test/run-pass/task-comm-4.rs index 3f42b4d5b57..dc82ae214dc 100644 --- a/src/test/run-pass/task-comm-4.rs +++ b/src/test/run-pass/task-comm-4.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern mod std; use pipes::send; fn main() { test00(); } diff --git a/src/test/run-pass/task-comm-6.rs b/src/test/run-pass/task-comm-6.rs index 41e24146635..cad0f4f1dde 100644 --- a/src/test/run-pass/task-comm-6.rs +++ b/src/test/run-pass/task-comm-6.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern mod std; use pipes::send; use pipes::Chan; use pipes::recv; diff --git a/src/test/run-pass/task-comm.rs b/src/test/run-pass/task-comm.rs index 3f316f8c5f3..5147c2ba6e4 100644 --- a/src/test/run-pass/task-comm.rs +++ b/src/test/run-pass/task-comm.rs @@ -8,14 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern mod std; - -use task::task; -use comm::Chan; -use comm::Port; -use comm::send; -use comm::recv; - fn main() { test00(); // test01(); @@ -25,12 +17,12 @@ fn main() { test06(); } -fn test00_start(ch: Chan, message: int, count: int) { +fn test00_start(ch: core::comm::Chan, message: int, count: int) { debug!("Starting test00_start"); let mut i: int = 0; while i < count { debug!("Sending Message"); - send(ch, message + 0); + core::comm::send(ch, message + 0); i = i + 1; } debug!("Ending test00_start"); @@ -41,8 +33,8 @@ fn test00() { let number_of_messages: int = 4; debug!("Creating tasks"); - let po = Port(); - let ch = Chan(&po); + let po = core::comm::Port(); + let ch = core::comm::Chan(&po); let mut i: int = 0; @@ -58,7 +50,7 @@ fn test00() { let mut sum: int = 0; for results.each |r| { i = 0; - while i < number_of_messages { sum += recv(po); i = i + 1; } + while i < number_of_messages { sum += core::comm::recv(po); i = i + 1; } } for results.each |r| { r.recv(); } @@ -71,19 +63,19 @@ fn test00() { } fn test01() { - let p = Port(); + let p = core::comm::Port(); debug!("Reading from a port that is never written to."); - let value: int = recv(p); + let value: int = core::comm::recv(p); log(debug, value); } fn test02() { - let p = Port(); - let c = Chan(&p); + let p = core::comm::Port(); + let c = core::comm::Chan(&p); debug!("Writing to a local task channel."); - send(c, 42); + core::comm::send(c, 42); debug!("Reading from a local task port."); - let value: int = recv(p); + let value: int = core::comm::recv(p); log(debug, value); } @@ -101,22 +93,22 @@ fn test04() { debug!("Finishing up."); } -fn test05_start(ch: Chan) { - send(ch, 10); - send(ch, 20); - send(ch, 30); - send(ch, 30); - send(ch, 30); +fn test05_start(ch: core::comm::Chan) { + core::comm::send(ch, 10); + core::comm::send(ch, 20); + core::comm::send(ch, 30); + core::comm::send(ch, 30); + core::comm::send(ch, 30); } fn test05() { - let po = comm::Port(); - let ch = Chan(&po); + let po = core::comm::Port(); + let ch = core::comm::Chan(&po); task::spawn(|| test05_start(ch) ); let mut value: int; - value = recv(po); - value = recv(po); - value = recv(po); + value = core::comm::recv(po); + value = core::comm::recv(po); + value = core::comm::recv(po); log(debug, value); } diff --git a/src/test/run-pass/task-killjoin-rsrc.rs b/src/test/run-pass/task-killjoin-rsrc.rs index c69886b7cad..2fe24a7b38e 100644 --- a/src/test/run-pass/task-killjoin-rsrc.rs +++ b/src/test/run-pass/task-killjoin-rsrc.rs @@ -13,8 +13,6 @@ // A port of task-killjoin to use a class with a dtor to manage // the join. -extern mod std; - struct notify { ch: comm::Chan, v: @mut bool, } diff --git a/src/test/run-pass/task-killjoin.rs b/src/test/run-pass/task-killjoin.rs index f1e99924108..7ef94afa54f 100644 --- a/src/test/run-pass/task-killjoin.rs +++ b/src/test/run-pass/task-killjoin.rs @@ -15,8 +15,6 @@ // task will kill the supervising task, waking it up. The supervising task no // longer needs to be wakened when the supervised task exits. -extern mod std; - fn supervised() { // Yield to make sure the supervisor joins before we fail. This is // currently not needed because the supervisor runs first, but I can diff --git a/src/test/run-pass/trait-inheritance-num.rs b/src/test/run-pass/trait-inheritance-num.rs index 63f88180d0e..52785ed12d4 100644 --- a/src/test/run-pass/trait-inheritance-num.rs +++ b/src/test/run-pass/trait-inheritance-num.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/trait-inheritance-num0.rs b/src/test/run-pass/trait-inheritance-num0.rs index eb79cfb53a4..43077a7b2e6 100644 --- a/src/test/run-pass/trait-inheritance-num0.rs +++ b/src/test/run-pass/trait-inheritance-num0.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/trait-inheritance-num2.rs b/src/test/run-pass/trait-inheritance-num2.rs index e0ed5491f04..ae72fce4f94 100644 --- a/src/test/run-pass/trait-inheritance-num2.rs +++ b/src/test/run-pass/trait-inheritance-num2.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -103,4 +105,4 @@ fn test_float_ext(n: T) { io::println(fmt!("%?", n < n)) } fn main() { test_float_ext(1f32); -} \ No newline at end of file +} diff --git a/src/test/run-pass/unique-copy-box.rs b/src/test/run-pass/unique-copy-box.rs index 67832810d86..2d3bb42ad4c 100644 --- a/src/test/run-pass/unique-copy-box.rs +++ b/src/test/run-pass/unique-copy-box.rs @@ -8,15 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern mod std; -use sys::refcount; - fn main() unsafe { let i = ~@1; let j = ~@2; - let rc1 = refcount(*i); + let rc1 = sys::refcount(*i); let j = copy i; - let rc2 = refcount(*i); + let rc2 = sys::refcount(*i); error!("rc1: %u rc2: %u", rc1, rc2); assert rc1 + 1u == rc2; } diff --git a/src/test/run-pass/use-mod.rs b/src/test/run-pass/use-mod.rs index 086bf4fed53..dc09d6b4448 100644 --- a/src/test/run-pass/use-mod.rs +++ b/src/test/run-pass/use-mod.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/use.rs b/src/test/run-pass/use.rs index 94d320775a1..d58c168e7cd 100644 --- a/src/test/run-pass/use.rs +++ b/src/test/run-pass/use.rs @@ -1,3 +1,5 @@ +// xfail-fast + // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -22,4 +24,4 @@ mod baz { use x = core::str; } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-pass/yield.rs b/src/test/run-pass/yield.rs index b19cf183b35..2d73e672131 100644 --- a/src/test/run-pass/yield.rs +++ b/src/test/run-pass/yield.rs @@ -9,20 +9,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern mod std; -use task::*; - fn main() { let mut result = None; task::task().future_result(|+r| { result = Some(move r); }).spawn(child); error!("1"); - yield(); + task::yield(); error!("2"); - yield(); + task::yield(); error!("3"); option::unwrap(move result).recv(); } fn child() { - error!("4"); yield(); error!("5"); yield(); error!("6"); + error!("4"); task::yield(); error!("5"); task::yield(); error!("6"); } diff --git a/src/test/run-pass/yield1.rs b/src/test/run-pass/yield1.rs index ce0f9cefde0..34e2f7b3c5d 100644 --- a/src/test/run-pass/yield1.rs +++ b/src/test/run-pass/yield1.rs @@ -9,14 +9,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern mod std; -use task::*; - fn main() { let mut result = None; task::task().future_result(|+r| { result = Some(move r); }).spawn(child); error!("1"); - yield(); + task::yield(); option::unwrap(move result).recv(); } diff --git a/src/test/run-pass/yield2.rs b/src/test/run-pass/yield2.rs index 3d5a326815e..85a8befd3ba 100644 --- a/src/test/run-pass/yield2.rs +++ b/src/test/run-pass/yield2.rs @@ -9,8 +9,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern mod std; - fn main() { let mut i: int = 0; while i < 100 { i = i + 1; log(error, i); task::yield(); } diff --git a/src/test/run-pass/zip-same-length.rs b/src/test/run-pass/zip-same-length.rs index eef2a414bb6..c5a3c8baa3d 100644 --- a/src/test/run-pass/zip-same-length.rs +++ b/src/test/run-pass/zip-same-length.rs @@ -10,7 +10,6 @@ // In this case, the code should compile and should // succeed at runtime -extern mod std; use vec::{head, is_not_empty, last, same_length, zip}; fn enum_chars(start: u8, end: u8) -> ~[char] {