librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc

This commit is contained in:
Patrick Walton 2013-01-08 11:12:16 -08:00
parent fd872284bb
commit a8d37af247
250 changed files with 1342 additions and 453 deletions

View File

@ -2284,6 +2284,10 @@ struct level. Note that fields and methods are _public_ by default.
~~~
mod farm {
# use farm;
# pub type Chicken = int;
# type Cow = int;
# enum Human = int;
# impl Human { fn rest(&self) { } }
# pub fn make_me_a_farm() -> farm::Farm { farm::Farm { chickens: ~[], cows: ~[], farmer: Human(0) } }
pub struct Farm {
priv mut chickens: ~[Chicken],
@ -2310,12 +2314,8 @@ fn main() {
farm::feed_animals(&f);
f.farmer.rest();
}
# type Chicken = int;
# type Cow = int;
# enum Human = int;
# fn make_me_a_farm() -> farm::Farm { farm::make_me_a_farm() }
# fn make_me_a_chicken() -> Chicken { 0 }
# impl Human { fn rest(&self) { } }
# fn make_me_a_chicken() -> farm::Chicken { 0 }
~~~
## Crates

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use cmp;
enum mode { mode_compile_fail, mode_run_fail, mode_run_pass, mode_pretty, }

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use common::config;
use io;
use io::ReaderUtil;

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use common;
use common::config;
use io;

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use io;
use io::{ReaderUtil, WriterUtil};
use libc;

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use io;
use io::WriterUtil;
use os;

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use io;
use os;
use os::getenv;

View File

@ -9,6 +9,7 @@
// except according to those terms.
use core::os;
use core::path::Path;
use core::run;
fn gpgv(args: ~[~str]) -> { status: int, out: ~str, err: ~str } {

View File

@ -15,8 +15,10 @@
#[forbid(deprecated_pattern)];
use cast::transmute;
use kinds::Copy;
use iter;
use libc;
use option::Option;
use ptr::addr_of;
use sys;
use uint;
@ -150,6 +152,10 @@ pub pure fn from_elem<T: Copy>(n_elts: uint, t: T) -> @[T] {
#[cfg(notest)]
pub mod traits {
use at_vec::append;
use kinds::Copy;
use ops::Add;
pub impl<T: Copy> @[T] : Add<&[const T],@[T]> {
#[inline(always)]
pure fn add(&self, rhs: & &self/[const T]) -> @[T] {
@ -162,8 +168,10 @@ pub mod traits {
pub mod traits {}
pub mod raw {
use at_vec::{rusti, rustrt};
use at_vec::{capacity, rusti, rustrt};
use cast::transmute;
use libc;
use ptr::addr_of;
use ptr;
use sys;
use uint;

View File

@ -19,6 +19,7 @@
use bool;
use cmp;
use cmp::Eq;
use option::{None, Option, Some};
/// Negation / inverse
pub pure fn not(v: bool) -> bool { !v }

View File

@ -108,6 +108,8 @@ pub unsafe fn copy_lifetime_vec<S,T>(_ptr: &a/[S], ptr: &T) -> &a/T {
#[cfg(test)]
pub mod tests {
use cast::{bump_box_refcount, reinterpret_cast, transmute};
#[test]
pub fn test_reinterpret_cast() {
assert 1u == unsafe { reinterpret_cast(&1) };

View File

@ -16,6 +16,7 @@
use char;
use cmp::Eq;
use option::{None, Option, Some};
use str;
use u32;
use uint;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use prelude::*;
use task;
use task::local_data::{local_data_pop, local_data_set};

View File

@ -53,6 +53,9 @@ Implicitly, all crates behave as if they included the following prologue:
#[warn(vecs_implicitly_copyable)];
#[deny(non_camel_case_types)];
/* The Prelude. */
pub mod prelude;
/* Primitive types */
@ -243,6 +246,8 @@ pub mod core {
pub use cmp;
pub use condition;
pub use option;
pub use kinds;
}

View File

@ -22,7 +22,9 @@ Do not use ==, !=, <, etc on doubly-linked lists -- it may not terminate.
#[forbid(deprecated_mode)];
#[forbid(deprecated_pattern)];
use kinds::Copy;
use managed;
use option::{None, Option, Some};
use option;
use vec;
@ -94,13 +96,13 @@ impl<T> DListNode<T> {
}
/// Creates a new dlist node with the given data.
pure fn new_dlist_node<T>(data: T) -> DListNode<T> {
pub pure fn new_dlist_node<T>(data: T) -> DListNode<T> {
DListNode(@{data: move data, mut linked: false,
mut prev: None, mut next: None})
}
/// Creates a new, empty dlist.
pure fn DList<T>() -> DList<T> {
pub pure fn DList<T>() -> DList<T> {
DList_(@{mut size: 0, mut hd: None, mut tl: None})
}
@ -120,7 +122,7 @@ pub fn from_vec<T: Copy>(vec: &[T]) -> DList<T> {
/// Produce a list from a list of lists, leaving no elements behind in the
/// input. O(number of sub-lists).
fn concat<T>(lists: DList<DList<T>>) -> DList<T> {
pub fn concat<T>(lists: DList<DList<T>>) -> DList<T> {
let result = DList();
while !lists.is_empty() {
result.append(lists.pop().get());
@ -474,7 +476,9 @@ impl<T: Copy> DList<T> {
mod tests {
#[legacy_exports];
use dlist::{DList, concat, from_vec, new_dlist_node};
use iter;
use option::{None, Some};
use vec;
#[test]

View File

@ -25,6 +25,7 @@ Note that recursive use is not permitted.
use cast;
use cast::reinterpret_cast;
use prelude::*;
use ptr::null;
use vec;

View File

@ -14,10 +14,11 @@
//! A type that represents one of two alternatives
use cmp;
use cmp::Eq;
use result;
use cmp;
use kinds::Copy;
use result::Result;
use result;
use vec;
/// The either type

View File

@ -82,6 +82,7 @@ debug!("hello, %s!", "world");
use cmp::Eq;
use option::{Some, None};
use prelude::*;
use str;
/*
@ -99,6 +100,7 @@ use str;
#[doc(hidden)]
pub mod ct {
use char;
use prelude::*;
use str;
use vec;

View File

@ -31,6 +31,7 @@ use cmp;
use f64;
use num;
use num::Num::from_int;
use option::{None, Option, Some};
use str;
use uint;

View File

@ -42,6 +42,7 @@ with destructors.
use cast;
use io;
use libc::{size_t, uintptr_t};
use option::{None, Option, Some};
use ptr;
use send_map::linear::LinearMap;
use stackwalk;

View File

@ -21,6 +21,7 @@ use from_str::FromStr;
use iter;
use num;
use num::Num::from_int;
use prelude::*;
use str;
use uint;
use vec;

View File

@ -50,8 +50,8 @@ mod inst {
#[test]
fn test_overflows() {
assert (max_value > 0);
assert (min_value <= 0);
assert (min_value + max_value + 1 == 0);
assert (::int::max_value > 0);
assert (::int::min_value <= 0);
assert (::int::min_value + ::int::max_value + 1 == 0);
}
}

View File

@ -28,6 +28,7 @@ use libc::consts::os::posix88::*;
use libc::consts::os::extra::*;
use option;
use os;
use prelude::*;
use ptr;
use result;
use str;
@ -35,7 +36,7 @@ use uint;
use vec;
#[allow(non_camel_case_types)] // not sure what to do about this
type fd_t = c_int;
pub type fd_t = c_int;
#[abi = "cdecl"]
extern mod rustrt {
@ -452,12 +453,12 @@ impl<T: Reader, C> {base: T, cleanup: C}: Reader {
fn tell(&self) -> uint { self.base.tell() }
}
struct FILERes {
pub struct FILERes {
f: *libc::FILE,
drop { libc::fclose(self.f); }
}
fn FILERes(f: *libc::FILE) -> FILERes {
pub fn FILERes(f: *libc::FILE) -> FILERes {
FILERes {
f: f
}
@ -629,12 +630,12 @@ impl fd_t: Writer {
}
}
struct FdRes {
pub struct FdRes {
fd: fd_t,
drop { libc::close(self.fd); }
}
fn FdRes(fd: fd_t) -> FdRes {
pub fn FdRes(fd: fd_t) -> FdRes {
FdRes {
fd: fd
}
@ -1028,7 +1029,10 @@ pub fn read_whole_file(file: &Path) -> Result<~[u8], ~str> {
// fsync related
pub mod fsync {
use io::{FILERes, FdRes, fd_t};
use kinds::Copy;
use libc;
use option::Option;
use option;
use os;
@ -1113,8 +1117,11 @@ pub mod fsync {
#[cfg(test)]
mod tests {
use debug;
use i32;
use io::{BytesWriter, SeekCur, SeekEnd, SeekSet};
use io;
use path::Path;
use result;
use str;
use u64;

View File

@ -16,7 +16,10 @@
#[forbid(deprecated_pattern)];
use cmp::{Eq, Ord};
use iter::BaseIter;
use iter;
use kinds::Copy;
use option::Option;
use self::inst::{IMPL_T, EACH, SIZE_HINT};

View File

@ -11,6 +11,7 @@
mod inst {
use dlist;
use managed;
use option::{Option, Some};
use option;
#[allow(non_camel_case_types)]

View File

@ -10,6 +10,7 @@
mod inst {
use dvec;
use option::{Option, Some};
#[allow(non_camel_case_types)]
pub type IMPL_T<A> = dvec::DVec<A>;

View File

@ -9,6 +9,8 @@
// except according to those terms.
mod inst {
use option::{None, Option, Some};
#[allow(non_camel_case_types)]
pub type IMPL_T<A> = Option<A>;
@ -25,4 +27,4 @@ mod inst {
Some(_) => Some(1)
}
}
}
}

View File

@ -18,6 +18,8 @@ The iteration traits and common implementation
#[forbid(deprecated_pattern)];
use cmp::{Eq, Ord};
use kinds::Copy;
use option::{None, Option, Some};
use vec;
/// A function used to initialize the elements of a sequence

View File

@ -164,7 +164,7 @@ pub use libc::funcs::posix88::unistd::{getpid, isatty, lseek, pipe, read};
pub use libc::funcs::posix88::unistd::{rmdir, unlink, write};
mod types {
pub mod types {
// Types tend to vary *per architecture* so we pull their definitions out
// into this module.
@ -230,6 +230,8 @@ mod types {
pub type uintptr_t = uint;
}
pub mod posix88 {
use prelude::*;
pub type off_t = i32;
pub type dev_t = u64;
pub type ino_t = u32;
@ -528,33 +530,6 @@ mod types {
pub mod os {
pub mod common {
pub mod posix01 {
pub type nlink_t = u16;
pub type blksize_t = i64;
pub type blkcnt_t = i32;
pub struct stat {
st_dev: dev_t,
st_mode: mode_t,
st_nlink: nlink_t,
st_ino: ino_t,
st_uid: uid_t,
st_gid: gid_t,
st_rdev: dev_t,
st_atime: time_t,
st_atime_nsec: c_long,
st_mtime: time_t,
st_mtime_nsec: c_long,
st_ctime: time_t,
st_ctime_nsec: c_long,
st_birthtime: time_t,
st_birthtime_nsec: c_long,
st_size: off_t,
st_blocks: blkcnt_t,
st_blksize: blksize_t,
st_flags: uint32_t,
st_gen: uint32_t,
st_lspare: int32_t,
st_qspare: [int64_t * 2],
}
}
}
@ -596,6 +571,34 @@ mod types {
pub type ssize_t = i32;
}
pub mod posix01 {
pub type nlink_t = u16;
pub type blksize_t = i64;
pub type blkcnt_t = i32;
pub struct stat {
st_dev: dev_t,
st_mode: mode_t,
st_nlink: nlink_t,
st_ino: ino_t,
st_uid: uid_t,
st_gid: gid_t,
st_rdev: dev_t,
st_atime: time_t,
st_atime_nsec: c_long,
st_mtime: time_t,
st_mtime_nsec: c_long,
st_ctime: time_t,
st_ctime_nsec: c_long,
st_birthtime: time_t,
st_birthtime_nsec: c_long,
st_size: off_t,
st_blocks: blkcnt_t,
st_blksize: blksize_t,
st_flags: uint32_t,
st_gen: uint32_t,
st_lspare: int32_t,
st_qspare: [int64_t * 2],
}
}
pub mod posix08 {
}
@ -643,6 +646,40 @@ mod types {
pub type ssize_t = i64;
}
pub mod posix01 {
use libc::types::common::c99::{int32_t, int64_t};
use libc::types::common::c99::{uint32_t};
use libc::types::os::arch::c95::{c_long, time_t};
use libc::types::os::arch::posix88::{dev_t, gid_t, ino_t};
use libc::types::os::arch::posix88::{mode_t, off_t, uid_t};
pub type nlink_t = u16;
pub type blksize_t = i64;
pub type blkcnt_t = i32;
pub struct stat {
st_dev: dev_t,
st_mode: mode_t,
st_nlink: nlink_t,
st_ino: ino_t,
st_uid: uid_t,
st_gid: gid_t,
st_rdev: dev_t,
st_atime: time_t,
st_atime_nsec: c_long,
st_mtime: time_t,
st_mtime_nsec: c_long,
st_ctime: time_t,
st_ctime_nsec: c_long,
st_birthtime: time_t,
st_birthtime_nsec: c_long,
st_size: off_t,
st_blocks: blkcnt_t,
st_blksize: blksize_t,
st_flags: uint32_t,
st_gen: uint32_t,
st_lspare: int32_t,
st_qspare: [int64_t * 2],
}
}
pub mod posix08 {
}
@ -934,6 +971,11 @@ pub mod funcs {
// or anything. The same is not true of POSIX.
pub mod c95 {
use libc::types::common::c95::{FILE, c_void, fpos_t};
use libc::types::common::posix88::dirent_t;
use libc::types::os::arch::c95::{c_char, c_double, c_int, c_long};
use libc::types::os::arch::c95::{c_uint, c_ulong, c_void, size_t};
#[nolink]
#[abi = "cdecl"]
pub extern mod ctype {
@ -1174,6 +1216,14 @@ pub mod funcs {
#[cfg(target_os = "macos")]
#[cfg(target_os = "freebsd")]
pub mod posix88 {
use libc::types::common::c95::{FILE, c_void};
use libc::types::common::posix88::{DIR, dirent_t};
use libc::types::os::arch::c95::{c_char, c_int, c_long, c_uint};
use libc::types::os::arch::c95::{size_t};
use libc::types::os::arch::posix01::stat;
use libc::types::os::arch::posix88::{gid_t, mode_t, off_t, pid_t};
use libc::types::os::arch::posix88::{ssize_t, uid_t};
#[nolink]
#[abi = "cdecl"]
pub extern mod stat_ {
@ -1282,6 +1332,10 @@ pub mod funcs {
#[cfg(target_os = "macos")]
#[cfg(target_os = "freebsd")]
pub mod posix01 {
use libc::types::os::arch::c95::{c_char, c_int, size_t};
use libc::types::os::arch::posix01::stat;
use libc::types::os::arch::posix88::{pid_t, ssize_t};
#[nolink]
#[abi = "cdecl"]
pub extern mod stat_ {
@ -1349,6 +1403,9 @@ pub mod funcs {
#[nolink]
#[abi = "cdecl"]
pub extern mod bsd44 {
use libc::types::common::c95::{c_void};
use libc::types::os::arch::c95::{c_char, c_int, c_uint, size_t};
fn sysctl(name: *c_int, namelen: c_uint,
oldp: *mut c_void, oldlenp: *mut size_t,
newp: *c_void, newlen: size_t) -> c_int;
@ -1371,6 +1428,8 @@ pub mod funcs {
#[nolink]
#[abi = "cdecl"]
pub extern mod extra {
use libc::types::os::arch::c95::{c_char, c_int};
fn _NSGetExecutablePath(buf: *mut c_char,
bufsize: *mut u32) -> c_int;
}

View File

@ -15,10 +15,12 @@
#[forbid(deprecated_pattern)];
use cmp::{Eq, Ord};
use intrinsic::TyDesc;
use prelude::*;
use ptr;
pub mod raw {
use intrinsic::TyDesc;
pub struct BoxHeaderRepr {
ref_count: uint,
type_desc: *TyDesc,

View File

@ -52,11 +52,13 @@ use either::Either;
use iter;
use libc;
use libc::size_t;
use prelude::*;
use ptr;
use result;
use sys;
use task;
use vec;
// After snapshot, change p2::addr_of => addr_of
/**

View File

@ -45,6 +45,7 @@ let unwrapped_msg = match move msg {
#[forbid(deprecated_pattern)];
use cmp::Eq;
use kinds::Copy;
use option;
use ptr;
use str;

View File

@ -38,6 +38,7 @@ use libc::{c_char, c_void, c_int, c_uint, size_t, ssize_t};
use libc::{mode_t, pid_t, FILE};
use option;
use option::{Some, None};
use prelude::*;
use private;
use ptr;
use str;
@ -144,6 +145,7 @@ mod global_env {
use either;
use libc;
use oldcomm;
use option::Option;
use private;
use str;
use task;
@ -217,6 +219,7 @@ mod global_env {
mod impl_ {
use cast;
use libc;
use option::Option;
use option;
use ptr;
use str;
@ -780,7 +783,7 @@ unsafe fn load_argc_and_argv(argc: c_int, argv: **c_char) -> ~[~str] {
* Returns a list of the command line arguments.
*/
#[cfg(target_os = "macos")]
fn real_args() -> ~[~str] {
pub fn real_args() -> ~[~str] {
unsafe {
let (argc, argv) = (*_NSGetArgc() as c_int,
*_NSGetArgv() as **c_char);
@ -790,7 +793,7 @@ fn real_args() -> ~[~str] {
#[cfg(target_os = "linux")]
#[cfg(target_os = "freebsd")]
fn real_args() -> ~[~str] {
pub fn real_args() -> ~[~str] {
unsafe {
let argc = rustrt::rust_get_argc();
let argv = rustrt::rust_get_argv();
@ -799,7 +802,7 @@ fn real_args() -> ~[~str] {
}
#[cfg(windows)]
fn real_args() -> ~[~str] {
pub fn real_args() -> ~[~str] {
let mut nArgs: c_int = 0;
let lpArgCount = ptr::to_mut_unsafe_ptr(&mut nArgs);
let lpCmdLine = GetCommandLineW();
@ -873,7 +876,7 @@ extern {
pub fn _NSGetArgv() -> ***c_char;
}
mod consts {
pub mod consts {
#[cfg(unix)]
use os::consts::unix::*;
@ -954,9 +957,15 @@ mod consts {
#[cfg(test)]
#[allow(non_implicitly_copyable_typarams)]
mod tests {
use debug;
use libc::{c_int, c_void, size_t};
use libc;
use option::{None, Option, Some};
use option;
use os::{as_c_charp, env, getcwd, getenv, make_absolute, real_args};
use os::{remove_file, setenv};
use os;
use path::Path;
use rand;
use run;
use str;
@ -964,7 +973,7 @@ mod tests {
#[test]
pub fn last_os_error() {
log(debug, last_os_error());
log(debug, os::last_os_error());
}
#[test]

View File

@ -20,8 +20,10 @@ Cross-platform file path handling
use cmp::Eq;
use libc;
use option::{None, Option, Some};
use ptr;
use str;
use to_str::ToStr;
#[deriving_eq]
pub struct WindowsPath {
@ -751,6 +753,8 @@ pub pure fn normalize(components: &[~str]) -> ~[~str] {
// Various windows helpers, and tests for the impl.
pub mod windows {
use libc;
use option::{None, Option, Some};
use to_str::ToStr;
#[inline(always)]
pub pure fn is_sep(u: u8) -> bool {
@ -793,7 +797,8 @@ pub mod windows {
#[cfg(test)]
mod tests {
use path::windows;
use option::{None, Some};
use path::{PosixPath, WindowsPath, windows};
use str;
#[test]

View File

@ -90,11 +90,13 @@ bounded and unbounded protocols allows for less code duplication.
use cmp::Eq;
use cast::{forget, reinterpret_cast, transmute};
use either::{Either, Left, Right};
use kinds::Owned;
use libc;
use option;
use option::unwrap;
use pipes;
use ptr;
use prelude::*;
use private;
use task;
use vec;
@ -1238,6 +1240,8 @@ pub fn try_send_one<T: Owned>(chan: ChanOne<T>, data: T)
}
pub mod rt {
use option::{None, Option, Some};
// These are used to hide the option constructors from the
// compiler because their names are changing
pub fn make_some<T>(val: T) -> Option<T> { Some(move val) }
@ -1246,7 +1250,8 @@ pub mod rt {
#[cfg(test)]
pub mod test {
use pipes::oneshot;
use either::{Either, Left, Right};
use pipes::{Chan, Port, oneshot, recv_one, stream};
use pipes;
#[test]

93
src/libcore/prelude.rs Normal file
View File

@ -0,0 +1,93 @@
// This file is imported into every module by default.
/* Reexported core operators */
pub use kinds::{Const, Copy, Owned, Durable};
pub use ops::{Drop};
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg};
pub use ops::{BitAnd, BitOr, BitXor};
pub use ops::{Shl, Shr, Index};
pub use option::{Option, Some, None};
pub use result::{Result, Ok, Err};
/* Reexported types and traits */
pub use path::Path;
pub use path::GenericPath;
pub use path::WindowsPath;
pub use path::PosixPath;
pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
pub use str::{StrSlice, Trimmable};
pub use vec::{ConstVector, CopyableVector, ImmutableVector};
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
pub use vec::{MutableVector, MutableCopyableVector};
pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
pub use num::Num;
pub use ptr::Ptr;
pub use to_str::ToStr;
pub use clone::Clone;
pub use cmp::{Eq, Ord};
pub use hash::Hash;
pub use to_bytes::IterBytes;
/* Reexported modules */
pub use at_vec;
pub use bool;
pub use cast;
pub use char;
pub use cmp;
pub use dvec;
pub use either;
pub use extfmt;
pub use f32;
pub use f64;
pub use float;
pub use i16;
pub use i32;
pub use i64;
pub use i8;
pub use int;
pub use io;
pub use iter;
pub use libc;
pub use num;
pub use oldcomm;
pub use ops;
pub use option;
pub use os;
pub use path;
pub use pipes;
pub use private;
pub use ptr;
pub use rand;
pub use result;
pub use str;
pub use sys;
pub use task;
pub use to_str;
pub use u16;
pub use u32;
pub use u64;
pub use u8;
pub use uint;
pub use vec;
/*
* Export the log levels as global constants. Higher levels mean
* more-verbosity. Error is the bottom level, default logging level is
* warn-and-below.
*/
/// The error log level
pub const error : u32 = 1_u32;
/// The warning log level
pub const warn : u32 = 2_u32;
/// The info log level
pub const info : u32 = 3_u32;
/// The debug log level
pub const debug : u32 = 4_u32;

View File

@ -21,6 +21,7 @@ use libc;
use oldcomm;
use option;
use pipes;
use prelude::*;
use ptr;
use result;
use task;
@ -580,8 +581,11 @@ pub fn unwrap_exclusive<T: Owned>(arc: Exclusive<T>) -> T {
#[cfg(test)]
pub mod tests {
use core::option::{None, Some};
use option;
use pipes;
use private::{exclusive, unwrap_exclusive};
use result;
use task;
use uint;

View File

@ -15,6 +15,7 @@
#[forbid(deprecated_pattern)];
use int;
use prelude::*;
use str;
use task;
use u32;
@ -362,7 +363,8 @@ pub fn random() -> uint {
#[cfg(test)]
pub mod tests {
use option::Option;
use debug;
use option::{None, Option, Some};
use rand;
#[test]

View File

@ -19,6 +19,8 @@ use cmp;
use cmp::Eq;
use either;
use either::Either;
use kinds::Copy;
use option::{None, Option, Some};
use vec;
/// The result type
@ -382,6 +384,7 @@ pub pure fn unwrap_err<T, U>(res: Result<T, U>) -> U {
mod tests {
#[legacy_exports];
use result::{Err, Ok, Result, chain, get, get_err};
use result;
fn op1() -> result::Result<int, ~str> { result::Ok(666) }

View File

@ -20,6 +20,7 @@ use libc::{pid_t, c_void, c_int};
use oldcomm;
use option::{Some, None};
use os;
use prelude::*;
use ptr;
use run;
use str;
@ -349,7 +350,7 @@ pub fn program_output(prog: &str, args: &[~str]) ->
return {status: status, out: move outs, err: move errs};
}
fn writeclose(fd: c_int, s: ~str) {
pub fn writeclose(fd: c_int, s: ~str) {
use io::WriterUtil;
error!("writeclose %d, %s", fd as int, s);
@ -359,7 +360,7 @@ fn writeclose(fd: c_int, s: ~str) {
os::close(fd);
}
fn readclose(fd: c_int) -> ~str {
pub fn readclose(fd: c_int) -> ~str {
let file = os::fdopen(fd);
let reader = io::FILE_reader(file, false);
let buf = io::with_bytes_writer(|writer| {
@ -417,8 +418,11 @@ pub fn waitpid(pid: pid_t) -> int {
#[cfg(test)]
mod tests {
use debug;
use io::WriterUtil;
use option::{None, Some};
use os;
use run::{readclose, writeclose};
use run;
// Regression test for memory leaks

View File

@ -20,6 +20,7 @@ Sendable hash maps. Very much a work in progress.
use cmp::Eq;
use hash::Hash;
use prelude::*;
use to_bytes::IterBytes;
pub trait SendMap<K:Eq Hash, V: Copy> {
@ -45,9 +46,14 @@ pub trait SendMap<K:Eq Hash, V: Copy> {
/// Open addressing with linear probing.
pub mod linear {
use cmp::Eq;
use cmp;
use hash::Hash;
use kinds::Copy;
use option::{None, Option, Some};
use option;
use rand;
use to_bytes::IterBytes;
use uint;
use vec;
@ -458,6 +464,7 @@ pub mod linear {
#[test]
pub mod test {
use option::{None, Some};
use send_map::linear::LinearMap;
use send_map::linear;
use uint;

View File

@ -27,6 +27,7 @@ use cmp::{Eq, Ord};
use libc;
use libc::size_t;
use io::WriterUtil;
use option::{None, Option, Some};
use ptr;
use str;
use to_str::ToStr;
@ -1949,6 +1950,7 @@ pub mod raw {
use libc;
use ptr;
use str::raw;
use str::{as_buf, is_utf8, len, reserve_at_least};
use vec;
/// Create a Rust string from a null-terminated *u8 buffer
@ -2129,6 +2131,9 @@ impl ~str: Trimmable {
#[cfg(notest)]
pub mod traits {
use ops::Add;
use str::append;
impl ~str : Add<&str,~str> {
#[inline(always)]
pure fn add(&self, rhs: & &self/str) -> ~str {
@ -2308,10 +2313,11 @@ impl &str: StrSlice {
#[cfg(test)]
mod tests {
use char;
use debug;
use libc::c_char;
use libc;
use ptr;
use str::raw;
use str::*;
use vec;
#[test]

View File

@ -146,6 +146,7 @@ pub pure fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! {
#[cfg(test)]
pub mod tests {
use cast;
use sys::{Closure, pref_align_of, size_of};
#[test]
pub fn size_of_basic() {

View File

@ -26,6 +26,7 @@ magic.
*/
use prelude::*;
use rt;
use task::local_data_priv::{local_get, local_pop, local_modify, local_set};
use task;

View File

@ -11,9 +11,11 @@
#[doc(hidden)]; // FIXME #3538
use cast;
use cmp::Eq;
use dvec;
use libc;
use option;
use prelude::*;
use task::rt;
use task::local_data::LocalDataKey;

View File

@ -48,6 +48,7 @@ use option;
use result::Result;
use pipes::{stream, Chan, Port};
use pipes;
use prelude::*;
use ptr;
use result;
use task::local_data_priv::{local_get, local_set};

View File

@ -76,13 +76,19 @@
use cast;
use oldcomm;
use option;
use pipes::{Chan, Port};
use pipes;
use prelude::*;
use private;
use ptr;
use send_map;
use task::rt;
use task::local_data_priv::{local_get, local_set};
use task::rt::rust_task;
use task::rt::rust_closure;
use task::rt;
use task::{Failure, ManualThreads, PlatformThread, SchedOpts, SingleThreaded};
use task::{Success, TaskOpts, TaskResult, ThreadPerCore, ThreadPerTask};
use task::{default_task_opts, unkillable};
use uint;
use util;

View File

@ -20,6 +20,7 @@ The `ToBytes` and `IterBytes` traits
use io;
use io::Writer;
use option::{None, Option, Some};
use str;
pub type Cb = fn(buf: &[const u8]) -> bool;
@ -181,6 +182,8 @@ pub mod x32 {
#[cfg(target_word_size = "64")]
pub mod x64 {
use to_bytes::{Cb, IterBytes};
pub impl uint: IterBytes {
#[inline(always)]
pure fn iter_bytes(&self, lsb0: bool, f: Cb) {

View File

@ -18,6 +18,7 @@ The `ToStr` trait for converting to strings
#[forbid(deprecated_mode)];
#[forbid(deprecated_pattern)];
use kinds::Copy;
use str;
use vec;

View File

@ -15,6 +15,7 @@
//! Operations on tuples
use cmp::{Eq, Ord};
use kinds::Copy;
use vec;
pub trait CopyableTuple<T, U> {

View File

@ -19,6 +19,7 @@ use cmp::{Eq, Ord};
use from_str::FromStr;
use iter;
use num;
use option::{None, Option, Some};
use str;
use uint;
use vec;

View File

@ -19,6 +19,7 @@ Miscellaneous helpers for common patterns.
#[forbid(deprecated_pattern)];
use cmp::Eq;
use prelude::*;
/// The identity function.
#[inline(always)]
@ -104,6 +105,10 @@ pub fn unreachable() -> ! {
mod tests {
#[legacy_exports];
use option::{None, Some};
use util::{NonCopyable, id, replace, swap};
#[test]
fn identity_crisis() {
// Writing a test for the identity function. How did it come to this?

View File

@ -16,10 +16,12 @@
use cast;
use cmp::{Eq, Ord};
use iter::BaseIter;
use iter;
use kinds::Copy;
use libc;
use libc::size_t;
use option::{Some, None};
use option::{None, Option, Some};
use ptr;
use ptr::addr_of;
use sys;
@ -673,7 +675,7 @@ pub pure fn append_one<T>(lhs: ~[T], x: T) -> ~[T] {
}
#[inline(always)]
pure fn append_mut<T: Copy>(lhs: ~[mut T], rhs: &[const T]) -> ~[mut T] {
pub pure fn append_mut<T: Copy>(lhs: ~[mut T], rhs: &[const T]) -> ~[mut T] {
to_mut(append(from_mut(lhs), rhs))
}
@ -1517,6 +1519,10 @@ impl<T: Ord> @[T] : Ord {
#[cfg(notest)]
pub mod traits {
use kinds::Copy;
use ops::Add;
use vec::{append, append_mut};
impl<T: Copy> ~[T] : Add<&[const T],~[T]> {
#[inline(always)]
pure fn add(&self, rhs: & &self/[const T]) -> ~[T] {
@ -1839,10 +1845,14 @@ pub struct UnboxedVecRepr {
/// Unsafe operations
pub mod raw {
use kinds::Copy;
use managed;
use option::{None, Some};
use option;
use ptr::addr_of;
use ptr;
use sys;
use vec::{UnboxedVecRepr, as_const_buf, as_mut_buf, len, with_capacity};
use vec::rusti;
/// The internal representation of a (boxed) vector
@ -1992,8 +2002,9 @@ pub mod raw {
pub mod bytes {
use libc;
use uint;
use vec;
use vec::len;
use vec::raw;
use vec;
/// Bytewise string comparison
pub pure fn cmp(a: &~[u8], b: &~[u8]) -> int {
@ -2280,8 +2291,9 @@ impl<A:Copy> @[A] : iter::CopyableNonstrictIter<A> {
#[cfg(test)]
mod tests {
use option::{None, Option, Some};
use option;
use vec::raw;
use vec::*;
fn square(n: uint) -> uint { return n * n; }

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use back::rpath;
use driver::session;
@ -29,6 +30,7 @@ use core::cmp;
use core::hash;
use core::io::{Writer, WriterUtil};
use core::libc::{c_int, c_uint, c_char};
use core::os::consts::{macos, freebsd, linux, win32};
use core::os;
use core::ptr;
use core::run;
@ -41,9 +43,7 @@ use syntax::ast_map::{path, path_mod, path_name};
use syntax::attr;
use syntax::print::pprust;
use core::os::consts::{macos, freebsd, linux, win32};
enum output_type {
pub enum output_type {
output_type_none,
output_type_bitcode,
output_type_assembly,
@ -59,7 +59,7 @@ impl output_type : cmp::Eq {
pure fn ne(&self, other: &output_type) -> bool { !(*self).eq(other) }
}
fn llvm_err(sess: Session, +msg: ~str) -> ! unsafe {
pub fn llvm_err(sess: Session, +msg: ~str) -> ! unsafe {
let cstr = llvm::LLVMRustGetLastError();
if cstr == ptr::null() {
sess.fatal(msg);
@ -68,7 +68,7 @@ fn llvm_err(sess: Session, +msg: ~str) -> ! unsafe {
}
}
fn WriteOutputFile(sess: Session,
pub fn WriteOutputFile(sess: Session,
PM: lib::llvm::PassManagerRef, M: ModuleRef,
Triple: *c_char,
// FIXME: When #2334 is fixed, change
@ -86,10 +86,14 @@ fn WriteOutputFile(sess: Session,
pub mod jit {
#[legacy_exports];
use back::link::llvm_err;
use lib::llvm::llvm;
use lib::llvm::{ModuleRef, PassManagerRef, mk_target_data};
use metadata::cstore;
use session::Session;
use core::cast;
use core::libc::c_int;
use core::ptr;
use core::str;
@ -161,11 +165,19 @@ mod write {
#[legacy_exports];
use back::link::jit;
use back::link::{ModuleRef, WriteOutputFile, output_type};
use back::link::{output_type_assembly, output_type_bitcode};
use back::link::{output_type_exe, output_type_llvm_assembly};
use back::link::{output_type_object};
use driver::session;
use lib::llvm::llvm;
use lib::llvm::{False, True, mk_pass_manager, mk_target_data};
use lib;
use session::Session;
use core::char;
use core::libc::{c_char, c_int, c_uint};
use core::path::Path;
use core::str;
use core::vec;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use driver::session;
use metadata::cstore;
@ -20,7 +21,13 @@ use core::vec;
use std::map::HashMap;
use std::map;
export get_absolute_rpath;
export get_install_prefix_rpath;
export get_relative_to;
export get_rpath_flags;
export get_rpath_relative_to_output;
export minimize_rpaths;
export rpaths_to_flags;
pure fn not_win32(os: session::os) -> bool {
match os {
@ -202,6 +209,11 @@ fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] {
mod test {
#[legacy_exports];
use core::prelude::*;
use back::rpath::{get_absolute_rpath, get_install_prefix_rpath};
use back::rpath::{get_relative_to, get_rpath_relative_to_output};
use back::rpath::{minimize_rpaths, rpaths_to_flags};
use driver::session;
use core::os;

View File

@ -9,6 +9,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use back::link;
use back::{x86, x86_64};
@ -830,7 +831,13 @@ fn list_metadata(sess: Session, path: &Path, out: io::Writer) {
mod test {
#[legacy_exports];
use core::prelude::*;
use driver::driver::{build_configuration, build_session};
use driver::driver::{build_session_options, optgroups, str_input};
use core::vec;
use std::getopts::groups::getopts;
use std::getopts;
use syntax::attr;
use syntax::diagnostic;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use back::link;
use back::target_strs;
@ -333,6 +334,12 @@ fn sess_os_to_meta_os(os: os) -> metadata::loader::os {
#[cfg(test)]
mod test {
#[legacy_exports];
use core::prelude::*;
use driver::session::{bin_crate, building_library, lib_crate};
use driver::session::{unknown_crate};
use syntax::ast;
use syntax::ast_util;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use syntax::{ast, fold, attr};

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use driver::session::Session;
@ -75,10 +76,18 @@ fn inject_libcore_ref(sess: Session,
fold_mod: |module, fld| {
let n2 = sess.next_node_id();
let vp = @spanned(
ast::view_path_glob(ident_to_path(dummy_sp(),
sess.ident_of(~"core")),
n2));
let prelude_path = @{
span: dummy_sp(),
global: false,
idents: ~[
sess.ident_of(~"core"),
sess.ident_of(~"prelude")
],
rp: None,
types: ~[]
};
let vp = @spanned(ast::view_path_glob(prelude_path, n2));
let vi2 = @{node: ast::view_item_import(~[vp]),
attrs: ~[],
vis: ast::private,

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use driver::session::Session;
use syntax::parse;

View File

@ -10,6 +10,7 @@
// Code that generates a test runner to run all the tests in a crate
use core::prelude::*;
use driver::session;
use front::config;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use core::cast;
use core::cmp;

View File

@ -11,6 +11,8 @@
//! Validates all used crates and extern libraries and loads their metadata
use core::prelude::*;
use metadata::cstore;
use metadata::common::*;
use metadata::decoder;

View File

@ -11,6 +11,8 @@
// Searching for information from the cstore
use core::prelude::*;
use metadata::common::*;
use metadata::cstore;
use metadata::decoder;

View File

@ -12,6 +12,8 @@
// The crate store - a central repo for information collected about external
// crates and libraries
use core::prelude::*;
use metadata::creader;
use metadata::cstore;
use metadata::decoder;

View File

@ -11,6 +11,8 @@
// Decoding metadata from a single crate's metadata
use core::prelude::*;
use cmd = metadata::cstore::crate_metadata;
use dvec::DVec;
use hash::{Hash, HashUtil};

View File

@ -11,6 +11,8 @@
// Metadata encoding
use core::prelude::*;
use metadata::common::*;
use metadata::csearch;
use metadata::cstore;

View File

@ -13,6 +13,8 @@
// FIXME (#2658): I'm not happy how this module turned out. Should
// probably just be folded into cstore.
use core::prelude::*;
use core::option;
use core::os;
use core::result::Result;

View File

@ -11,6 +11,8 @@
//! Finds crate binaries and loads their metadata
use core::prelude::*;
use lib::llvm::{False, llvm, mk_object_file, mk_section_iter};
use metadata::decoder;
use metadata::encoder;
@ -26,14 +28,13 @@ use core::cast;
use core::flate;
use core::io::WriterUtil;
use core::io;
use core::os::consts::{macos, freebsd, linux, win32};
use core::option;
use core::ptr;
use core::str;
use core::uint;
use core::vec;
use core::os::consts::{macos, freebsd, linux, win32};
export os;
export os_macos, os_win32, os_linux, os_freebsd;
export ctxt;

View File

@ -14,6 +14,8 @@
// tjc note: Would be great to have a `match check` macro equivalent
// for some of these
use core::prelude::*;
use middle::ty;
use middle::ty::{FnTyBase, FnMeta, FnSig};

View File

@ -11,6 +11,8 @@
// Type encoding
use core::prelude::*;
use middle::ty;
use middle::ty::vid;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use c = metadata::common;
use cstore = metadata::cstore;

View File

@ -15,18 +15,29 @@
// 1. assignments are always made to mutable locations;
// 2. loans made in overlapping scopes do not conflict
// 3. assignments do not affect things loaned out as immutable
// 4. moves to dnot affect things loaned out in any way
// 4. moves do not affect things loaned out in any way
use core::prelude::*;
use middle::borrowck::{Loan, bckerr, borrowck_ctxt, cmt, inherent_mutability};
use middle::borrowck::{req_maps, save_and_restore};
use middle::mem_categorization::{cat_arg, cat_binding, cat_deref, cat_local};
use middle::mem_categorization::{cat_rvalue, cat_special};
use middle::mem_categorization::{loan_path, lp_arg, lp_comp, lp_deref};
use middle::mem_categorization::{lp_local};
use middle::ty::{CopyValue, MoveValue, ReadValue};
use middle::ty;
use util::ppaux::ty_to_str;
use core::cmp;
use core::dvec::DVec;
use core::uint;
use core::vec;
use std::map::HashMap;
use syntax::ast::{m_const, m_imm, m_mutbl};
use syntax::ast;
use syntax::ast_util;
use syntax::codemap::span;
use syntax::print::pprust;
use syntax::visit;

View File

@ -16,17 +16,26 @@
// their associated scopes. In phase two, checking loans, we will then make
// sure that all of these loans are honored.
use core::prelude::*;
use middle::borrowck::preserve::{preserve_condition, pc_ok, pc_if_pure};
use middle::mem_categorization::{mem_categorization_ctxt, opt_deref_kind};
use middle::borrowck::{Loan, bckres, borrowck_ctxt, err_mutbl, req_maps};
use middle::mem_categorization::{cat_binding, cat_discr, cmt, comp_variant};
use middle::mem_categorization::{mem_categorization_ctxt};
use middle::mem_categorization::{opt_deref_kind};
use middle::pat_util;
use middle::ty::{ty_region};
use middle::ty;
use util::common::indenter;
use util::ppaux::{expr_repr, region_to_str};
use core::dvec;
use core::send_map::linear::LinearMap;
use core::vec;
use std::map::HashMap;
use syntax::ast::{m_const, m_imm, m_mutbl};
use syntax::ast;
use syntax::codemap::span;
use syntax::print::pprust;
use syntax::visit;

View File

@ -12,10 +12,19 @@
// Loan(Ex, M, S) = Ls holds if ToAddr(Ex) will remain valid for the entirety
// of the scope S, presuming that the returned set of loans `Ls` are honored.
use core::prelude::*;
use middle::borrowck::{Loan, bckres, borrowck_ctxt, cmt, err_mutbl};
use middle::borrowck::{err_out_of_scope};
use middle::mem_categorization::{cat_arg, cat_binding, cat_discr, cat_comp};
use middle::mem_categorization::{cat_deref, cat_discr, cat_local};
use middle::mem_categorization::{cat_special, cat_stack_upvar, comp_field};
use middle::mem_categorization::{comp_index, comp_variant, region_ptr};
use middle::ty;
use util::common::indenter;
use core::result::{Result, Ok, Err};
use core::result::{Err, Ok, Result};
use syntax::ast::{m_const, m_imm, m_mutbl};
use syntax::ast;
export public_methods;

View File

@ -226,6 +226,8 @@ Borrowck results in two maps.
#[legacy_exports];
use core::prelude::*;
use middle::liveness;
use middle::mem_categorization::*;
use middle::region;
@ -259,9 +261,6 @@ pub mod loan;
#[legacy_exports]
pub mod preserve;
export check_crate, root_map, mutbl_map;
export check_loans, gather_loans, loan, preserve;
fn check_crate(tcx: ty::ctxt,
method_map: typeck::method_map,
last_use_map: liveness::last_use_map,
@ -410,7 +409,7 @@ impl bckerr : cmp::Eq {
type bckres<T> = Result<T, bckerr>;
/// a complete record of a loan that was granted
struct Loan {lp: @loan_path, cmt: cmt, mutbl: ast::mutability}
pub struct Loan {lp: @loan_path, cmt: cmt, mutbl: ast::mutability}
/// maps computed by `gather_loans` that are then used by `check_loans`
///
@ -418,7 +417,7 @@ struct Loan {lp: @loan_path, cmt: cmt, mutbl: ast::mutability}
/// for the duration of that block/expr
/// - `pure_map`: map from block/expr that must be pure to the error message
/// that should be reported if they are not pure
type req_maps = {
pub type req_maps = {
req_loan_map: HashMap<ast::node_id, @DVec<Loan>>,
pure_map: HashMap<ast::node_id, bckerr>
};

View File

@ -13,9 +13,19 @@
// the scope S.
//
use core::prelude::*;
use middle::borrowck::{bckerr, bckerr_code, bckres, borrowck_ctxt, cmt};
use middle::borrowck::{err_mut_uniq, err_mut_variant, err_out_of_root_scope};
use middle::borrowck::{err_out_of_scope, err_root_not_permitted};
use middle::mem_categorization::{cat_arg, cat_binding, cat_comp, cat_deref};
use middle::mem_categorization::{cat_discr, cat_local, cat_special};
use middle::mem_categorization::{cat_stack_upvar, comp_field, comp_index};
use middle::mem_categorization::{comp_variant, region_ptr};
use middle::ty;
use util::common::indenter;
use syntax::ast::{m_const, m_imm, m_mutbl};
use syntax::ast;
export public_methods, preserve_condition, pc_ok, pc_if_pure;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use middle::freevars;
use middle::ty;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use driver::session::Session;
use middle::resolve;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use middle::const_eval::{compare_const_vals, lookup_const_by_id};
use middle::const_eval::{eval_const_expr, const_val, const_int, const_bool};

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use middle::resolve;
use middle::ty;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use middle::freevars::freevar_entry;
use middle::freevars;

View File

@ -20,6 +20,8 @@
//
// * Functions called by the compiler itself.
use core::prelude::*;
use driver::session::Session;
use metadata::csearch::{each_lang_item, get_item_attrs};
use metadata::cstore::{iter_crate_data};

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use driver::session::Session;
use driver::session;

View File

@ -103,6 +103,8 @@
* to return explicitly.
*/
use core::prelude::*;
use middle::capture::{cap_move, cap_drop, cap_copy, cap_ref};
use middle::capture;
use middle::pat_util;

View File

@ -47,6 +47,8 @@
* then an index to jump forward to the relevant item.
*/
use core::prelude::*;
use middle::ty;
use middle::typeck;
use util::ppaux::{ty_to_str, region_to_str};
@ -136,7 +138,7 @@ impl categorization : cmp::Eq {
}
// different kinds of pointers:
enum ptr_kind {
pub enum ptr_kind {
uniq_ptr,
gc_ptr,
region_ptr(ty::Region),
@ -177,7 +179,7 @@ impl ptr_kind : cmp::Eq {
// I am coining the term "components" to mean "pieces of a data
// structure accessible without a dereference":
enum comp_kind {
pub enum comp_kind {
comp_tuple, // elt in a tuple
comp_anon_field, // anonymous field (in e.g.
// struct Foo(int, int);
@ -269,7 +271,7 @@ impl cmt_ : cmp::Eq {
// a loan path is like a category, but it exists only when the data is
// interior to the stack frame. loan paths are used as the key to a
// map indicating what is borrowed at any point in time.
enum loan_path {
pub enum loan_path {
lp_local(ast::node_id),
lp_arg(ast::node_id),
lp_deref(@loan_path, ptr_kind),

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use middle::pat_util;
use middle::ty;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use middle::resolve;
use middle::ty::{CopyValue, MoveValue, ReadValue};

View File

@ -12,6 +12,8 @@
// A pass that checks to make sure private fields and methods aren't used
// outside their scopes.
use core::prelude::*;
use middle::ty::{ty_struct, ty_enum};
use middle::ty;
use middle::typeck::{method_map, method_origin, method_param, method_self};

View File

@ -17,6 +17,7 @@ region parameterized.
*/
use core::prelude::*;
use driver::session::Session;
use metadata::csearch;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use driver::session::Session;
use metadata::csearch::{each_path, get_method_names_if_trait};
@ -3075,77 +3076,6 @@ impl Resolver {
self.module_to_str(containing_module));
return Success(PrefixFound(containing_module, i));
/*
// If we reached the end, return the containing module.
if i == module_path.len() {
return ModulePrefixResult {
result: Success(containing_module),
prefix_len: i
};
}
// Is the containing module the current module? If so, we allow
// globs to be unresolved.
let allow_globs = core::managed::ptr_eq(containing_module, module_);
let name = module_path.get_elt(i);
i += 1;
let resolve_result = self.resolve_name_in_module(containing_module,
name,
TypeNS,
Xray,
allow_globs);
match resolve_result {
Success(target) => {
match target.bindings.type_def {
Some(ref type_def) => {
match (*type_def).module_def {
None => {
error!("!!! (resolving crate-relative \
module) module wasn't actually a \
module!");
return ModulePrefixResult {
result: Failed,
prefix_len: i
};
}
Some(module_def) => {
return ModulePrefixResult {
result: Success(module_def),
prefix_len: i
};
}
}
}
None => {
error!("!!! (resolving crate-relative module) module
wasn't actually a module!");
return ModulePrefixResult {
result: Failed,
prefix_len: i
};
}
}
}
Indeterminate => {
debug!("(resolving crate-relative module) indeterminate; \
bailing");
return ModulePrefixResult {
result: Indeterminate,
prefix_len: i
};
}
Failed => {
debug!("(resolving crate-relative module) failed to resolve");
return ModulePrefixResult {
result: Failed,
prefix_len: i
};
}
}
*/
}
fn name_is_exported(module_: @Module, name: ident) -> bool {
@ -3165,7 +3095,6 @@ impl Resolver {
xray: XrayFlag,
allow_globs: bool)
-> ResolveResult<Target> {
debug!("(resolving name in module) resolving `%s` in `%s`",
self.session.str_of(name),
self.module_to_str(module_));
@ -4818,7 +4747,7 @@ impl Resolver {
}
return self.resolve_item_by_identifier_in_lexical_scope(identifier,
namespace);
namespace);
}
// XXX: Merge me with resolve_name_in_module?
@ -5035,7 +4964,7 @@ impl Resolver {
match self.resolve_item_in_lexical_scope(self.current_module,
ident,
namespace,
SearchThroughModules) {
DontSearchThroughModules) {
Success(target) => {
match (*target.bindings).def_for_namespace(namespace) {
None => {

View File

@ -142,6 +142,7 @@
*
*/
use core::prelude::*;
use back::abi;
use lib::llvm::llvm;

View File

@ -23,6 +23,7 @@
// but many TypeRefs correspond to one ty::t; for instance, tup(int, int,
// int) and rec(x=int, y=int, z=int) will have the same TypeRef.
use core::prelude::*;
use back::link::{mangle_exported_name};
use back::link::{mangle_internal_name_by_path_and_seq};

View File

@ -16,6 +16,7 @@
// and methods are represented as just a fn ptr and not a full
// closure.
use core::prelude::*;
use lib::llvm::ValueRef;
use middle::trans::base::{get_item_val, trans_external_path};

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use back::abi;
use back::link::{mangle_internal_name_by_path_and_seq};

View File

@ -14,6 +14,8 @@
*/
use core::prelude::*;
use back::{link, abi, upcall};
use driver::session;
use driver::session::Session;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use middle::const_eval;
use middle::trans::base::get_insn_ctxt;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use lib::llvm::ValueRef;
use middle::trans::base::*;

View File

@ -95,6 +95,7 @@
* methods themselves. Most are only suitable for some types of
* values. */
use core::prelude::*;
use lib::llvm::ValueRef;
use middle::trans::base::*;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use driver::session;
use lib::llvm::ValueRef;

Some files were not shown because too many files have changed in this diff Show More