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,
#[cfg(test)]
mod std {
extern mod std(vers = "0.5");
- pub use std::test;
+ pub use std::std::test;
}
#[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;
//! 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;
assert (min_value <= 0);
assert (min_value + max_value + 1 == 0);
}
-}
\ No newline at end of file
+}
#[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<A> IMPL_T<A>: iter::BaseIter<A> {
pure fn each(blk: fn(v: &A) -> bool) { EACH(&self, blk) }
// 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 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 funcs::c95::ctype::*;
-pub use funcs::c95::stdio::*;
-pub use funcs::c95::stdlib::*;
-pub use 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 funcs::posix01::stat_::*;
-pub use funcs::posix01::unistd::*;
-pub use funcs::posix08::unistd::*;
-
-pub use funcs::bsd44::*;
-pub use funcs::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 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 libc::funcs::c95::ctype::*;
+pub use libc::funcs::c95::stdio::*;
+pub use libc::funcs::c95::stdlib::*;
+pub use libc::funcs::c95::string::*;
+
+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 libc::funcs::posix01::stat_::*;
+pub use libc::funcs::posix01::unistd::*;
+pub use libc::funcs::posix08::unistd::*;
+
+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 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 isalnum, isalpha, iscntrl, isdigit, islower, isprint, ispunct,
-isspace, 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 abs, labs, atof, atoi, strtod, strtol, strtoul, calloc, malloc,
-realloc, free, abort, exit, system, getenv, rand, srand;
-
-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 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::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 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 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 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 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 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 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 {
#[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,
#[nolink]
pub extern mod msvcrt {
#[link_name = "_commit"]
- fn commit(fd: c_int) -> c_int;
+ pub fn commit(fd: c_int) -> c_int;
}
}
}
-// 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.
//
use option::{Some, None};
-pub use consts::*;
+pub use os::consts::*;
use task::TaskBuilder;
// FIXME: move these to str perhaps? #2620
}
#[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> {
#[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)
#[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);
#[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)
}
#[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 {
#[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)
};
#[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)
};
#[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)) !=
#[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)
};
#[test]
pub mod test {
- use linear::LinearMap;
+ use send_map::linear::LinearMap;
#[test]
pub fn inserts() {
*/
-use local_data_priv::{
+use task::local_data_priv::{
local_pop,
local_get,
local_set,
#[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: Owned> @T: LocalData { }
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;
#[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 } )
#[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) }
#[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;
//! 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;
//! 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;
assert(uint::div_ceil(3u, 4u) == 1u);
assert(uint::div_round(3u, 4u) == 1u);
}
-}
\ No newline at end of file
+}
// except according to those terms.
-use syntax::{ast, codemap};
+use back::link;
+use back::target_strs;
+use metadata::filesearch;
+use middle::lint;
+
use syntax::ast::node_id;
-use codemap::span;
use syntax::ast::{int_ty, uint_ty, float_ty};
+use syntax::codemap::span;
use syntax::parse::parse_sess;
-use metadata::filesearch;
-use back::target_strs;
-use back::link;
-use middle::lint;
+use syntax::{ast, codemap};
enum os { os_win32, os_macos, os_linux, os_freebsd, }
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.
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;
// Searching for information from the cstore
-use std::ebml;
+use metadata::common::*;
+use middle::ty;
+
+use core::dvec::DVec;
+use core::option::{Some, None};
use reader = std::ebml::reader;
+use std::ebml;
+use std::map::HashMap;
use syntax::ast;
-use syntax::ast_util;
use syntax::ast_map;
-use middle::ty;
-use option::{Some, None};
-use syntax::diagnostic::span_handler;
+use syntax::ast_util::dummy_sp;
+use syntax::ast_util;
use syntax::diagnostic::expect;
-use ast_util::dummy_sp;
-use common::*;
-use std::map::HashMap;
-use dvec::DVec;
+use syntax::diagnostic::span_handler;
export struct_dtor;
export get_symbol;
// Decoding metadata from a single crate's metadata
+use cmd = metadata::cstore::crate_metadata;
+use dvec::DVec;
+use hash::{Hash, HashUtil};
+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;
use std::map::HashMap;
+use std::map;
use std::serialization::deserialize;
-use reader = ebml::reader;
-use io::WriterUtil;
-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::attr;
use syntax::diagnostic::span_handler;
-use common::*;
use syntax::parse::token::ident_interner;
-use hash::{Hash, HashUtil};
-use csearch::{ProvidedTraitMethodInfo, StaticMethodInfo};
+use syntax::print::pprust;
+use syntax::{ast, ast_util};
export struct_dtor;
export get_struct_fields;
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;
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;
#[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;
-}
// 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;
// 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;
// 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;
#[legacy_exports];
-use syntax::ast;
+use middle::mem_categorization::*;
+use middle::ty::to_str;
+use util::common::indenter;
+use util::ppaux::{expr_repr, note_and_explain_region};
+use util::ppaux::{ty_to_str, region_to_str, explain_region};
+
+use core::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::visit;
-use syntax::ast_util;
+use syntax::ast;
use syntax::ast_map;
+use syntax::ast_util;
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 util::common::indenter;
-use ty::to_str;
-use dvec::DVec;
-use mem_categorization::*;
+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,
// 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,
// 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.
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use syntax::{visit, ast_util};
-use syntax::ast::*;
-use syntax::codemap::span;
-use middle::ty::{Kind, kind_copyable, kind_noncopyable, kind_const};
+use middle::freevars::freevar_entry;
+use middle::lint::{non_implicitly_copyable_typarams, implicit_copies};
use middle::ty::{CopyValue, MoveValue, ReadValue};
-use std::map::HashMap;
+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 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.
//
* to return explicitly.
*/
-use dvec::DVec;
+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::{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::ty::MoveValue;
+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;
// 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;
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;
*/
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<ast::node_id>;
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)
} 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;
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;
}
/**
- * 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<ident>,
xray: XrayFlag,
+ use_lexical_scope: UseLexicalScopeFlag,
span: span)
-> ResolveResult<@Module> {
// 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;
}
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,
}
// 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.
}
}
}
+ /** 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) => {
}
}
+ /**
+ * 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<ident>)
+ -> 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 ||
fn resolve_name_in_module(module_: @Module,
name: ident,
namespace: Namespace,
- xray: XrayFlag)
+ xray: XrayFlag,
+ allow_globs: bool)
-> ResolveResult<Target> {
debug!("(resolving name in module) resolving `%s` in `%s`",
}
}
- // 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;
}
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`",
*
*/
+use back::abi;
use lib::llvm::llvm;
use lib::llvm::{ValueRef, BasicBlockRef};
-use pat_util::*;
-use build::*;
-use base::*;
+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;
use syntax::ast_util::{dummy_sp, path_to_ident};
-use syntax::ast::def_id;
+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.
// 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 core::libc::{c_uint, c_ulonglong};
+use core::option::{is_none, is_some};
+use std::map::HashMap;
+use std::smallintmap;
+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 std::smallintmap;
-use option::{is_none, is_some};
+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,
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);
// 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;
// closure.
use lib::llvm::ValueRef;
+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 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 util::common::indenter;
+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
// 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 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 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 syntax::ast_map::{path, path_mod, path_name};
-use driver::session::session;
+
+use core::libc::c_uint;
use std::map::HashMap;
-use datum::{Datum, INIT, ByRef, ByValue, FromLvalue};
+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;
// ___Good to know (tm)__________________________________________________
//
// 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 {
// 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.
* 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,
// 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;
*/
-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;
// 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 back::{link, abi};
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 core::libc::c_uint;
+use std::map::HashMap;
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 util::ppaux::ty_to_str;
-use datum::*;
-use callee::*;
-use expr::{Dest, Ignore};
-use ty::{FnTyBase, FnMeta, FnSig};
+use syntax::{attr, ast_map};
export link_name, trans_foreign_mod, register_foreign_fn, trans_foreign_fn,
trans_intrinsic;
// 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");
// 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
// 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.
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use common::*;
+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_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::ast_util::local_def;
use syntax::parse::token::special_idents;
-use type_of::type_of_fn_from_ty;
-use back::link::mangle_exported_name;
-use middle::ty::{FnTyBase, FnMeta, FnSig};
fn monomorphic_fn(ccx: @crate_ctxt,
fn_id: ast::def_id,
// 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,
// 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 syntax::ast;
-use syntax::ast_util::dummy_sp;
-use syntax::util::interner;
+use middle::ty;
use util::ppaux::ty_to_str;
-use syntax::codemap::span;
-use dvec::DVec;
+use core::dvec::DVec;
+use core::option::is_some;
use std::map::HashMap;
-use option::is_some;
+use syntax::ast;
+use syntax::ast_util::dummy_sp;
+use syntax::codemap::span;
+use syntax::util::interner;
use ty_ctxt = middle::ty::ctxt;
// 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 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 expr::{Dest, SaveIn, Ignore};
-use datum::*;
+
+use syntax::ast;
+use syntax::codemap::span;
use syntax::print::pprust::{expr_to_str};
-use util::common::indenter;
// 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
// 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;
// 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
// 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;
* 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;
{substs: substs, ty: ty::subst(tcx, &substs, decl_ty)}
}
-fn ast_path_to_ty<AC: ast_conv, RS: region_scope Copy Owned>(
+pub fn ast_path_to_ty<AC: ast_conv, RS: region_scope Copy Owned>(
self: AC,
rscope: RS,
did: ast::def_id,
// 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,
// 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.
|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) {
}
}
-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) => {
*/
-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,
*/
-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 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 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 syntax::parse::token::special_idents;
+use syntax::print::pprust;
-use std::map::HashMap;
+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;
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).
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,
#[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);
}
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)
}
}
// declared on the impl declaration e.g., `impl<A,B> 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 {
// (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)) {
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"
});
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)));
}
}
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,
_ => {
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; }
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)));
}
}
*/
-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>;
// #[warn(deprecated_mode)];
// #[warn(deprecated_pattern)];
+use util::ppaux;
+
use syntax::print::pprust::{expr_to_str};
// Helper functions related to manipulating region types.
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| {
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.
// 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
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) {
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)));
}
}
}
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) => {
// 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<ty::t>
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) => {
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<t> {
*/
-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.
// - 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
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)
};
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);
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;
}
// 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<ty::t>) -> ares {
match c {
// 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.
a: ty::vstore, b: ty::vstore) -> cres<ty::vstore>;
}
-struct combine_fields {
+pub struct combine_fields {
infcx: infer_ctxt,
a_is_expected: bool,
span: span,
}
}
-fn eq_tys<C: combine>(self: &C, a: ty::t, b: ty::t) -> ures {
+pub fn eq_tys<C: combine>(self: &C, a: ty::t, b: ty::t) -> ures {
let suber = self.sub();
do self.infcx().try {
do suber.tys(a, b).chain |_ok| {
*/
-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;
// 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)
*/
-use to_str::ToStr;
+use middle::typeck::infer::to_str::ToStr;
// Bitvector to represent sets of integral types
enum int_ty_set = uint;
// 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
// 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.
#[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;
-
-// 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 util::ppaux::{ty_to_str, mt_to_str};
+
+use core::cmp::Eq;
+use core::dvec::DVec;
+use core::result::{Result, Ok, Err, map_vec, map_vec2, iter_vec2};
+use 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;
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;
#[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;
// 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;
// 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.
// 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;
// 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<V:Copy, T:Copy> {
#[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 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 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 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 std::list;
-use list::{List, Nil, Cons};
-use dvec::DVec;
+use syntax::visit;
+use syntax::{ast, ast_util, ast_map};
export check;
export check_crate;
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),
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,
// maps from an expression id that corresponds to a method call to the details
// of the method to be invoked
-type method_map = HashMap<ast::node_id, method_map_entry>;
+pub type method_map = HashMap<ast::node_id, method_map_entry>;
// 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.
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)))
}
}
}
// 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,
+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);
}
}
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) + ~"`");
}
}
}
// 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 {
#[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;
non-sendableness.
*/
-use std::map::HashMap;
-use rustc::driver::session;
-use session::{basic_options, options};
-use session::Session;
+use rustc::back::link;
use rustc::driver::driver;
-use syntax::diagnostic;
-use syntax::diagnostic::handler;
+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::codemap;
use syntax::ast_map;
-use rustc::back::link;
-use rustc::metadata::filesearch;
-use rustc::front;
+use syntax::codemap;
+use syntax::diagnostic::handler;
+use syntax::diagnostic;
pub type Ctxt = {
ast: @ast::crate,
//! 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 {
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;
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;
/**
}
}
-pub use traits::*;
+pub use serialization::traits::*;
#[forbid(deprecated_mode)];
-use uv = uv;
use uv::iotask;
-use iotask::IoTask;
+use uv::iotask::IoTask;
use comm = core::comm;
/**
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};
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;
*/
-use base::*;
+use ext::base::*;
use codemap::span;
use std::map;
use std::map::HashMap;
// 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 {
// 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 {
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;
* 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])
* compiler syntax extension plugin interface.
*/
use extfmt::ct::*;
-use base::*;
+use ext::base::*;
use codemap::span;
use ext::build::*;
export expand_syntax_ext;
// 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])
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 {
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,
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;
use parse::parser;
use parse::token;
-use pipec::*;
+use ext::pipes::pipec::*;
trait proto_parser {
fn parse_proto(id: ~str) -> protocol;
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;
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 }
use codemap::{span, BytePos};
use ext::base::ext_ctxt;
-use token::*;
+use parse::token::*;
/**
*
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];
// 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;
// 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;
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;
use either::{Either, Left, Right};
use ast_util::spanned;
-use common::*; //resolve bug?
+use parse::common::*; //resolve bug?
export parser_attr;
// 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;
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<token::Token>,
export prec;
export classify;
export attr;
+export obsolete;
export parse_sess;
export new_parse_sess, new_parse_sess_special_handler;
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 codemap::{span, CodeMap, FileMap, CharPos, BytePos};
use diagnostic::{span_handler, mk_span_handler, mk_handler, emitter};
-use lexer::{reader, string_reader};
+use parse::attr::parser_attr;
+use parse::lexer::{reader, string_reader};
+use parse::parser::Parser;
use parse::token::{ident_interner, mk_ident_interner};
-use codemap::{span, CodeMap, FileMap, CharPos, BytePos};
+use util::interner;
#[legacy_exports]
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 {
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,
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
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;
use core::*;
+pub mod syntax {
+ pub use ext;
+ pub use parse;
+}
+
#[legacy_exports]
mod attr;
#[legacy_exports]
export foo;
-use comm::*;
+use core::comm::*;
fn foo<T: Send Copy>(x: T) -> Port<T> {
let p = Port();
}
}
- pub use b::c;
+ pub use a::b::c;
}
--- /dev/null
+use super::f; //~ ERROR unresolved name
+//~^ ERROR failed to resolve import
+
+fn main() {
+
+}
+
// Regression test for issue #374
-extern mod std;
-use option::None;
enum sty { ty_nil, }
// -*- 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 {
}
_ => { 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;
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use to_str::ToStr;
-
trait Foo {
fn f(&self);
}
fn main() {
let y = Bar { x: 42 };
y.f();
-}
\ No newline at end of file
+}
+// 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.
// except according to those terms.
-extern mod std;
-use comm::Chan;
-use comm::Port;
-use comm::send;
-use comm::recv;
-
-fn a(c: Chan<int>) { send(c, 10); }
+fn a(c: core::comm::Chan<int>) { 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<int>) {
+fn b(c: core::comm::Chan<int>) {
// 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);
}
// except according to those terms.
-extern mod std;
-use comm::Port;
-use comm::send;
-use comm::Chan;
-use comm::recv;
-
-fn a(c: Chan<int>) { debug!("task a0"); debug!("task a1"); send(c, 10); }
+fn a(c: core::comm::Chan<int>) {
+ 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<int>) {
+fn b(c: core::comm::Chan<int>) {
debug!("task b0");
debug!("task b1");
debug!("task b2");
debug!("task b2");
debug!("task b3");
- send(c, 10);
+ core::comm::send(c, 10);
}
// except according to those terms.
-extern mod std;
-use comm::send;
-use comm::Chan;
-use comm::recv;
-
-fn a(c: Chan<int>) {
+fn a(c: core::comm::Chan<int>) {
if true {
debug!("task a");
debug!("task a");
debug!("task a");
debug!("task a");
}
- send(c, 10);
+ core::comm::send(c, 10);
}
fn k(x: int) -> int { return 15; }
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<int>) {
+fn b(c: core::comm::Chan<int>) {
if true {
debug!("task b");
debug!("task b");
debug!("task b");
debug!("task b");
}
- send(c, 10);
+ core::comm::send(c, 10);
}
// except according to those terms.
// xfail-test
+// xfail-fast
extern mod std;
use std::arc;
fn dispose(+_x: arc::ARC<bool>) unsafe { }
// Binop corner cases
-extern mod std;
-use cast::reinterpret_cast;
-
fn test_nil() {
assert (() == ());
assert (!(() != ()));
}
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;
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;
+// 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.
// 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)
}
// 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
+}
// 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
+}
// 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.
// 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);
}
// Issue #763
-extern mod std;
-use comm::Chan;
-use comm::send;
-use comm::Port;
-use comm::recv;
+enum request { quit, close(core::comm::Chan<bool>), }
-enum request { quit, close(Chan<bool>), }
+type ctx = core::comm::Chan<request>;
-type ctx = Chan<request>;
-
-fn request_task(c: Chan<ctx>) {
- let p = Port();
- send(c, Chan(&p));
+fn request_task(c: core::comm::Chan<ctx>) {
+ 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::<bool>();
- send(cx, close(Chan(&p)));
- send(cx, quit);
+ let p = core::comm::Port::<bool>();
+ core::comm::send(cx, close(core::comm::Chan(&p)));
+ core::comm::send(cx, quit);
}
+// 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.
// 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<int>) {
+fn child(c: core::comm::Chan<int>) {
error!("sending");
- send(c, 10);
+ core::comm::send(c, 10);
error!("value sent");
}
+// 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.
// 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));
+}
// 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);
}
// 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];
+// 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.
mod foo {
#[legacy_exports];
- use bar::*;
+ use foo::bar::*;
mod bar {
#[legacy_exports];
const a : int = 10;
+// 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.
mod foo {
#[legacy_exports];
- use bar::*;
+ use foo::bar::*;
export a;
+ export bar;
mod bar {
#[legacy_exports];
const a : int = 10;
+// 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.
+// 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.
+// 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.
-use option::*;
-
enum Q { R(Option<uint>) }
fn xyzzy(q: Q) -> uint {
fn main() {
assert xyzzy(R(Some(5))) == 0;
-}
\ No newline at end of file
+}
+// 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.
extern mod std;
-use option::Some;
-use option::None;
use std::map;
use std::map::HashMap;
use comm::Chan;
+// 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.
+// 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.
+// 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.
+// 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.
+// 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.
// 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])));
+// 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.
+// 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.
+// 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.
+// 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.
+// 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.
+// 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.
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"); }
+// 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.
+// 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.
+// 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.
+// 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.
// Issue #1112
// Alignment of interior pointers to dynamic-size types
-extern mod std;
-use ptr::addr_of;
-
type x<T> = {
a: T,
b: u8,
assert x.e == 11u16;
assert x.f == 12u8;
assert x.g == 13u8;
-}
\ No newline at end of file
+}
+// 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.
+// 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.
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
+}
+// 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.
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use dvec::DVec;
-
struct c1<T: Copy> {
x: T,
}
+// 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.
+// 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.
+// 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.
// 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
}
#[cfg(target_arch = "x86_64")]
fn main() {
- assert (size_of::<Cat>() == 8 as uint);
- assert (size_of::<Kitty>() == 16 as uint);
+ assert (sys::size_of::<Cat>() == 8 as uint);
+ assert (sys::size_of::<Kitty>() == 16 as uint);
}
#[cfg(target_arch = "x86")]
fn main() {
- assert (size_of::<Cat>() == 4 as uint);
- assert (size_of::<Kitty>() == 8 as uint);
+ assert (sys::size_of::<Cat>() == 4 as uint);
+ assert (sys::size_of::<Kitty>() == 8 as uint);
}
+// 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.
+// 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.
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use option::*;
-
type Connection = fn@(~[u8]);
fn f() -> Option<Connection> {
+// 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.
+// 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.
// 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());
}
}
https://github.com/graydon/rust/issues/507
*/
-extern mod std;
+fn grandchild(c: core::comm::Chan<int>) { core::comm::send(c, 42); }
-use comm::Chan;
-use comm::send;
-use comm::Port;
-use comm::recv;
-
-fn grandchild(c: Chan<int>) { send(c, 42); }
-
-fn child(c: Chan<int>) {
+fn child(c: core::comm::Chan<int>) {
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);
// 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<Chan<~[u8]>>, msg: Chan<msg>) {
- let p: Port<~[u8]> = Port();
- send(cb, Chan(&p));
+fn packager(cb: core::comm::Chan<core::comm::Chan<~[u8]>>, msg: core::comm::Chan<msg>) {
+ 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");
}
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<msg> = Port();
- let ch = Chan(&p);
- let recv_reader: Port<Chan<~[u8]>> = Port();
- let recv_reader_chan = Chan(&recv_reader);
+ let p: core::comm::Port<msg> = core::comm::Port();
+ let ch = core::comm::Chan(&p);
+ let recv_reader: core::comm::Port<core::comm::Chan<~[u8]>> = 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) => {
// 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<Chan<int>>) {
- let p = Port();
- send(c, Chan(&p));
+ fn b(c: core::comm::Chan<core::comm::Chan<int>>) {
+ 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 {
fn main() {
for iter::repeat(100u) {
- spawn(|| a() );
+ task::spawn(|| a() );
}
}
-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);
}
// 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<int>) { send(c, 10); }
+fn child(c: core::comm::Chan<int>) { core::comm::send(c, 10); }
+// 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.
// 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 } }
+// 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.
// 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<int>), }
+// 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.
+// 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.
+// 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.
+// 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.
+// 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.
+// 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.
+// 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.
+// 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.
+// 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.
sleep(iotask, 500);
signal(move c);
-}
\ No newline at end of file
+}
+// 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.
+// 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.
+// 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.
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use libc, sys, cast;
-
enum arena = ();
type bcx = {
// 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};
// 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);
// Test rotating and growing the buffer when
// the unit size is not a power of two
fn test_rotate_grow() {
- let myport = Port::<record>();
- let mychan = Chan(&myport);
+ let myport = core::comm::Port::<record>();
+ 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);
// Tests of the runtime's scheduler interface
-use ptr::is_null;
-
type sched_id = int;
type task_id = *libc::c_void;
+// 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.
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use task::*;
-use comm::*;
-
struct test {
f: int,
}
}
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();
}
// 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<K: Send, V: Send> = {key: K, val: V};
-fn cache_server<K: Send, V: Send>(c: Chan<Chan<command<K, V>>>) {
- let ctrl = Port();
- send(c, Chan(&ctrl));
+fn cache_server<K: Send, V: Send>(c: core::comm::Chan<core::comm::Chan<command<K, V>>>) {
+ let ctrl = core::comm::Port();
+ core::comm::send(c, core::comm::Chan(&ctrl));
}
fn main() { }
// 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<A:Copy>() -> fn~(A) -> (A,uint) {
// 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)) {
+// 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.
// except according to those terms.
-extern mod std;
-use task::yield;
-
fn x(s: ~str, n: int) {
log(debug, s);
log(debug, n);
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(); }
}
// 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;
+// 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.
// except according to those terms.
-extern mod std;
use pipes::send;
use pipes::Port;
use pipes::recv;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-extern mod std;
use pipes::send;
fn main() { test00(); }
// 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;
// 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();
test06();
}
-fn test00_start(ch: Chan<int>, message: int, count: int) {
+fn test00_start(ch: core::comm::Chan<int>, 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");
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;
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(); }
}
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);
}
debug!("Finishing up.");
}
-fn test05_start(ch: Chan<int>) {
- send(ch, 10);
- send(ch, 20);
- send(ch, 30);
- send(ch, 30);
- send(ch, 30);
+fn test05_start(ch: core::comm::Chan<int>) {
+ 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);
}
// A port of task-killjoin to use a class with a dtor to manage
// the join.
-extern mod std;
-
struct notify {
ch: comm::Chan<bool>, v: @mut bool,
}
// 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
+// 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.
+// 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.
+// 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.
fn main() {
test_float_ext(1f32);
-}
\ No newline at end of file
+}
// 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;
}
+// 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.
+// 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.
use x = core::str;
}
-fn main() { }
\ No newline at end of file
+fn main() { }
// 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");
}
// 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();
}
// 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(); }
// 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] {