Convert 'import' to 'use'. Remove 'import' keyword.

This commit is contained in:
Brian Anderson 2012-09-07 18:08:21 -07:00
parent 1a8a0a77b1
commit 298eb8c726
78 changed files with 192 additions and 232 deletions

View File

@ -1,5 +1,3 @@
import option;
enum mode { mode_compile_fail, mode_run_fail, mode_run_pass, mode_pretty, }
impl mode : cmp::Eq {

View File

@ -7,7 +7,7 @@
use core(vers = "0.4");
use std(vers = "0.4");
import core::*;
use core::*;
mod procsrv;
mod util;

View File

@ -1,20 +1,16 @@
import option;
import std::getopts;
import std::test;
import str;
import vec;
import task;
use std::getopts;
use std::test;
import core::result;
import result::{Ok, Err};
use core::result;
use result::{Ok, Err};
import common::config;
import common::mode_run_pass;
import common::mode_run_fail;
import common::mode_compile_fail;
import common::mode_pretty;
import common::mode;
import util::logv;
use common::config;
use common::mode_run_pass;
use common::mode_run_fail;
use common::mode_compile_fail;
use common::mode_pretty;
use common::mode;
use util::logv;
fn main(args: ~[~str]) {
let config = parse_config(args);

View File

@ -1,5 +1,5 @@
import common::config;
import io::ReaderUtil;
use common::config;
use io::ReaderUtil;
export load_errors;
export expected_error;

View File

@ -1,8 +1,5 @@
import option;
import str;
import common::config;
import io::ReaderUtil;
use common::config;
use io::ReaderUtil;
export test_props;
export load_props;

View File

@ -1,6 +1,6 @@
import run::spawn_process;
import io::{ReaderUtil, WriterUtil};
import libc::{c_int, pid_t};
use run::spawn_process;
use io::{ReaderUtil, WriterUtil};
use libc::{c_int, pid_t};
export run;

View File

@ -1,13 +1,13 @@
import io::WriterUtil;
use io::WriterUtil;
import common::mode_run_pass;
import common::mode_run_fail;
import common::mode_compile_fail;
import common::mode_pretty;
import common::config;
import header::load_props;
import header::test_props;
import util::logv;
use common::mode_run_pass;
use common::mode_run_fail;
use common::mode_compile_fail;
use common::mode_pretty;
use common::config;
use header::load_props;
use header::test_props;
use util::logv;
export run;

View File

@ -1,7 +1,6 @@
import option;
import os::getenv;
use os::getenv;
import common::config;
use common::config;
fn make_new_path(path: ~str) -> ~str {

View File

@ -75,7 +75,7 @@ export priv;
/// Operations and constants for `int`
#[path = "int-template"]
mod int {
import inst::{ hash, pow };
use inst::{ hash, pow };
export hash, pow;
#[path = "int.rs"]
mod inst;
@ -112,7 +112,7 @@ mod i64 {
/// Operations and constants for `uint`
#[path = "uint-template"]
mod uint {
import inst::{
use inst::{
div_ceil, div_round, div_floor, hash, iterate,
next_power_of_two
};
@ -126,7 +126,7 @@ mod uint {
/// Operations and constants for `u8`
#[path = "uint-template"]
mod u8 {
import inst::is_ascii;
use inst::is_ascii;
export is_ascii;
#[path = "u8.rs"]

View File

@ -97,7 +97,7 @@ mod core {
#[cfg(test)]
mod std {
use std(vers = "0.4");
import std::test;
use std::test;
}
/**

View File

@ -25,10 +25,10 @@ with destructors.
*/
import stackwalk::Word;
import libc::size_t;
import libc::uintptr_t;
import send_map::linear::LinearMap;
use stackwalk::Word;
use libc::size_t;
use libc::uintptr_t;
use send_map::linear::LinearMap;
export Word;
export gc;

View File

@ -210,7 +210,7 @@ fn test_from_str() {
#[test]
#[ignore]
fn test_parse_buf() {
import str::to_bytes;
use str::to_bytes;
assert parse_buf(to_bytes(~"123"), 10u) == Some(123 as T);
assert parse_buf(to_bytes(~"1001"), 2u) == Some(9 as T);
assert parse_buf(to_bytes(~"123"), 8u) == Some(83 as T);
@ -263,7 +263,7 @@ fn test_interfaces() {
#[test]
fn test_times() {
import iter::Times;
use iter::Times;
let ten = 10 as T;
let mut accum = 0;
for ten.times { accum += 1; }
@ -274,6 +274,6 @@ fn test_times() {
#[should_fail]
#[ignore(cfg(windows))]
fn test_times_negative() {
import iter::Times;
use iter::Times;
for (-10).times { log(error, ~"nope!"); }
}

View File

@ -1143,7 +1143,7 @@ mod funcs {
#[cfg(target_os = "win32")]
mod extra {
import types::os::arch::extra::*;
use types::os::arch::extra::*;
#[abi = "stdcall"]
extern mod kernel32 {

View File

@ -78,14 +78,14 @@ fn fill_charp_buf(f: fn(*mut c_char, size_t) -> bool)
#[cfg(windows)]
mod win32 {
import dword = libc::types::os::arch::extra::DWORD;
use dword = libc::types::os::arch::extra::DWORD;
fn fill_utf16_buf_and_decode(f: fn(*mut u16, dword) -> dword)
-> Option<~str> {
// FIXME: remove these when export globs work properly. #1238
import libc::funcs::extra::kernel32::*;
import libc::consts::os::extra::*;
use libc::funcs::extra::kernel32::*;
use libc::consts::os::extra::*;
let mut n = tmpbuf_sz as dword;
let mut res = None;
@ -233,9 +233,9 @@ mod global_env {
#[cfg(windows)]
fn getenv(n: &str) -> Option<~str> {
import libc::types::os::arch::extra::*;
import libc::funcs::extra::kernel32::*;
import win32::*;
use libc::types::os::arch::extra::*;
use libc::funcs::extra::kernel32::*;
use win32::*;
do as_utf16_p(n) |u| {
do fill_utf16_buf_and_decode() |buf, sz| {
GetEnvironmentVariableW(u, buf, sz)
@ -248,7 +248,7 @@ mod global_env {
fn setenv(n: &str, v: &str) {
// FIXME: remove this when export globs work properly. #1238
import libc::funcs::posix01::unistd::setenv;
use libc::funcs::posix01::unistd::setenv;
do str::as_c_str(n) |nbuf| {
do str::as_c_str(v) |vbuf| {
setenv(nbuf, vbuf, 1i32);
@ -260,8 +260,8 @@ mod global_env {
#[cfg(windows)]
fn setenv(n: &str, v: &str) {
// FIXME: remove imports when export globs work properly. #1238
import libc::funcs::extra::kernel32::*;
import win32::*;
use libc::funcs::extra::kernel32::*;
use win32::*;
do as_utf16_p(n) |nbuf| {
do as_utf16_p(v) |vbuf| {
SetEnvironmentVariableW(nbuf, vbuf);
@ -283,13 +283,13 @@ fn fdopen(fd: c_int) -> *FILE {
#[cfg(windows)]
fn fsync_fd(fd: c_int, _level: io::fsync::Level) -> c_int {
import libc::funcs::extra::msvcrt::*;
use libc::funcs::extra::msvcrt::*;
return commit(fd);
}
#[cfg(target_os = "linux")]
fn fsync_fd(fd: c_int, level: io::fsync::Level) -> c_int {
import libc::funcs::posix01::unistd::*;
use libc::funcs::posix01::unistd::*;
match level {
io::fsync::FSync
| io::fsync::FullFSync => return fsync(fd),
@ -299,9 +299,9 @@ fn fsync_fd(fd: c_int, level: io::fsync::Level) -> c_int {
#[cfg(target_os = "macos")]
fn fsync_fd(fd: c_int, level: io::fsync::Level) -> c_int {
import libc::consts::os::extra::*;
import libc::funcs::posix88::fcntl::*;
import libc::funcs::posix01::unistd::*;
use libc::consts::os::extra::*;
use libc::funcs::posix88::fcntl::*;
use libc::funcs::posix01::unistd::*;
match level {
io::fsync::FSync => return fsync(fd),
_ => {
@ -316,7 +316,7 @@ fn fsync_fd(fd: c_int, level: io::fsync::Level) -> c_int {
#[cfg(target_os = "freebsd")]
fn fsync_fd(fd: c_int, _l: io::fsync::Level) -> c_int {
import libc::funcs::posix01::unistd::*;
use libc::funcs::posix01::unistd::*;
return fsync(fd);
}
@ -328,7 +328,7 @@ fn waitpid(pid: pid_t) -> c_int {
#[cfg(unix)]
fn waitpid(pid: pid_t) -> c_int {
import libc::funcs::posix01::wait::*;
use libc::funcs::posix01::wait::*;
let status = 0 as c_int;
assert (waitpid(pid, ptr::mut_addr_of(status),
@ -350,7 +350,7 @@ fn pipe() -> {in: c_int, out: c_int} {
#[cfg(windows)]
fn pipe() -> {in: c_int, out: c_int} {
// FIXME: remove this when export globs work properly. #1238
import libc::consts::os::extra::*;
use libc::consts::os::extra::*;
// Windows pipes work subtly differently than unix pipes, and their
// inheritance has to be handled in a different way that I do not fully
// understand. Here we explicitly make the pipe non-inheritable, which
@ -388,8 +388,8 @@ fn self_exe_path() -> Option<Path> {
#[cfg(target_os = "freebsd")]
fn load_self() -> Option<~str> {
unsafe {
import libc::funcs::bsd44::*;
import libc::consts::os::extra::*;
use libc::funcs::bsd44::*;
use libc::consts::os::extra::*;
do fill_charp_buf() |buf, sz| {
let mib = ~[CTL_KERN as c_int,
KERN_PROC as c_int,
@ -403,7 +403,7 @@ fn self_exe_path() -> Option<Path> {
#[cfg(target_os = "linux")]
fn load_self() -> Option<~str> {
import libc::funcs::posix01::unistd::readlink;
use libc::funcs::posix01::unistd::readlink;
do fill_charp_buf() |buf, sz| {
do as_c_charp("/proc/self/exe") |proc_self_buf| {
readlink(proc_self_buf, buf, sz) != (-1 as ssize_t)
@ -414,7 +414,7 @@ fn self_exe_path() -> Option<Path> {
#[cfg(target_os = "macos")]
fn load_self() -> Option<~str> {
// FIXME: remove imports when export globs work properly. #1238
import libc::funcs::extra::*;
use libc::funcs::extra::*;
do fill_charp_buf() |buf, sz| {
_NSGetExecutablePath(buf, ptr::mut_addr_of(sz as u32))
== (0 as c_int)
@ -424,9 +424,9 @@ fn self_exe_path() -> Option<Path> {
#[cfg(windows)]
fn load_self() -> Option<~str> {
// FIXME: remove imports when export globs work properly. #1238
import libc::types::os::arch::extra::*;
import libc::funcs::extra::kernel32::*;
import win32::*;
use libc::types::os::arch::extra::*;
use libc::funcs::extra::kernel32::*;
use win32::*;
do fill_utf16_buf_and_decode() |buf, sz| {
GetModuleFileNameW(0u as dword, buf, sz)
}
@ -592,9 +592,9 @@ fn make_dir(p: &Path, mode: c_int) -> bool {
#[cfg(windows)]
fn mkdir(p: &Path, _mode: c_int) -> bool {
// FIXME: remove imports when export globs work properly. #1238
import libc::types::os::arch::extra::*;
import libc::funcs::extra::kernel32::*;
import win32::*;
use libc::types::os::arch::extra::*;
use libc::funcs::extra::kernel32::*;
use win32::*;
// FIXME: turn mode into something useful? #2623
do as_utf16_p(p.to_str()) |buf| {
CreateDirectoryW(buf, unsafe { unsafe::reinterpret_cast(&0) })
@ -641,9 +641,9 @@ fn remove_dir(p: &Path) -> bool {
#[cfg(windows)]
fn rmdir(p: &Path) -> bool {
// FIXME: remove imports when export globs work properly. #1238
import libc::funcs::extra::kernel32::*;
import libc::types::os::arch::extra::*;
import win32::*;
use libc::funcs::extra::kernel32::*;
use libc::types::os::arch::extra::*;
use win32::*;
return do as_utf16_p(p.to_str()) |buf| {
RemoveDirectoryW(buf) != (0 as BOOL)
};
@ -663,9 +663,9 @@ fn change_dir(p: &Path) -> bool {
#[cfg(windows)]
fn chdir(p: &Path) -> bool {
// FIXME: remove imports when export globs work properly. #1238
import libc::funcs::extra::kernel32::*;
import libc::types::os::arch::extra::*;
import win32::*;
use libc::funcs::extra::kernel32::*;
use libc::types::os::arch::extra::*;
use win32::*;
return do as_utf16_p(p.to_str()) |buf| {
SetCurrentDirectoryW(buf) != (0 as BOOL)
};
@ -686,9 +686,9 @@ fn copy_file(from: &Path, to: &Path) -> bool {
#[cfg(windows)]
fn do_copy_file(from: &Path, to: &Path) -> bool {
// FIXME: remove imports when export globs work properly. #1238
import libc::funcs::extra::kernel32::*;
import libc::types::os::arch::extra::*;
import win32::*;
use libc::funcs::extra::kernel32::*;
use libc::types::os::arch::extra::*;
use win32::*;
return do as_utf16_p(from.to_str()) |fromp| {
do as_utf16_p(to.to_str()) |top| {
CopyFileW(fromp, top, (0 as BOOL)) != (0 as BOOL)
@ -750,9 +750,9 @@ fn remove_file(p: &Path) -> bool {
fn unlink(p: &Path) -> bool {
// FIXME (similar to Issue #2006): remove imports when export globs
// work properly.
import libc::funcs::extra::kernel32::*;
import libc::types::os::arch::extra::*;
import win32::*;
use libc::funcs::extra::kernel32::*;
use libc::types::os::arch::extra::*;
use win32::*;
return do as_utf16_p(p.to_str()) |buf| {
DeleteFileW(buf) != (0 as BOOL)
};
@ -836,7 +836,6 @@ mod tests {
}
fn make_rand_name() -> ~str {
import rand;
let rng: rand::Rng = rand::Rng();
let n = ~"TEST" + rng.gen_str(10u);
assert option::is_none(getenv(n));

View File

@ -263,8 +263,8 @@ fn test() {
#[test]
fn test_position() {
import str::as_c_str;
import libc::c_char;
use str::as_c_str;
use libc::c_char;
let s = ~"hello";
unsafe {

View File

@ -8,7 +8,7 @@ use libc::c_void;
use libc::size_t;
use libc::uintptr_t;
import gc::{cleanup_stack_for_failure, gc, Word};
use gc::{cleanup_stack_for_failure, gc, Word};
#[allow(non_camel_case_types)]
type rust_task = c_void;

View File

@ -336,7 +336,7 @@ fn program_output(prog: &str, args: &[~str]) ->
}
fn writeclose(fd: c_int, s: &str) {
import io::WriterUtil;
use io::WriterUtil;
error!("writeclose %d, %s", fd as int, s);
let writer = io::fd_writer(fd, false);
@ -402,7 +402,7 @@ fn waitpid(pid: pid_t) -> int {
#[cfg(test)]
mod tests {
import io::WriterUtil;
use io::WriterUtil;
// Regression test for memory leaks
#[ignore(cfg(windows))] // FIXME (#2626)

View File

@ -362,7 +362,7 @@ mod linear {
#[test]
mod test {
import linear::LinearMap;
use linear::LinearMap;
fn int_linear_map<V>() -> LinearMap<uint,V> {
return LinearMap();

View File

@ -2303,7 +2303,7 @@ impl &str: StrSlice {
#[cfg(test)]
mod tests {
import libc::c_char;
use libc::c_char;
#[test]
fn test_eq() {

View File

@ -276,7 +276,7 @@ fn test_from_str() {
#[test]
#[ignore]
fn test_parse_buf() {
import str::to_bytes;
use str::to_bytes;
assert parse_buf(to_bytes(~"123"), 10u) == Some(123u as T);
assert parse_buf(to_bytes(~"1001"), 2u) == Some(9u as T);
assert parse_buf(to_bytes(~"123"), 8u) == Some(83u as T);
@ -304,7 +304,7 @@ fn to_str_radix17() {
#[test]
fn test_times() {
import iter::Times;
use iter::Times;
let ten = 10 as T;
let mut accum = 0;
for ten.times { accum += 1; }

View File

@ -444,7 +444,7 @@ impl<T: Const Send> &RWReadMode<T> {
#[cfg(test)]
mod tests {
import comm::*;
use comm::*;
#[test]
fn manually_share_arc() {

View File

@ -138,7 +138,7 @@ unsafe fn ptr<T>(t: CVec<T>) -> *mut T {
#[cfg(test)]
mod tests {
import libc::*;
use libc::*;
fn malloc(n: size_t) -> CVec<u8> {
let mem = libc::malloc(n);

View File

@ -456,8 +456,8 @@ impl FailType : Eq {
#[cfg(test)]
mod tests {
import opt = getopts;
import result::{Err, Ok};
use opt = getopts;
use result::{Err, Ok};
fn check_fail_type(+f: Fail_, ft: FailType) {
match f {

View File

@ -1087,7 +1087,7 @@ mod tests {
#[test]
fn test_decode_form_urlencoded() {
import map::hash_from_strs;
use map::hash_from_strs;
assert decode_form_urlencoded(~[]).size() == 0;

View File

@ -848,7 +848,6 @@ impl Tm {
#[cfg(test)]
mod tests {
import task;
#[test]
fn test_get_time() {

View File

@ -181,7 +181,7 @@ mod test {
for spec.each |spec| {
let (times, maxms) = spec;
do task::spawn {
import rand::*;
use rand::*;
let rng = Rng();
for iter::repeat(times) {
sleep(hl_loop, rng.next() as uint % maxms);

View File

@ -78,10 +78,8 @@ export expand;
// Transitional reexports so qquote can find the paths it is looking for
mod syntax {
import ext;
export ext;
import parse;
export parse;
pub use ext;
pub use parse;
}
type ser_tps_map = map::HashMap<ast::ident, fn@(@ast::expr) -> ~[@ast::stmt]>;

View File

@ -299,9 +299,9 @@ fn get_mac_body(cx: ext_ctxt, sp: span, args: ast::mac_body)
// using new syntax. This will be obsolete when #old_macros go away.
fn tt_args_to_original_flavor(cx: ext_ctxt, sp: span, arg: ~[ast::token_tree])
-> ast::mac_arg {
import ast::{matcher, matcher_, match_tok, match_seq, match_nonterminal};
import parse::lexer::{new_tt_reader, reader};
import tt::macro_parser::{parse_or_else, matched_seq,
use ast::{matcher, matcher_, match_tok, match_seq, match_nonterminal};
use parse::lexer::{new_tt_reader, reader};
use tt::macro_parser::{parse_or_else, matched_seq,
matched_nonterminal};
// these spans won't matter, anyways

View File

@ -10,10 +10,8 @@ use ext::base::mk_ctxt;
// Transitional reexports so qquote can find the paths it is looking for
mod syntax {
import ext;
export ext;
import parse;
export parse;
pub use ext;
pub use parse;
}
fn path(ids: ~[ident], span: span) -> @ast::path {

View File

@ -16,10 +16,8 @@ use ast_builder::{append_types, path, empty_span};
// Transitional reexports so qquote can find the paths it is looking for
mod syntax {
import ext;
export ext;
import parse;
export parse;
pub use ext;
pub use parse;
}
trait gen_send {
@ -321,7 +319,7 @@ impl protocol: gen_init {
};
cx.parse_item(fmt!("fn init%s() -> (client::%s, server::%s)\
{ import pipes::HasBuffer; %s }",
{ use pipes::HasBuffer; %s }",
start_state.ty_params.to_source(cx),
start_state.to_ty(cx).to_source(cx),
start_state.to_ty(cx).to_source(cx),

View File

@ -3345,15 +3345,6 @@ impl parser {
vis: visibility,
span: mk_sp(lo, self.last_span.hi)
});
} else if self.eat_keyword(~"import") {
let view_paths = self.parse_view_paths();
self.expect(token::SEMI);
return iovi_view_item(@{
node: view_item_import(view_paths),
attrs: attrs,
vis: visibility,
span: mk_sp(lo, self.last_span.hi)
});
} else if self.eat_keyword(~"export") {
let view_paths = self.parse_view_paths();
self.expect(token::SEMI);
@ -3506,7 +3497,6 @@ impl parser {
next_tok = self.look_ahead(2);
};
self.token_is_keyword(~"use", tok)
|| self.token_is_keyword(~"import", tok)
|| self.token_is_keyword(~"export", tok)
|| (self.token_is_keyword(~"extern", tok) &&
self.token_is_keyword(~"mod", next_tok))
@ -3516,8 +3506,6 @@ impl parser {
let lo = self.span.lo, vis = self.parse_visibility();
let node = if self.eat_keyword(~"use") {
self.parse_use(vis)
} else if self.eat_keyword(~"import") {
view_item_import(self.parse_view_paths())
} else if self.eat_keyword(~"export") {
view_item_export(self.parse_view_paths())
} else if self.eat_keyword(~"extern") {

View File

@ -279,7 +279,7 @@ pure fn is_bar(t: token) -> bool {
mod special_idents {
import ast::ident;
use ast::ident;
const underscore : ident = 0u;
const anon : ident = 1u;
const dtor : ident = 2u; // 'drop', but that's reserved
@ -433,7 +433,7 @@ fn strict_keyword_table() -> HashMap<~str, ()> {
~"do", ~"drop",
~"else", ~"enum", ~"export", ~"extern",
~"false", ~"for",
~"if", ~"import",
~"if",
~"let", ~"log", ~"loop",
~"match", ~"mod", ~"move", ~"mut",
~"pure",

View File

@ -1757,7 +1757,7 @@ fn print_view_item(s: ps, item: @ast::view_item) {
}
ast::view_item_import(vps) => {
head(s, ~"import");
head(s, ~"use");
print_view_paths(s, vps);
}

View File

@ -296,7 +296,7 @@ fn building_library(req_crate_type: crate_type, crate: @ast::crate,
}
fn sess_os_to_meta_os(os: os) -> metadata::loader::os {
import metadata::loader;
use metadata::loader;
match os {
os_win32 => loader::os_win32,
@ -308,7 +308,7 @@ fn sess_os_to_meta_os(os: os) -> metadata::loader::os {
#[cfg(test)]
mod test {
import syntax::ast_util;
use syntax::ast_util;
fn make_crate_type_attr(t: ~str) -> ast::attribute {
ast_util::respan(ast_util::dummy_sp(), {

View File

@ -3,10 +3,8 @@
// no dependencies on rustc it can move into its own crate.
mod middle {
import ty = middle_::ty;
export ty;
import resolve = middle_::resolve;
export resolve;
pub use middle_::ty;
pub use middle_::resolve;
}
mod front {
@ -19,11 +17,9 @@ mod driver {
}
mod util {
import ppaux = util_::ppaux;
export ppaux;
pub use util_::ppaux;
}
mod lib {
import llvm = lib_::llvm;
export llvm;
pub use lib_::llvm;
}

View File

@ -55,7 +55,7 @@ fn dump_crates(crate_cache: DVec<cache_entry>) {
fn warn_if_multiple_versions(e: env, diag: span_handler,
crate_cache: ~[cache_entry]) {
import either::*;
use either::*;
if crate_cache.len() != 0u {
let name = loader::crate_name_from_metas(*crate_cache.last().metas);

View File

@ -206,7 +206,7 @@ impl const_val: cmp::Eq {
// FIXME: issue #1417
fn eval_const_expr(tcx: middle::ty::ctxt, e: @expr) -> const_val {
import middle::ty;
use middle::ty;
fn fromb(b: bool) -> const_val { const_int(b as i64) }
match e.node {
expr_unary(neg, inner) => {

View File

@ -1220,7 +1220,7 @@ fn with_scope_datumblock(bcx: block, opt_node_info: Option<node_info>,
name: ~str, f: fn(block) -> datum::DatumBlock)
-> datum::DatumBlock
{
import datum::DatumBlock;
use datum::DatumBlock;
let _icx = bcx.insn_ctxt("with_scope_result");
let scope_cx = scope_block(bcx, opt_node_info, name);

View File

@ -293,7 +293,7 @@ impl reflector {
fn emit_calls_to_trait_visit_ty(bcx: block, t: ty::t,
visitor_val: ValueRef,
visitor_trait_id: def_id) -> block {
import syntax::parse::token::special_idents::tydesc;
use syntax::parse::token::special_idents::tydesc;
let final = sub_block(bcx, ~"final");
assert bcx.ccx().tcx.intrinsic_defs.contains_key(tydesc);
let (_, tydesc_ty) = bcx.ccx().tcx.intrinsic_defs.get(tydesc);

View File

@ -104,7 +104,7 @@ fn exec<T:Send>(
fn build_ctxt(sess: session,
ast: @ast::crate) -> ctxt {
import rustc::front::config;
use rustc::front::config;
let ast = config::strip_unconfigured_items(ast);
let ast = syntax::ext::expand::expand_crate(sess.parse_sess,
@ -201,7 +201,7 @@ fn srv_should_build_ast_map() {
#[test]
fn should_ignore_external_import_paths_that_dont_exist() {
let source = ~"use forble; import forble::bippy;";
let source = ~"use forble; use forble::bippy;";
from_str(source, |_srv| { } )
}

View File

@ -21,11 +21,11 @@ type crate_attrs = {
mod test {
fn parse_attributes(source: ~str) -> ~[ast::attribute] {
import syntax::parse;
import parse::parser;
import parse::attr::parser_attr;
import syntax::codemap;
import syntax::diagnostic;
use syntax::parse;
use parse::parser;
use parse::attr::parser_attr;
use syntax::codemap;
use syntax::diagnostic;
let parse_sess = syntax::parse::new_parse_sess(None);
let parser = parse::new_parser_from_source_str(

View File

@ -71,7 +71,7 @@ fn opts() -> ~[(getopts::Opt, ~str)] {
}
fn usage() {
import io::println;
use io::println;
println(~"Usage: rustdoc ~[options] <cratefile>\n");
println(~"Options:\n");

View File

@ -89,7 +89,7 @@ fn pandoc_writer(
];
do generic_writer |markdown| {
import io::WriterUtil;
use io::WriterUtil;
debug!("pandoc cmd: %s", pandoc_cmd);
debug!("pandoc args: %s", str::connect(pandoc_args, ~" "));
@ -255,7 +255,7 @@ mod test {
}
fn write_file(path: &Path, s: ~str) {
import io::WriterUtil;
use io::WriterUtil;
match io::file_writer(path, ~[io::Create, io::Truncate]) {
result::Ok(writer) => {

View File

@ -34,7 +34,7 @@ fn fold_mod(
}
fn is_hidden(srv: astsrv::srv, doc: doc::itemdoc) -> bool {
import syntax::ast_map;
use syntax::ast_map;
let id = doc.id;
do astsrv::exec(srv) |ctxt| {

View File

@ -19,8 +19,8 @@ use std(vers = "0.4");
use rustc(vers = "0.4");
use syntax(vers = "0.4");
import core::*;
import std::par;
use core::*;
use std::par;
mod config;
mod parse;

View File

@ -72,7 +72,7 @@ fn switch<T: Send, Tb: Send, U>(+endp: pipes::RecvPacketBuffered<T, Tb>,
// Here's the benchmark
fn bounded(count: uint) {
import pingpong::*;
use pingpong::*;
let mut ch = do spawn_service(init) |ch| {
let mut count = count;
@ -99,7 +99,7 @@ fn bounded(count: uint) {
}
fn unbounded(count: uint) {
import pingpong_unbounded::*;
use pingpong_unbounded::*;
let mut ch = do spawn_service(init) |ch| {
let mut count = count;

View File

@ -4,7 +4,7 @@ use std;
const n_threads: int = 503;
fn start(+token: int) {
import iter::*;
use iter::*;
let p = comm::Port();
let mut ch = comm::Chan(p);

View File

@ -1,7 +1,7 @@
// error-pattern: unresolved
mod circ1 {
import circ1::*;
use circ1::*;
export f1;
export f2;
export common;
@ -10,7 +10,7 @@ mod circ1 {
}
mod circ2 {
import circ2::*;
use circ2::*;
export f1;
export f2;
export common;
@ -19,7 +19,7 @@ mod circ2 {
}
mod test {
import circ1::*;
use circ1::*;
fn test() { f1066(); }
}

View File

@ -3,8 +3,7 @@
// we let an impl method can have more permissive bounds than the trait
// method it's implementing, the return type might be less specific than
// needed. Just punt and make it invariant.
import iter;
import iter::BaseIter;
use iter::BaseIter;
trait A {
fn b<C:Copy Const, D>(x: C) -> C;

View File

@ -1,7 +1,6 @@
// Tests that an impl method's bounds aren't *more* restrictive
// than the trait method it's implementing
import iter;
import iter::BaseIter;
use iter::BaseIter;
trait A {
fn b<C:Copy, D>(x: C) -> C;

View File

@ -1,7 +1,6 @@
// Tests that ty params get matched correctly when comparing
// an impl against a trait
import iter;
import iter::BaseIter;
use iter::BaseIter;
trait A {
fn b<C:Copy, D>(x: C) -> C;

View File

@ -7,7 +7,7 @@ mod bar {
}
fn main() {
import bar::{alpha, charlie};
use bar::{alpha, charlie};
match alpha {
alpha | beta => {} //~ ERROR variable `beta` from pattern #2 is not bound in pattern #1
charlie => {}

View File

@ -1,7 +1,7 @@
mod argparse {
use std;
import either::{Either, Left, Right};
use either::{Either, Left, Right};
struct Flag {
name: &str,

View File

@ -9,8 +9,8 @@ mod foo {
mod bar {
mod c {
import foo::point;
import foo::square;
use foo::point;
use foo::square;
fn cc(p: point) -> str { return 2 * (p.x + p.y); }
}
}

View File

@ -4,7 +4,7 @@
// Modified to not use export since it's going away. --pcw
mod foo {
import bar::*;
use bar::*;
mod bar {
const a : int = 10;
}

View File

@ -4,7 +4,7 @@
// Modified to not use export since it's going away. --pcw
mod foo {
import bar::*;
use bar::*;
export a;
mod bar {
const a : int = 10;

View File

@ -6,7 +6,6 @@
use std;
use option = option;
use option::Some;
use option::None;
use std::map;

View File

@ -5,7 +5,7 @@ mod spam {
#[abi = "cdecl"]
extern mod rustrt {
import spam::{ham, eggs};
use spam::{ham, eggs};
export ham;
export eggs;
}

View File

@ -4,14 +4,14 @@ mod a1 {
//
mod b1 {
//
import a2::b1::*;
use a2::b1::*;
// <-\
export word_traveler; // |
}
// |
mod b2 {
// |
import a2::b2::*;
use a2::b2::*;
// <-\ -\ |
export word_traveler; // | | |
} // | | |
@ -24,7 +24,7 @@ mod a2 {
#[nolink]
extern mod b1 {
// | | |
import a1::b2::*;
use a1::b2::*;
// | <-/ -/
export word_traveler; // |
}

View File

@ -1,11 +1,10 @@
use std;
fn main() {
import vec;
import vec::to_mut;
use vec::to_mut;
log(debug, vec::len(to_mut(~[1, 2])));
{
import vec::*;
use vec::*;
log(debug, len(~[2]));
}
}

View File

@ -3,8 +3,8 @@ mod foo {
}
mod bar {
import foo::x;
import z = foo::x;
use foo::x;
use z = foo::x;
fn thing() { x(10); z(10); }
}

View File

@ -1,6 +1,6 @@
use foo::bar;
mod foo {
import zed::bar;
use zed::bar;
export bar;
mod zed {
fn bar() { debug!("foo"); }

View File

@ -6,7 +6,7 @@ mod foo {
}
}
mod bar {
import zed::baz;
use zed::baz;
export baz;
}
fn main() { baz(); }

View File

@ -6,7 +6,7 @@ mod foo {
}
}
mod bar {
import zed::baz;
use zed::baz;
export baz;
mod foo {
mod zed { }

View File

@ -1,5 +1,5 @@
mod pipes {
import unsafe::{forget, transmute};
use unsafe::{forget, transmute};
enum state {
empty,

View File

@ -5,8 +5,7 @@
// begin failing.
mod m {
use std;
import vec;
use core::vec;
fn f() -> ~[int] { vec::from_elem(1u, 0) }
}

View File

@ -2,7 +2,7 @@
mod my_float {
// The type of the float
import inst::T;
use inst::T;
// Define T as float
#[path = "inst_float.rs"]
@ -17,7 +17,7 @@ mod my_float {
#[path = "module-polymorphism-files"]
mod my_f64 {
import inst::T;
use inst::T;
// Define T as f64
#[path = "inst_f64.rs"]
@ -31,7 +31,7 @@ mod my_f64 {
#[path = "module-polymorphism-files"]
mod my_f32 {
import inst::T;
use inst::T;
#[path = "inst_f32.rs"]
mod inst;

View File

@ -4,10 +4,10 @@ mod mystd {
#[path = "float-template"]
mod float {
// The type of the float
import inst::T;
use inst::T;
// Unfortunate
import template::*;
use template::*;
export plus;
// Define T as float
@ -23,10 +23,10 @@ mod mystd {
#[path = "float-template"]
mod f64 {
import inst::T;
use inst::T;
// Unfortunate
import template::*;
use template::*;
export plus;
// Define T as f64
@ -41,10 +41,10 @@ mod mystd {
#[path = "float-template"]
mod f32 {
import inst::T;
use inst::T;
// Unfortunate
import template::*;
use template::*;
export plus;
#[path = "inst_f32.rs"]

View File

@ -8,7 +8,7 @@ mod mystd {
#[path = "float-template"]
mod float {
// The type of the float
import inst::T;
use inst::T;
// Define T as appropriate for platform
#[path = "inst_float.rs"]
@ -19,7 +19,7 @@ mod mystd {
#[path = "float-template"]
mod f64 {
import inst::T;
use inst::T;
// Define T as f64
#[path = "inst_f64.rs"]
@ -28,7 +28,7 @@ mod mystd {
#[path = "float-template"]
mod f32 {
import inst::T;
use inst::T;
#[path = "inst_f32.rs"]
mod inst;

View File

@ -2,7 +2,7 @@
#[path = "module-polymorphism4-files"]
mod cat {
import inst::*;
use inst::*;
#[path = "cat.rs"]
mod inst;
@ -15,7 +15,7 @@ mod cat {
#[path = "module-polymorphism4-files"]
mod dog {
import inst::*;
use inst::*;
#[path = "dog.rs"]
mod inst;

View File

@ -57,7 +57,7 @@ macro_rules! follow (
)
fn client_follow(+bank: bank::client::login) {
import bank::*;
use bank::*;
let bank = client::login(bank, ~"theincredibleholk", ~"1234");
let bank = switch(bank, follow! (
@ -78,7 +78,7 @@ fn client_follow(+bank: bank::client::login) {
}
fn bank_client(+bank: bank::client::login) {
import bank::*;
use bank::*;
let bank = client::login(bank, ~"theincredibleholk", ~"1234");
let bank = match try_recv(bank) {

View File

@ -7,7 +7,7 @@
// This was generated initially by the pipe compiler, but it's been
// modified in hopefully straightforward ways.
mod pingpong {
import pipes::*;
use pipes::*;
type packets = {
// This is probably a resolve bug, I forgot to export packet,
@ -67,11 +67,11 @@ mod pingpong {
}
mod test {
import pipes::recv;
import pingpong::{ping, pong};
use pipes::recv;
use pingpong::{ping, pong};
fn client(-chan: pingpong::client::ping) {
import pingpong::client;
use pingpong::client;
let chan = client::ping(chan); return;
log(error, "Sent ping");
@ -80,7 +80,7 @@ mod test {
}
fn server(-chan: pingpong::server::ping) {
import pingpong::server;
use pingpong::server;
let ping(chan) = recv(chan); return;
log(error, "Received ping");

View File

@ -13,11 +13,11 @@ proto! pingpong (
)
mod test {
import pipes::recv;
import pingpong::{ping, pong};
use pipes::recv;
use pingpong::{ping, pong};
fn client(-chan: pingpong::client::ping) {
import pingpong::client;
use pingpong::client;
let chan = client::ping(chan);
log(error, ~"Sent ping");
@ -26,7 +26,7 @@ mod test {
}
fn server(-chan: pingpong::server::ping) {
import pingpong::server;
use pingpong::server;
let ping(chan) = recv(chan);
log(error, ~"Received ping");

View File

@ -28,7 +28,7 @@ fn macros() {
// Code
fn test(+foo: foo::client::foo, +bar: bar::client::bar) {
import bar::do_baz;
use bar::do_baz;
select! (
foo => {

View File

@ -20,8 +20,8 @@ proto! stream (
)
fn main() {
import oneshot::client::*;
import stream::client::*;
use oneshot::client::*;
use stream::client::*;
let iotask = uv::global_loop::get();

View File

@ -12,7 +12,7 @@ proto! oneshot (
)
fn main() {
import oneshot::client::*;
use oneshot::client::*;
let c = pipes::spawn_service(oneshot::init, |p| { recv(p); });

View File

@ -7,7 +7,7 @@ mod a {
}
mod c {
import a::b::a;
use a::b::a;
fn bar() { assert (a::foo() == 1); }
}

View File

@ -7,8 +7,8 @@ use bar(name = "core", vers = "0.4");
use core::str;
use x = zed::str;
mod baz {
import bar::str;
import x = core::str;
use bar::str;
use x = core::str;
}
fn main() { }