mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-23 20:34:06 +00:00
librustc: Make use
statements crate-relative by default. r=brson
This commit is contained in:
parent
3c8dca429a
commit
4c2e4c37ce
@ -42,26 +42,25 @@ extern mod std(vers = "0.5");
|
||||
extern mod rustc(vers = "0.5");
|
||||
extern mod syntax(vers = "0.5");
|
||||
|
||||
use core::*;
|
||||
|
||||
#[legacy_exports]
|
||||
mod pgp;
|
||||
|
||||
use syntax::{ast, codemap, parse, visit, attr};
|
||||
use syntax::diagnostic::span_handler;
|
||||
use codemap::span;
|
||||
use rustc::metadata::filesearch::{get_cargo_root, get_cargo_root_nearest,
|
||||
get_cargo_sysroot, libdir};
|
||||
use syntax::diagnostic;
|
||||
use rustc::metadata::filesearch::{get_cargo_root, get_cargo_root_nearest};
|
||||
use rustc::metadata::filesearch::{get_cargo_sysroot, libdir};
|
||||
|
||||
use result::{Ok, Err};
|
||||
use io::WriterUtil;
|
||||
use send_map::linear::LinearMap;
|
||||
use core::*;
|
||||
|
||||
use core::dvec::DVec;
|
||||
use core::io::WriterUtil;
|
||||
use core::result::{Ok, Err};
|
||||
use core::send_map::linear::LinearMap;
|
||||
use std::getopts::{optflag, optopt, opt_present};
|
||||
use std::map::HashMap;
|
||||
use std::{map, json, tempfile, term, sort, getopts};
|
||||
use map::HashMap;
|
||||
use to_str::to_str;
|
||||
use getopts::{optflag, optopt, opt_present};
|
||||
use dvec::DVec;
|
||||
use syntax::codemap::span;
|
||||
use syntax::diagnostic::span_handler;
|
||||
use syntax::diagnostic;
|
||||
use syntax::{ast, codemap, parse, visit, attr};
|
||||
|
||||
struct Package {
|
||||
name: ~str,
|
||||
|
@ -247,7 +247,7 @@ mod core {
|
||||
#[cfg(test)]
|
||||
mod std {
|
||||
extern mod std(vers = "0.5");
|
||||
pub use std::test;
|
||||
pub use std::std::test;
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,7 +12,12 @@
|
||||
#[forbid(deprecated_mode)];
|
||||
#[forbid(deprecated_pattern)];
|
||||
|
||||
#[cfg(stage0)]
|
||||
use T = inst::T;
|
||||
#[cfg(stage1)]
|
||||
#[cfg(stage2)]
|
||||
use T = self::inst::T;
|
||||
|
||||
use cmp::{Eq, Ord};
|
||||
use from_str::FromStr;
|
||||
use num::from_int;
|
||||
|
@ -10,7 +10,11 @@
|
||||
|
||||
//! Operations and constants for `int`
|
||||
|
||||
#[cfg(stage0)]
|
||||
pub use inst::pow;
|
||||
#[cfg(stage1)]
|
||||
#[cfg(stage2)]
|
||||
pub use self::inst::pow;
|
||||
|
||||
mod inst {
|
||||
pub type T = int;
|
||||
@ -54,4 +58,4 @@ mod inst {
|
||||
assert (min_value <= 0);
|
||||
assert (min_value + max_value + 1 == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,12 @@
|
||||
#[forbid(deprecated_pattern)];
|
||||
|
||||
use cmp::{Eq, Ord};
|
||||
|
||||
#[cfg(stage0)]
|
||||
use inst::{IMPL_T, EACH, SIZE_HINT};
|
||||
#[cfg(stage1)]
|
||||
#[cfg(stage2)]
|
||||
use self::inst::{IMPL_T, EACH, SIZE_HINT};
|
||||
|
||||
impl<A> IMPL_T<A>: iter::BaseIter<A> {
|
||||
pure fn each(blk: fn(v: &A) -> bool) { EACH(&self, blk) }
|
||||
|
@ -59,89 +59,109 @@
|
||||
// Initial glob-exports mean that all the contents of all the modules
|
||||
// wind up exported, if you're interested in writing platform-specific code.
|
||||
|
||||
pub use types::common::c95::*;
|
||||
pub use types::common::c99::*;
|
||||
pub use types::common::posix88::*;
|
||||
pub use types::common::posix01::*;
|
||||
pub use types::common::posix08::*;
|
||||
pub use types::common::bsd44::*;
|
||||
pub use types::os::common::posix01::*;
|
||||
pub use types::os::arch::c95::*;
|
||||
pub use types::os::arch::c99::*;
|
||||
pub use types::os::arch::posix88::*;
|
||||
pub use types::os::arch::posix01::*;
|
||||
pub use types::os::arch::posix08::*;
|
||||
pub use types::os::arch::bsd44::*;
|
||||
pub use types::os::arch::extra::*;
|
||||
pub use libc::types::common::c95::*;
|
||||
pub use libc::types::common::c99::*;
|
||||
pub use libc::types::common::posix88::*;
|
||||
pub use libc::types::common::posix01::*;
|
||||
pub use libc::types::common::posix08::*;
|
||||
pub use libc::types::common::bsd44::*;
|
||||
pub use libc::types::os::common::posix01::*;
|
||||
pub use libc::types::os::arch::c95::*;
|
||||
pub use libc::types::os::arch::c99::*;
|
||||
pub use libc::types::os::arch::posix88::*;
|
||||
pub use libc::types::os::arch::posix01::*;
|
||||
pub use libc::types::os::arch::posix08::*;
|
||||
pub use libc::types::os::arch::bsd44::*;
|
||||
pub use libc::types::os::arch::extra::*;
|
||||
|
||||
pub use consts::os::c95::*;
|
||||
pub use consts::os::c99::*;
|
||||
pub use consts::os::posix88::*;
|
||||
pub use consts::os::posix01::*;
|
||||
pub use consts::os::posix08::*;
|
||||
pub use consts::os::bsd44::*;
|
||||
pub use consts::os::extra::*;
|
||||
pub use libc::consts::os::c95::*;
|
||||
pub use libc::consts::os::c99::*;
|
||||
pub use libc::consts::os::posix88::*;
|
||||
pub use libc::consts::os::posix01::*;
|
||||
pub use libc::consts::os::posix08::*;
|
||||
pub use libc::consts::os::bsd44::*;
|
||||
pub use libc::consts::os::extra::*;
|
||||
|
||||
pub use funcs::c95::ctype::*;
|
||||
pub use funcs::c95::stdio::*;
|
||||
pub use funcs::c95::stdlib::*;
|
||||
pub use funcs::c95::string::*;
|
||||
pub use libc::funcs::c95::ctype::*;
|
||||
pub use libc::funcs::c95::stdio::*;
|
||||
pub use libc::funcs::c95::stdlib::*;
|
||||
pub use libc::funcs::c95::string::*;
|
||||
|
||||
pub use funcs::posix88::stat_::*;
|
||||
pub use funcs::posix88::stdio::*;
|
||||
pub use funcs::posix88::fcntl::*;
|
||||
pub use funcs::posix88::dirent::*;
|
||||
pub use funcs::posix88::unistd::*;
|
||||
pub use libc::funcs::posix88::stat_::*;
|
||||
pub use libc::funcs::posix88::stdio::*;
|
||||
pub use libc::funcs::posix88::fcntl::*;
|
||||
pub use libc::funcs::posix88::dirent::*;
|
||||
pub use libc::funcs::posix88::unistd::*;
|
||||
|
||||
pub use funcs::posix01::stat_::*;
|
||||
pub use funcs::posix01::unistd::*;
|
||||
pub use funcs::posix08::unistd::*;
|
||||
pub use libc::funcs::posix01::stat_::*;
|
||||
pub use libc::funcs::posix01::unistd::*;
|
||||
pub use libc::funcs::posix08::unistd::*;
|
||||
|
||||
pub use funcs::bsd44::*;
|
||||
pub use funcs::extra::*;
|
||||
pub use libc::funcs::bsd44::*;
|
||||
pub use libc::funcs::extra::*;
|
||||
|
||||
#[cfg(target_os = "win32")]
|
||||
pub use libc::funcs::extra::kernel32::*;
|
||||
#[cfg(target_os = "win32")]
|
||||
pub use libc::funcs::extra::msvcrt::*;
|
||||
|
||||
// Explicit export lists for the intersection (provided here) mean that
|
||||
// you can write more-platform-agnostic code if you stick to just these
|
||||
// symbols.
|
||||
|
||||
pub use size_t;
|
||||
pub use c_float, c_double, c_void, FILE, fpos_t;
|
||||
pub use DIR, dirent_t;
|
||||
pub use c_char, c_schar, c_uchar;
|
||||
pub use c_short, c_ushort, c_int, c_uint, c_long, c_ulong;
|
||||
pub use size_t, ptrdiff_t, clock_t, time_t;
|
||||
pub use c_longlong, c_ulonglong, intptr_t, uintptr_t;
|
||||
pub use off_t, dev_t, ino_t, pid_t, mode_t, ssize_t;
|
||||
pub use libc::types::common::c95::{FILE, c_void, fpos_t};
|
||||
pub use libc::types::common::posix88::{DIR, dirent_t};
|
||||
pub use libc::types::os::arch::c95::{c_char, c_double, c_float, c_int};
|
||||
pub use libc::types::os::arch::c95::{c_long, c_short, c_uchar, c_ulong};
|
||||
pub use libc::types::os::arch::c95::{c_ushort, clock_t, ptrdiff_t};
|
||||
pub use libc::types::os::arch::c95::{size_t, time_t};
|
||||
pub use libc::types::os::arch::c99::{c_longlong, c_ulonglong, intptr_t};
|
||||
pub use libc::types::os::arch::c99::{uintptr_t};
|
||||
pub use libc::types::os::arch::posix88::{dev_t, dirent_t, ino_t, mode_t};
|
||||
pub use libc::types::os::arch::posix88::{off_t, pid_t, ssize_t};
|
||||
|
||||
pub use EXIT_FAILURE, EXIT_SUCCESS, RAND_MAX,
|
||||
EOF, SEEK_SET, SEEK_CUR, SEEK_END, _IOFBF, _IONBF, _IOLBF,
|
||||
BUFSIZ, FOPEN_MAX, FILENAME_MAX, L_tmpnam, TMP_MAX,
|
||||
O_RDONLY, O_WRONLY, O_RDWR, O_APPEND, O_CREAT, O_EXCL, O_TRUNC,
|
||||
S_IFIFO, S_IFCHR, S_IFBLK, S_IFDIR, S_IFREG, S_IFMT, S_IEXEC,
|
||||
S_IWRITE, S_IREAD, S_IRWXU, S_IXUSR, S_IWUSR, S_IRUSR, F_OK, R_OK,
|
||||
W_OK, X_OK, STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO;
|
||||
pub use libc::consts::os::c95::{_IOFBF, _IOLBF, _IONBF, BUFSIZ, EOF};
|
||||
pub use libc::consts::os::c95::{EXIT_FAILURE, EXIT_SUCCESS};
|
||||
pub use libc::consts::os::c95::{FILENAME_MAX, FOPEN_MAX, L_tmpnam};
|
||||
pub use libc::consts::os::c95::{RAND_MAX, SEEK_CUR, SEEK_END};
|
||||
pub use libc::consts::os::c95::{SEEK_SET, TMP_MAX};
|
||||
pub use libc::consts::os::posix88::{F_OK, O_APPEND, O_CREAT, O_EXCL};
|
||||
pub use libc::consts::os::posix88::{O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY};
|
||||
pub use libc::consts::os::posix88::{R_OK, S_IEXEC, S_IFBLK, S_IFCHR};
|
||||
pub use libc::consts::os::posix88::{S_IFDIR, S_IFIFO, S_IFMT, S_IFREG};
|
||||
pub use libc::consts::os::posix88::{S_IREAD, S_IRUSR, S_IRWXU, S_IWUSR};
|
||||
pub use libc::consts::os::posix88::{STDERR_FILENO, STDIN_FILENO};
|
||||
pub use libc::consts::os::posix88::{STDOUT_FILENO, W_OK, X_OK};
|
||||
|
||||
pub use isalnum, isalpha, iscntrl, isdigit, islower, isprint, ispunct,
|
||||
isspace, isupper, isxdigit, tolower, toupper;
|
||||
pub use libc::funcs::c95::ctype::{isalnum, isalpha, iscntrl, isdigit};
|
||||
pub use libc::funcs::c95::ctype::{islower, isprint, ispunct, isspace};
|
||||
pub use libc::funcs::c95::ctype::{isupper, isxdigit, tolower, toupper};
|
||||
|
||||
pub use fopen, freopen, fflush, fclose, remove, tmpfile, setvbuf, setbuf,
|
||||
fgetc, fgets, fputc, fputs, puts, ungetc, fread, fwrite, fseek, ftell,
|
||||
rewind, fgetpos, fsetpos, feof, ferror, perror;
|
||||
pub use libc::funcs::c95::stdio::{fclose, feof, ferror, fflush, fgetc};
|
||||
pub use libc::funcs::c95::stdio::{fgetpos, fgets, fopen, fputc, fputs};
|
||||
pub use libc::funcs::c95::stdio::{fread, freopen, fseek, fsetpos, ftell};
|
||||
pub use libc::funcs::c95::stdio::{fwrite, perror, puts, remove, rewind};
|
||||
pub use libc::funcs::c95::stdio::{setbuf, setvbuf, tmpfile, ungetc};
|
||||
|
||||
pub use abs, labs, atof, atoi, strtod, strtol, strtoul, calloc, malloc,
|
||||
realloc, free, abort, exit, system, getenv, rand, srand;
|
||||
pub use libc::funcs::c95::stdlib::{abort, abs, atof, atoi, calloc, exit};
|
||||
pub use libc::funcs::c95::stdlib::{free, getenv, labs, malloc, rand};
|
||||
pub use libc::funcs::c95::stdlib::{realloc, srand, strtod, strtol};
|
||||
pub use libc::funcs::c95::stdlib::{strtoul, system};
|
||||
|
||||
pub use strcpy, strncpy, strcat, strncat, strcmp, strncmp, strcoll, strchr,
|
||||
strrchr, strspn, strcspn, strpbrk, strstr, strlen, strerror, strtok,
|
||||
strxfrm, memcpy, memmove, memcmp, memchr, memset;
|
||||
pub use libc::funcs::c95::string::{memchr, memcmp, memcpy, memmove};
|
||||
pub use libc::funcs::c95::string::{memset, strcat, strchr, strcmp};
|
||||
pub use libc::funcs::c95::string::{strcoll, strcpy, strcspn, strerror};
|
||||
pub use libc::funcs::c95::string::{strlen, strncat, strncmp, strncpy};
|
||||
pub use libc::funcs::c95::string::{strpbrk, strrchr, strspn, strstr};
|
||||
pub use libc::funcs::c95::string::{strtok, strxfrm};
|
||||
|
||||
pub use chmod, mkdir;
|
||||
pub use popen, pclose, fdopen, fileno;
|
||||
pub use open, creat;
|
||||
pub use access, chdir, close, dup, dup2, execv, execve, execvp, getcwd,
|
||||
getpid, isatty, lseek, pipe, read, rmdir, unlink, write;
|
||||
|
||||
pub use fstat, stat;
|
||||
pub use libc::funcs::posix88::fcntl::{open, creat};
|
||||
pub use libc::funcs::posix88::stat_::{chmod, fstat, mkdir, stat};
|
||||
pub use libc::funcs::posix88::stdio::{fdopen, fileno, pclose, popen};
|
||||
pub use libc::funcs::posix88::unistd::{access, chdir, close, dup, dup2};
|
||||
pub use libc::funcs::posix88::unistd::{execv, execve, execvp, getcwd};
|
||||
pub use libc::funcs::posix88::unistd::{getpid, isatty, lseek, pipe, read};
|
||||
pub use libc::funcs::posix88::unistd::{rmdir, unlink, write};
|
||||
|
||||
|
||||
mod types {
|
||||
@ -1365,10 +1385,6 @@ pub mod funcs {
|
||||
|
||||
#[cfg(target_os = "win32")]
|
||||
pub mod extra {
|
||||
use types::os::arch::extra::*;
|
||||
pub use kernel32::*;
|
||||
pub use msvcrt::*;
|
||||
|
||||
#[abi = "stdcall"]
|
||||
pub extern mod kernel32 {
|
||||
fn GetEnvironmentVariableW(n: LPCWSTR,
|
||||
@ -1396,7 +1412,7 @@ pub mod funcs {
|
||||
#[nolink]
|
||||
pub extern mod msvcrt {
|
||||
#[link_name = "_commit"]
|
||||
fn commit(fd: c_int) -> c_int;
|
||||
pub fn commit(fd: c_int) -> c_int;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||
// Copyright 2012 The Rust Project Developers.src/libcore/os.rs
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
@ -36,7 +36,7 @@ pub use libc::{close, fclose};
|
||||
|
||||
use option::{Some, None};
|
||||
|
||||
pub use consts::*;
|
||||
pub use os::consts::*;
|
||||
use task::TaskBuilder;
|
||||
|
||||
// FIXME: move these to str perhaps? #2620
|
||||
@ -77,8 +77,8 @@ pub fn fill_charp_buf(f: fn(*mut c_char, size_t) -> bool)
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
mod win32 {
|
||||
use libc::DWORD;
|
||||
pub mod win32 {
|
||||
use libc::types::os::arch::extra::DWORD;
|
||||
|
||||
pub fn fill_utf16_buf_and_decode(f: fn(*mut u16, DWORD) -> DWORD)
|
||||
-> Option<~str> {
|
||||
@ -224,7 +224,7 @@ mod global_env {
|
||||
|
||||
#[cfg(windows)]
|
||||
pub fn getenv(n: &str) -> Option<~str> {
|
||||
use win32::*;
|
||||
use os::win32::*;
|
||||
do as_utf16_p(n) |u| {
|
||||
do fill_utf16_buf_and_decode() |buf, sz| {
|
||||
libc::GetEnvironmentVariableW(u, buf, sz)
|
||||
@ -245,7 +245,7 @@ mod global_env {
|
||||
|
||||
#[cfg(windows)]
|
||||
pub fn setenv(n: &str, v: &str) {
|
||||
use win32::*;
|
||||
use os::win32::*;
|
||||
do as_utf16_p(n) |nbuf| {
|
||||
do as_utf16_p(v) |vbuf| {
|
||||
libc::SetEnvironmentVariableW(nbuf, vbuf);
|
||||
@ -403,7 +403,7 @@ pub fn self_exe_path() -> Option<Path> {
|
||||
|
||||
#[cfg(windows)]
|
||||
fn load_self() -> Option<~str> {
|
||||
use win32::*;
|
||||
use os::win32::*;
|
||||
do fill_utf16_buf_and_decode() |buf, sz| {
|
||||
libc::GetModuleFileNameW(0u as libc::DWORD, buf, sz)
|
||||
}
|
||||
@ -566,7 +566,7 @@ pub fn make_dir(p: &Path, mode: c_int) -> bool {
|
||||
|
||||
#[cfg(windows)]
|
||||
fn mkdir(p: &Path, _mode: c_int) -> bool {
|
||||
use win32::*;
|
||||
use os::win32::*;
|
||||
// FIXME: turn mode into something useful? #2623
|
||||
do as_utf16_p(p.to_str()) |buf| {
|
||||
libc::CreateDirectoryW(buf, unsafe {
|
||||
@ -614,7 +614,7 @@ pub fn remove_dir(p: &Path) -> bool {
|
||||
|
||||
#[cfg(windows)]
|
||||
fn rmdir(p: &Path) -> bool {
|
||||
use win32::*;
|
||||
use os::win32::*;
|
||||
return do as_utf16_p(p.to_str()) |buf| {
|
||||
libc::RemoveDirectoryW(buf) != (0 as libc::BOOL)
|
||||
};
|
||||
@ -633,7 +633,7 @@ pub fn change_dir(p: &Path) -> bool {
|
||||
|
||||
#[cfg(windows)]
|
||||
fn chdir(p: &Path) -> bool {
|
||||
use win32::*;
|
||||
use os::win32::*;
|
||||
return do as_utf16_p(p.to_str()) |buf| {
|
||||
libc::SetCurrentDirectoryW(buf) != (0 as libc::BOOL)
|
||||
};
|
||||
@ -653,7 +653,7 @@ pub fn copy_file(from: &Path, to: &Path) -> bool {
|
||||
|
||||
#[cfg(windows)]
|
||||
fn do_copy_file(from: &Path, to: &Path) -> bool {
|
||||
use win32::*;
|
||||
use os::win32::*;
|
||||
return do as_utf16_p(from.to_str()) |fromp| {
|
||||
do as_utf16_p(to.to_str()) |top| {
|
||||
libc::CopyFileW(fromp, top, (0 as libc::BOOL)) !=
|
||||
@ -713,7 +713,7 @@ pub fn remove_file(p: &Path) -> bool {
|
||||
|
||||
#[cfg(windows)]
|
||||
fn unlink(p: &Path) -> bool {
|
||||
use win32::*;
|
||||
use os::win32::*;
|
||||
return do as_utf16_p(p.to_str()) |buf| {
|
||||
libc::DeleteFileW(buf) != (0 as libc::BOOL)
|
||||
};
|
||||
|
@ -451,7 +451,7 @@ pub mod linear {
|
||||
|
||||
#[test]
|
||||
pub mod test {
|
||||
use linear::LinearMap;
|
||||
use send_map::linear::LinearMap;
|
||||
|
||||
#[test]
|
||||
pub fn inserts() {
|
||||
|
@ -26,7 +26,7 @@ magic.
|
||||
|
||||
*/
|
||||
|
||||
use local_data_priv::{
|
||||
use task::local_data_priv::{
|
||||
local_pop,
|
||||
local_get,
|
||||
local_set,
|
||||
|
@ -10,8 +10,13 @@
|
||||
|
||||
#[doc(hidden)]; // FIXME #3538
|
||||
|
||||
use local_data::LocalDataKey;
|
||||
use task::local_data::LocalDataKey;
|
||||
|
||||
#[cfg(notest)]
|
||||
use rt::rust_task;
|
||||
#[cfg(test)]
|
||||
#[allow(non_camel_case_types)]
|
||||
type rust_task = libc::c_void;
|
||||
|
||||
pub trait LocalData { }
|
||||
impl<T: Owned> @T: LocalData { }
|
||||
|
@ -41,12 +41,10 @@
|
||||
use cmp::Eq;
|
||||
use result::Result;
|
||||
use pipes::{stream, Chan, Port};
|
||||
use local_data_priv::{local_get, local_set};
|
||||
use task::local_data_priv::{local_get, local_set};
|
||||
use task::rt::{task_id, rust_task};
|
||||
use util::replace;
|
||||
|
||||
use rt::task_id;
|
||||
use rt::rust_task;
|
||||
|
||||
mod local_data_priv;
|
||||
pub mod local_data;
|
||||
pub mod rt;
|
||||
|
@ -73,8 +73,8 @@
|
||||
#[doc(hidden)]; // FIXME #3538
|
||||
#[warn(deprecated_mode)];
|
||||
|
||||
use rt::rust_task;
|
||||
use rt::rust_closure;
|
||||
use task::rt::rust_task;
|
||||
use task::rt::rust_closure;
|
||||
|
||||
macro_rules! move_it (
|
||||
{ $x:expr } => ( unsafe { let y = move *ptr::addr_of(&($x)); move y } )
|
||||
|
@ -18,7 +18,7 @@ The `ToStr` trait for converting to strings
|
||||
#[forbid(deprecated_mode)];
|
||||
#[forbid(deprecated_pattern)];
|
||||
|
||||
pub trait ToStr { pure fn to_str() -> ~str; }
|
||||
pub trait ToStr { pub pure fn to_str() -> ~str; }
|
||||
|
||||
impl int: ToStr {
|
||||
pure fn to_str() -> ~str { int::str(self) }
|
||||
|
@ -12,7 +12,12 @@
|
||||
#[forbid(deprecated_mode)];
|
||||
#[forbid(deprecated_pattern)];
|
||||
|
||||
#[cfg(stage0)]
|
||||
use T = inst::T;
|
||||
#[cfg(stage1)]
|
||||
#[cfg(stage2)]
|
||||
use T = self::inst::T;
|
||||
|
||||
use cmp::{Eq, Ord};
|
||||
use from_str::FromStr;
|
||||
|
||||
|
@ -10,7 +10,11 @@
|
||||
|
||||
//! Operations and constants for `u8`
|
||||
|
||||
#[cfg(stage0)]
|
||||
pub use inst::is_ascii;
|
||||
#[cfg(stage1)]
|
||||
#[cfg(stage2)]
|
||||
pub use self::inst::is_ascii;
|
||||
|
||||
mod inst {
|
||||
pub type T = u8;
|
||||
|
@ -10,10 +10,17 @@
|
||||
|
||||
//! Operations and constants for `uint`
|
||||
|
||||
#[cfg(stage0)]
|
||||
pub use inst::{
|
||||
div_ceil, div_round, div_floor, iterate,
|
||||
next_power_of_two
|
||||
};
|
||||
#[cfg(stage1)]
|
||||
#[cfg(stage2)]
|
||||
pub use self::inst::{
|
||||
div_ceil, div_round, div_floor, iterate,
|
||||
next_power_of_two
|
||||
};
|
||||
|
||||
mod inst {
|
||||
pub type T = uint;
|
||||
@ -169,4 +176,4 @@ mod inst {
|
||||
assert(uint::div_ceil(3u, 4u) == 1u);
|
||||
assert(uint::div_round(3u, 4u) == 1u);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,16 +9,17 @@
|
||||
// except according to those terms.
|
||||
|
||||
|
||||
use syntax::{ast, codemap};
|
||||
use syntax::ast::node_id;
|
||||
use codemap::span;
|
||||
use syntax::ast::{int_ty, uint_ty, float_ty};
|
||||
use syntax::parse::parse_sess;
|
||||
use metadata::filesearch;
|
||||
use back::target_strs;
|
||||
use back::link;
|
||||
use back::target_strs;
|
||||
use metadata::filesearch;
|
||||
use middle::lint;
|
||||
|
||||
use syntax::ast::node_id;
|
||||
use syntax::ast::{int_ty, uint_ty, float_ty};
|
||||
use syntax::codemap::span;
|
||||
use syntax::parse::parse_sess;
|
||||
use syntax::{ast, codemap};
|
||||
|
||||
|
||||
enum os { os_win32, os_macos, os_linux, os_freebsd, }
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
mod intrinsic {
|
||||
#[legacy_exports];
|
||||
|
||||
pub use rusti::visit_tydesc;
|
||||
pub use intrinsic::rusti::visit_tydesc;
|
||||
|
||||
// FIXME (#3727): remove this when the interface has settled and the
|
||||
// version in sys is no longer present.
|
||||
|
@ -17,8 +17,8 @@ use syntax::visit;
|
||||
use syntax::codemap::span;
|
||||
use std::map::HashMap;
|
||||
use syntax::print::pprust;
|
||||
use filesearch::FileSearch;
|
||||
use common::*;
|
||||
use metadata::filesearch::FileSearch;
|
||||
use metadata::common::*;
|
||||
use dvec::DVec;
|
||||
use syntax::parse::token::ident_interner;
|
||||
|
||||
|
@ -10,19 +10,20 @@
|
||||
|
||||
// Searching for information from the cstore
|
||||
|
||||
use std::ebml;
|
||||
use reader = std::ebml::reader;
|
||||
use syntax::ast;
|
||||
use syntax::ast_util;
|
||||
use syntax::ast_map;
|
||||
use metadata::common::*;
|
||||
use middle::ty;
|
||||
use option::{Some, None};
|
||||
use syntax::diagnostic::span_handler;
|
||||
use syntax::diagnostic::expect;
|
||||
use ast_util::dummy_sp;
|
||||
use common::*;
|
||||
|
||||
use core::dvec::DVec;
|
||||
use core::option::{Some, None};
|
||||
use reader = std::ebml::reader;
|
||||
use std::ebml;
|
||||
use std::map::HashMap;
|
||||
use dvec::DVec;
|
||||
use syntax::ast;
|
||||
use syntax::ast_map;
|
||||
use syntax::ast_util::dummy_sp;
|
||||
use syntax::ast_util;
|
||||
use syntax::diagnostic::expect;
|
||||
use syntax::diagnostic::span_handler;
|
||||
|
||||
export struct_dtor;
|
||||
export get_symbol;
|
||||
|
@ -10,27 +10,28 @@
|
||||
|
||||
// Decoding metadata from a single crate's metadata
|
||||
|
||||
use std::ebml;
|
||||
use std::map;
|
||||
use std::map::HashMap;
|
||||
use std::serialization::deserialize;
|
||||
use reader = ebml::reader;
|
||||
use io::WriterUtil;
|
||||
use cmd = metadata::cstore::crate_metadata;
|
||||
use dvec::DVec;
|
||||
use syntax::{ast, ast_util};
|
||||
use syntax::attr;
|
||||
use middle::ty;
|
||||
use syntax::ast_map;
|
||||
use tydecode::{parse_ty_data, parse_def_id, parse_bounds_data,
|
||||
parse_ident};
|
||||
use syntax::print::pprust;
|
||||
use cmd=cstore::crate_metadata;
|
||||
use util::ppaux::ty_to_str;
|
||||
use syntax::diagnostic::span_handler;
|
||||
use common::*;
|
||||
use syntax::parse::token::ident_interner;
|
||||
use hash::{Hash, HashUtil};
|
||||
use csearch::{ProvidedTraitMethodInfo, StaticMethodInfo};
|
||||
use io::WriterUtil;
|
||||
use metadata::common::*;
|
||||
use metadata::csearch::{ProvidedTraitMethodInfo, StaticMethodInfo};
|
||||
use metadata::tydecode::{parse_ty_data, parse_def_id, parse_bounds_data};
|
||||
use metadata::tydecode::{parse_ident};
|
||||
use middle::ty;
|
||||
use util::ppaux::ty_to_str;
|
||||
|
||||
use reader = std::ebml::reader;
|
||||
use std::ebml;
|
||||
use std::map::HashMap;
|
||||
use std::map;
|
||||
use std::serialization::deserialize;
|
||||
use syntax::ast_map;
|
||||
use syntax::attr;
|
||||
use syntax::diagnostic::span_handler;
|
||||
use syntax::parse::token::ident_interner;
|
||||
use syntax::print::pprust;
|
||||
use syntax::{ast, ast_util};
|
||||
|
||||
export struct_dtor;
|
||||
export get_struct_fields;
|
||||
|
@ -15,12 +15,12 @@ use util::ppaux::ty_to_str;
|
||||
use std::{ebml, map};
|
||||
use std::map::HashMap;
|
||||
use io::WriterUtil;
|
||||
use writer = ebml::writer;
|
||||
use writer = std::ebml::writer;
|
||||
use syntax::ast::*;
|
||||
use syntax::print::pprust;
|
||||
use syntax::{ast_util, visit};
|
||||
use syntax::ast_util::*;
|
||||
use common::*;
|
||||
use metadata::common::*;
|
||||
use middle::ty;
|
||||
use middle::ty::node_id_to_type;
|
||||
use middle::resolve;
|
||||
|
@ -15,7 +15,7 @@ use syntax::{ast, attr};
|
||||
use syntax::print::pprust;
|
||||
use syntax::codemap::span;
|
||||
use lib::llvm::{False, llvm, mk_object_file, mk_section_iter};
|
||||
use filesearch::FileSearch;
|
||||
use metadata::filesearch::FileSearch;
|
||||
use io::WriterUtil;
|
||||
use syntax::parse::token::ident_interner;
|
||||
|
||||
|
@ -41,35 +41,3 @@ mod loader;
|
||||
#[legacy_exports]
|
||||
mod filesearch;
|
||||
|
||||
|
||||
// Define the rustc API's that the metadata module has access to
|
||||
// Over time we will reduce these dependencies and, once metadata has
|
||||
// no dependencies on rustc it can move into its own crate.
|
||||
|
||||
mod middle {
|
||||
#[legacy_exports];
|
||||
pub use middle_::ty;
|
||||
pub use middle_::resolve;
|
||||
}
|
||||
|
||||
mod front {
|
||||
#[legacy_exports];
|
||||
}
|
||||
|
||||
mod back {
|
||||
#[legacy_exports];
|
||||
}
|
||||
|
||||
mod driver {
|
||||
#[legacy_exports];
|
||||
}
|
||||
|
||||
mod util {
|
||||
#[legacy_exports];
|
||||
pub use util_::ppaux;
|
||||
}
|
||||
|
||||
mod lib {
|
||||
#[legacy_exports];
|
||||
pub use lib_::llvm;
|
||||
}
|
||||
|
@ -13,13 +13,14 @@
|
||||
// tjc note: Would be great to have a `match check` macro equivalent
|
||||
// for some of these
|
||||
|
||||
use middle::ty;
|
||||
use middle::ty::{FnTyBase, FnMeta, FnSig};
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::ast::*;
|
||||
use syntax::ast_util;
|
||||
use syntax::ast_util::respan;
|
||||
use middle::ty;
|
||||
use std::map::HashMap;
|
||||
use ty::{FnTyBase, FnMeta, FnSig};
|
||||
|
||||
export parse_state_from_data;
|
||||
export parse_arg_data, parse_ty_data, parse_def_id, parse_ident;
|
||||
|
@ -8,46 +8,40 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use c = metadata::common;
|
||||
use cstore = metadata::cstore;
|
||||
use driver::session::Session;
|
||||
use e = metadata::encoder;
|
||||
use metadata::decoder;
|
||||
use metadata::encoder;
|
||||
use metadata::tydecode;
|
||||
use metadata::tyencode;
|
||||
use middle::freevars::freevar_entry;
|
||||
use middle::typeck::{method_origin, method_map_entry, vtable_res};
|
||||
use middle::typeck::{vtable_origin};
|
||||
use middle::{ty, typeck};
|
||||
use util::ppaux::ty_to_str;
|
||||
|
||||
use reader = std::ebml::reader;
|
||||
use std::ebml::reader::get_doc;
|
||||
use std::ebml::writer::Serializer;
|
||||
use std::ebml;
|
||||
use std::map::HashMap;
|
||||
use std::serialization::{DeserializerHelpers, deserialize};
|
||||
use std::serialization::{Serializable, SerializerHelpers};
|
||||
use std::serialization;
|
||||
use syntax::ast;
|
||||
use syntax::fold;
|
||||
use syntax::fold::*;
|
||||
use syntax::visit;
|
||||
use syntax::ast_map;
|
||||
use syntax::ast_util;
|
||||
use syntax::codemap::span;
|
||||
use std::ebml;
|
||||
use writer = std::ebml::writer;
|
||||
use reader = std::ebml::reader;
|
||||
use reader::get_doc;
|
||||
use writer::Serializer;
|
||||
use std::map::HashMap;
|
||||
use std::serialization;
|
||||
use std::serialization::{Serializable,
|
||||
SerializerHelpers,
|
||||
DeserializerHelpers,
|
||||
deserialize};
|
||||
use middle::{ty, typeck};
|
||||
use middle::typeck::{method_origin, method_map_entry,
|
||||
vtable_res,
|
||||
vtable_origin};
|
||||
use driver::session::Session;
|
||||
use middle::freevars::freevar_entry;
|
||||
use c = metadata::common;
|
||||
use e = metadata::encoder;
|
||||
use cstore = metadata::cstore;
|
||||
use metadata::encoder;
|
||||
use metadata::decoder;
|
||||
use metadata::tyencode;
|
||||
use metadata::tydecode;
|
||||
|
||||
|
||||
// used in testing:
|
||||
use syntax::diagnostic;
|
||||
use syntax::codemap;
|
||||
use syntax::diagnostic;
|
||||
use syntax::fold::*;
|
||||
use syntax::fold;
|
||||
use syntax::parse;
|
||||
use syntax::print::pprust;
|
||||
use syntax::visit;
|
||||
use writer = std::ebml::writer;
|
||||
|
||||
export maps;
|
||||
export encode_inlined_item;
|
||||
|
@ -16,9 +16,9 @@
|
||||
// their associated scopes. In phase two, checking loans, we will then make
|
||||
// sure that all of these loans are honored.
|
||||
|
||||
use mem_categorization::{mem_categorization_ctxt, opt_deref_kind};
|
||||
use preserve::{preserve_condition, pc_ok, pc_if_pure};
|
||||
use ty::{ty_region};
|
||||
use middle::mem_categorization::{mem_categorization_ctxt, opt_deref_kind};
|
||||
use middle::borrowck::preserve::{preserve_condition, pc_ok, pc_if_pure};
|
||||
use middle::ty::{ty_region};
|
||||
|
||||
use core::send_map::linear::LinearMap;
|
||||
|
||||
|
@ -226,34 +226,36 @@ Borrowck results in two maps.
|
||||
|
||||
#[legacy_exports];
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::ast::{mutability, m_mutbl, m_imm, m_const};
|
||||
use syntax::visit;
|
||||
use syntax::ast_util;
|
||||
use syntax::ast_map;
|
||||
use syntax::codemap::span;
|
||||
use util::ppaux::{ty_to_str, region_to_str, explain_region,
|
||||
expr_repr, note_and_explain_region};
|
||||
use std::map::{HashMap, Set};
|
||||
use std::list;
|
||||
use std::list::{List, Cons, Nil};
|
||||
use result::{Result, Ok, Err};
|
||||
use syntax::print::pprust;
|
||||
use middle::mem_categorization::*;
|
||||
use middle::ty::to_str;
|
||||
use util::common::indenter;
|
||||
use ty::to_str;
|
||||
use dvec::DVec;
|
||||
use mem_categorization::*;
|
||||
use util::ppaux::{expr_repr, note_and_explain_region};
|
||||
use util::ppaux::{ty_to_str, region_to_str, explain_region};
|
||||
|
||||
use core::dvec::DVec;
|
||||
use core::result::{Result, Ok, Err};
|
||||
use std::list::{List, Cons, Nil};
|
||||
use std::list;
|
||||
use std::map::{HashMap, Set};
|
||||
use syntax::ast::{mutability, m_mutbl, m_imm, m_const};
|
||||
use syntax::ast;
|
||||
use syntax::ast_map;
|
||||
use syntax::ast_util;
|
||||
use syntax::codemap::span;
|
||||
use syntax::print::pprust;
|
||||
use syntax::visit;
|
||||
|
||||
#[legacy_exports]
|
||||
mod check_loans;
|
||||
pub mod check_loans;
|
||||
#[legacy_exports]
|
||||
mod gather_loans;
|
||||
pub mod gather_loans;
|
||||
#[legacy_exports]
|
||||
mod loan;
|
||||
pub mod loan;
|
||||
#[legacy_exports]
|
||||
mod preserve;
|
||||
pub mod preserve;
|
||||
|
||||
export check_crate, root_map, mutbl_map;
|
||||
export check_loans, gather_loans, loan, preserve;
|
||||
|
||||
fn check_crate(tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
|
@ -8,19 +8,20 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use middle::const_eval::{compare_const_vals, lookup_const_by_id};
|
||||
use middle::const_eval::{eval_const_expr, const_val, const_int, const_bool};
|
||||
use middle::pat_util::*;
|
||||
use middle::ty::*;
|
||||
use middle::ty;
|
||||
use middle::typeck::method_map;
|
||||
use util::ppaux::ty_to_str;
|
||||
|
||||
use std::map::HashMap;
|
||||
use syntax::ast::*;
|
||||
use syntax::ast_util::{variant_def_ids, dummy_sp, unguarded_pat, walk_pat};
|
||||
use const_eval::{eval_const_expr, const_val, const_int, const_bool,
|
||||
compare_const_vals, lookup_const_by_id};
|
||||
use syntax::codemap::span;
|
||||
use syntax::print::pprust::pat_to_str;
|
||||
use util::ppaux::ty_to_str;
|
||||
use pat_util::*;
|
||||
use syntax::visit;
|
||||
use middle::ty;
|
||||
use middle::ty::*;
|
||||
use middle::typeck::method_map;
|
||||
use std::map::HashMap;
|
||||
|
||||
struct AltCheckCtxt {
|
||||
tcx: ty::ctxt,
|
||||
|
@ -8,8 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use syntax::{ast,ast_map,ast_util,visit};
|
||||
use ast::*;
|
||||
use syntax::{ast, ast_map, ast_util, visit};
|
||||
use syntax::ast::*;
|
||||
|
||||
//
|
||||
// This pass classifies expressions by their constant-ness.
|
||||
|
@ -8,16 +8,17 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use syntax::{visit, ast_util};
|
||||
use middle::freevars::freevar_entry;
|
||||
use middle::lint::{non_implicitly_copyable_typarams, implicit_copies};
|
||||
use middle::ty::{CopyValue, MoveValue, ReadValue};
|
||||
use middle::ty::{Kind, kind_copyable, kind_noncopyable, kind_const};
|
||||
use util::ppaux::{ty_to_str, tys_to_str};
|
||||
|
||||
use std::map::HashMap;
|
||||
use syntax::ast::*;
|
||||
use syntax::codemap::span;
|
||||
use middle::ty::{Kind, kind_copyable, kind_noncopyable, kind_const};
|
||||
use middle::ty::{CopyValue, MoveValue, ReadValue};
|
||||
use std::map::HashMap;
|
||||
use util::ppaux::{ty_to_str, tys_to_str};
|
||||
use syntax::print::pprust::expr_to_str;
|
||||
use freevars::freevar_entry;
|
||||
use lint::{non_implicitly_copyable_typarams,implicit_copies};
|
||||
use syntax::{visit, ast_util};
|
||||
|
||||
// Kind analysis pass.
|
||||
//
|
||||
|
@ -102,17 +102,18 @@
|
||||
* to return explicitly.
|
||||
*/
|
||||
|
||||
use dvec::DVec;
|
||||
use std::map::HashMap;
|
||||
use syntax::{visit, ast_util};
|
||||
use syntax::print::pprust::{expr_to_str, block_to_str};
|
||||
use visit::vt;
|
||||
use syntax::codemap::span;
|
||||
use syntax::ast::*;
|
||||
use io::WriterUtil;
|
||||
use capture::{cap_move, cap_drop, cap_copy, cap_ref};
|
||||
use middle::capture::{cap_move, cap_drop, cap_copy, cap_ref};
|
||||
use middle::ty::MoveValue;
|
||||
|
||||
use core::dvec::DVec;
|
||||
use core::io::WriterUtil;
|
||||
use std::map::HashMap;
|
||||
use syntax::ast::*;
|
||||
use syntax::codemap::span;
|
||||
use syntax::print::pprust::{expr_to_str, block_to_str};
|
||||
use syntax::visit::vt;
|
||||
use syntax::{visit, ast_util};
|
||||
|
||||
export check_crate;
|
||||
export last_use_map;
|
||||
|
||||
|
@ -11,6 +11,9 @@
|
||||
// A pass that checks to make sure private fields and methods aren't used
|
||||
// outside their scopes.
|
||||
|
||||
use middle::ty::{ty_struct, ty_enum};
|
||||
use middle::typeck::{method_map, method_origin, method_param, method_self};
|
||||
use middle::typeck::{method_static, method_trait};
|
||||
use /*mod*/ syntax::ast;
|
||||
use /*mod*/ syntax::visit;
|
||||
use syntax::ast_map;
|
||||
@ -21,9 +24,6 @@ use syntax::ast::{provided, required};
|
||||
use syntax::ast_map::{node_item, node_method};
|
||||
use syntax::ast_util::{Private, Public, has_legacy_export_attr, is_local};
|
||||
use syntax::ast_util::{visibility_to_privacy};
|
||||
use ty::{ty_struct, ty_enum};
|
||||
use typeck::{method_map, method_origin, method_param, method_self};
|
||||
use typeck::{method_static, method_trait};
|
||||
|
||||
use core::util::ignore;
|
||||
use dvec::DVec;
|
||||
|
@ -18,18 +18,19 @@ region parameterized.
|
||||
*/
|
||||
|
||||
use driver::session::Session;
|
||||
use middle::ty;
|
||||
use syntax::{ast, visit};
|
||||
use syntax::codemap::span;
|
||||
use syntax::print::pprust;
|
||||
use syntax::ast_map;
|
||||
use dvec::DVec;
|
||||
use metadata::csearch;
|
||||
use ty::{region_variance, rv_covariant, rv_invariant, rv_contravariant};
|
||||
use middle::ty::{region_variance, rv_covariant, rv_invariant};
|
||||
use middle::ty::{rv_contravariant};
|
||||
use middle::ty;
|
||||
|
||||
use core::dvec::DVec;
|
||||
use std::list;
|
||||
use std::list::list;
|
||||
use std::map::HashMap;
|
||||
use syntax::ast_map;
|
||||
use syntax::codemap::span;
|
||||
use syntax::print::pprust;
|
||||
use syntax::{ast, visit};
|
||||
|
||||
type parent = Option<ast::node_id>;
|
||||
|
||||
|
@ -313,6 +313,16 @@ enum XrayFlag {
|
||||
Xray //< Private items can be accessed.
|
||||
}
|
||||
|
||||
enum UseLexicalScopeFlag {
|
||||
DontUseLexicalScope,
|
||||
UseLexicalScope
|
||||
}
|
||||
|
||||
struct ModulePrefixResult {
|
||||
result: ResolveResult<@Module>,
|
||||
prefix_len: uint
|
||||
}
|
||||
|
||||
impl XrayFlag : cmp::Eq {
|
||||
pure fn eq(&self, other: &XrayFlag) -> bool {
|
||||
((*self) as uint) == ((*other) as uint)
|
||||
@ -2108,9 +2118,10 @@ impl Resolver {
|
||||
} else {
|
||||
// First, resolve the module path for the directive, if necessary.
|
||||
match self.resolve_module_path_for_import(module_,
|
||||
module_path,
|
||||
NoXray,
|
||||
import_directive.span) {
|
||||
module_path,
|
||||
NoXray,
|
||||
DontUseLexicalScope,
|
||||
import_directive.span) {
|
||||
|
||||
Failed => {
|
||||
resolution_result = Failed;
|
||||
@ -2650,8 +2661,11 @@ impl Resolver {
|
||||
|
||||
while index < module_path_len {
|
||||
let name = (*module_path).get_elt(index);
|
||||
match self.resolve_name_in_module(search_module, name, TypeNS,
|
||||
xray) {
|
||||
match self.resolve_name_in_module(search_module,
|
||||
name,
|
||||
TypeNS,
|
||||
xray,
|
||||
false) {
|
||||
Failed => {
|
||||
self.session.span_err(span, ~"unresolved name");
|
||||
return Failed;
|
||||
@ -2702,12 +2716,13 @@ impl Resolver {
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to resolve the module part of an import directive rooted at
|
||||
* the given module.
|
||||
* Attempts to resolve the module part of an import directive or path
|
||||
* rooted at the given module.
|
||||
*/
|
||||
fn resolve_module_path_for_import(module_: @Module,
|
||||
module_path: @DVec<ident>,
|
||||
xray: XrayFlag,
|
||||
use_lexical_scope: UseLexicalScopeFlag,
|
||||
span: span)
|
||||
-> ResolveResult<@Module> {
|
||||
|
||||
@ -2722,9 +2737,20 @@ impl Resolver {
|
||||
// The first element of the module path must be in the current scope
|
||||
// chain.
|
||||
|
||||
let first_element = (*module_path).get_elt(0);
|
||||
let resolve_result = match use_lexical_scope {
|
||||
DontUseLexicalScope => {
|
||||
self.resolve_module_prefix(module_, module_path)
|
||||
}
|
||||
UseLexicalScope => {
|
||||
let result = self.resolve_module_in_lexical_scope(
|
||||
module_,
|
||||
module_path.get_elt(0));
|
||||
ModulePrefixResult { result: result, prefix_len: 1 }
|
||||
}
|
||||
};
|
||||
|
||||
let mut search_module;
|
||||
match self.resolve_module_in_lexical_scope(module_, first_element) {
|
||||
match resolve_result.result {
|
||||
Failed => {
|
||||
self.session.span_err(span, ~"unresolved name");
|
||||
return Failed;
|
||||
@ -2740,10 +2766,10 @@ impl Resolver {
|
||||
}
|
||||
|
||||
return self.resolve_module_path_from_root(search_module,
|
||||
module_path,
|
||||
1,
|
||||
xray,
|
||||
span);
|
||||
module_path,
|
||||
resolve_result.prefix_len,
|
||||
xray,
|
||||
span);
|
||||
}
|
||||
|
||||
fn resolve_item_in_lexical_scope(module_: @Module,
|
||||
@ -2811,8 +2837,11 @@ impl Resolver {
|
||||
}
|
||||
|
||||
// Resolve the name in the parent module.
|
||||
match self.resolve_name_in_module(search_module, name, namespace,
|
||||
Xray) {
|
||||
match self.resolve_name_in_module(search_module,
|
||||
name,
|
||||
namespace,
|
||||
Xray,
|
||||
false) {
|
||||
Failed => {
|
||||
// Continue up the search chain.
|
||||
}
|
||||
@ -2832,9 +2861,15 @@ impl Resolver {
|
||||
}
|
||||
}
|
||||
|
||||
/** Resolves a module name in the current lexical scope. */
|
||||
fn resolve_module_in_lexical_scope(module_: @Module, name: ident)
|
||||
-> ResolveResult<@Module> {
|
||||
match self.resolve_item_in_lexical_scope(module_, name, TypeNS) {
|
||||
// If this module is an anonymous module, resolve the item in the
|
||||
// lexical scope. Otherwise, resolve the item from the crate root.
|
||||
let resolve_result = self.resolve_item_in_lexical_scope(module_,
|
||||
name,
|
||||
TypeNS);
|
||||
match resolve_result {
|
||||
Success(target) => {
|
||||
match target.bindings.type_def {
|
||||
Some(ref type_def) => {
|
||||
@ -2870,6 +2905,102 @@ impl Resolver {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves a "module prefix". A module prefix is one of (a) the name of a
|
||||
* module; (b) "self::"; (c) some chain of "super::".
|
||||
*/
|
||||
fn resolve_module_prefix(module_: @Module,
|
||||
module_path: @DVec<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 ||
|
||||
@ -2884,7 +3015,8 @@ impl Resolver {
|
||||
fn resolve_name_in_module(module_: @Module,
|
||||
name: ident,
|
||||
namespace: Namespace,
|
||||
xray: XrayFlag)
|
||||
xray: XrayFlag,
|
||||
allow_globs: bool)
|
||||
-> ResolveResult<Target> {
|
||||
|
||||
debug!("(resolving name in module) resolving `%s` in `%s`",
|
||||
@ -2910,10 +3042,10 @@ impl Resolver {
|
||||
}
|
||||
}
|
||||
|
||||
// Next, check the module's imports. If the module has a glob, then
|
||||
// we bail out; we don't know its imports yet.
|
||||
|
||||
if module_.glob_count > 0 {
|
||||
// Next, check the module's imports. If the module has a glob and
|
||||
// globs were not allowed, then we bail out; we don't know its imports
|
||||
// yet.
|
||||
if !allow_globs && module_.glob_count > 0 {
|
||||
debug!("(resolving name in module) module has glob; bailing out");
|
||||
return Indeterminate;
|
||||
}
|
||||
@ -4627,10 +4759,10 @@ impl Resolver {
|
||||
|
||||
let mut containing_module;
|
||||
match self.resolve_module_path_for_import(self.current_module,
|
||||
module_path_idents,
|
||||
xray,
|
||||
path.span) {
|
||||
|
||||
module_path_idents,
|
||||
xray,
|
||||
UseLexicalScope,
|
||||
path.span) {
|
||||
Failed => {
|
||||
self.session.span_err(path.span,
|
||||
fmt!("use of undeclared module `%s`",
|
||||
|
@ -142,26 +142,27 @@
|
||||
*
|
||||
*/
|
||||
|
||||
use back::abi;
|
||||
use lib::llvm::llvm;
|
||||
use lib::llvm::{ValueRef, BasicBlockRef};
|
||||
use pat_util::*;
|
||||
use build::*;
|
||||
use base::*;
|
||||
use syntax::ast;
|
||||
use syntax::ast_util;
|
||||
use syntax::ast_util::{dummy_sp, path_to_ident};
|
||||
use middle::pat_util::*;
|
||||
use middle::resolve::DefMap;
|
||||
use middle::trans::base::*;
|
||||
use middle::trans::build::*;
|
||||
use middle::trans::common::*;
|
||||
use middle::trans::datum::*;
|
||||
use middle::trans::expr::Dest;
|
||||
use middle::ty::{CopyValue, MoveValue, ReadValue};
|
||||
use util::common::indenter;
|
||||
|
||||
use core::dvec::DVec;
|
||||
use std::map::HashMap;
|
||||
use syntax::ast::def_id;
|
||||
use syntax::ast;
|
||||
use syntax::ast_util::{dummy_sp, path_to_ident};
|
||||
use syntax::ast_util;
|
||||
use syntax::codemap::span;
|
||||
use syntax::print::pprust::pat_to_str;
|
||||
use middle::resolve::DefMap;
|
||||
use middle::ty::{CopyValue, MoveValue, ReadValue};
|
||||
use back::abi;
|
||||
use std::map::HashMap;
|
||||
use dvec::DVec;
|
||||
use datum::*;
|
||||
use common::*;
|
||||
use expr::Dest;
|
||||
use util::common::indenter;
|
||||
|
||||
fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export.
|
||||
|
||||
|
@ -23,45 +23,44 @@
|
||||
// but many TypeRefs correspond to one ty::t; for instance, tup(int, int,
|
||||
// int) and rec(x=int, y=int, z=int) will have the same TypeRef.
|
||||
|
||||
use libc::{c_uint, c_ulonglong};
|
||||
use std::{map, time, list};
|
||||
use std::map::HashMap;
|
||||
use driver::session;
|
||||
use session::Session;
|
||||
use syntax::attr;
|
||||
use back::link::{mangle_exported_name};
|
||||
use back::link::{mangle_internal_name_by_path_and_seq};
|
||||
use back::link::{mangle_internal_name_by_path};
|
||||
use back::link::{mangle_internal_name_by_seq};
|
||||
use back::link::{mangle_internal_name_by_type_only};
|
||||
use back::{link, abi, upcall};
|
||||
use syntax::{ast, ast_util, codemap, ast_map};
|
||||
use ast_util::{def_id_of_def, local_def, path_to_ident};
|
||||
use syntax::visit;
|
||||
use syntax::codemap::span;
|
||||
use syntax::print::pprust::{expr_to_str, stmt_to_str, path_to_str};
|
||||
use pat_util::*;
|
||||
use visit::vt;
|
||||
use util::common::is_main_name;
|
||||
use lib::llvm::{llvm, mk_target_data, mk_type_names};
|
||||
use driver::session;
|
||||
use driver::session::Session;
|
||||
use lib::llvm::{ModuleRef, ValueRef, TypeRef, BasicBlockRef};
|
||||
use lib::llvm::{True, False};
|
||||
use link::{mangle_internal_name_by_type_only,
|
||||
mangle_internal_name_by_seq,
|
||||
mangle_internal_name_by_path,
|
||||
mangle_internal_name_by_path_and_seq,
|
||||
mangle_exported_name};
|
||||
use metadata::{csearch, cstore, decoder, encoder};
|
||||
use lib::llvm::{llvm, mk_target_data, mk_type_names};
|
||||
use metadata::common::link_meta;
|
||||
use util::ppaux;
|
||||
use util::ppaux::{ty_to_str, ty_to_short_str};
|
||||
use syntax::diagnostic::expect;
|
||||
use metadata::{csearch, cstore, decoder, encoder};
|
||||
use middle::pat_util::*;
|
||||
use middle::trans::build::*;
|
||||
use middle::trans::common::*;
|
||||
use middle::trans::shape::*;
|
||||
use middle::trans::type_of::*;
|
||||
use util::common::indenter;
|
||||
use util::common::is_main_name;
|
||||
use util::ppaux::{ty_to_str, ty_to_short_str};
|
||||
use util::ppaux;
|
||||
|
||||
use build::*;
|
||||
use shape::*;
|
||||
use type_of::*;
|
||||
use common::*;
|
||||
use syntax::ast_map::{path, path_mod, path_name};
|
||||
use syntax::parse::token::special_idents;
|
||||
|
||||
use core::libc::{c_uint, c_ulonglong};
|
||||
use core::option::{is_none, is_some};
|
||||
use std::map::HashMap;
|
||||
use std::smallintmap;
|
||||
use option::{is_none, is_some};
|
||||
use std::{map, time, list};
|
||||
use syntax::ast_map::{path, path_mod, path_name};
|
||||
use syntax::ast_util::{def_id_of_def, local_def, path_to_ident};
|
||||
use syntax::attr;
|
||||
use syntax::codemap::span;
|
||||
use syntax::diagnostic::expect;
|
||||
use syntax::parse::token::special_idents;
|
||||
use syntax::print::pprust::{expr_to_str, stmt_to_str, path_to_str};
|
||||
use syntax::visit;
|
||||
use syntax::visit::vt;
|
||||
use syntax::{ast, ast_util, codemap, ast_map};
|
||||
|
||||
struct icx_popper {
|
||||
ccx: @crate_ctxt,
|
||||
@ -1228,7 +1227,7 @@ fn with_scope_datumblock(bcx: block, opt_node_info: Option<node_info>,
|
||||
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);
|
||||
|
@ -8,15 +8,16 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::map::HashMap;
|
||||
use libc::{c_uint, c_int};
|
||||
use lib::llvm::llvm;
|
||||
use syntax::codemap;
|
||||
use codemap::span;
|
||||
use lib::llvm::llvm;
|
||||
use lib::llvm::{CallConv, TypeKind, AtomicBinOp, AtomicOrdering};
|
||||
use lib::llvm::{Opcode, IntPredicate, RealPredicate, True, False};
|
||||
use lib::llvm::{ValueRef, TypeRef, BasicBlockRef, BuilderRef, ModuleRef};
|
||||
use lib::llvm::{Opcode, IntPredicate, RealPredicate, True, False,
|
||||
CallConv, TypeKind, AtomicBinOp, AtomicOrdering};
|
||||
use common::*;
|
||||
use libc::{c_uint, c_int};
|
||||
use middle::trans::common::*;
|
||||
|
||||
use std::map::HashMap;
|
||||
use syntax::codemap;
|
||||
|
||||
fn B(cx: block) -> BuilderRef {
|
||||
let b = cx.fcx.ccx.builder.B;
|
||||
|
@ -17,16 +17,17 @@
|
||||
// closure.
|
||||
|
||||
use lib::llvm::ValueRef;
|
||||
use syntax::ast;
|
||||
use datum::Datum;
|
||||
use common::{block, node_id_type_params};
|
||||
use build::*;
|
||||
use base::{get_item_val, trans_external_path};
|
||||
use syntax::visit;
|
||||
use syntax::print::pprust::{expr_to_str, stmt_to_str, path_to_str};
|
||||
use datum::*;
|
||||
use middle::trans::base::{get_item_val, trans_external_path};
|
||||
use middle::trans::build::*;
|
||||
use middle::trans::common::{block, node_id_type_params};
|
||||
use middle::trans::datum::*;
|
||||
use middle::trans::datum::Datum;
|
||||
use util::common::indenter;
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::print::pprust::{expr_to_str, stmt_to_str, path_to_str};
|
||||
use syntax::visit;
|
||||
|
||||
// Represents a (possibly monomorphized) top-level fn item or method
|
||||
// item. Note that this is just the fn-ptr and is not a Rust closure
|
||||
// value (which is a pair).
|
||||
|
@ -8,26 +8,25 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use libc::c_uint;
|
||||
use syntax::ast;
|
||||
use syntax::ast_util;
|
||||
use back::abi;
|
||||
use back::link::{mangle_internal_name_by_path_and_seq};
|
||||
use back::link::{mangle_internal_name_by_path};
|
||||
use lib::llvm::llvm;
|
||||
use lib::llvm::{ValueRef, TypeRef};
|
||||
use common::*;
|
||||
use build::*;
|
||||
use base::*;
|
||||
use type_of::*;
|
||||
use back::abi;
|
||||
use middle::trans::base::*;
|
||||
use middle::trans::build::*;
|
||||
use middle::trans::common::*;
|
||||
use middle::trans::datum::{Datum, INIT, ByRef, ByValue, FromLvalue};
|
||||
use middle::trans::type_of::*;
|
||||
use util::ppaux::ty_to_str;
|
||||
|
||||
use core::libc::c_uint;
|
||||
use std::map::HashMap;
|
||||
use syntax::ast;
|
||||
use syntax::ast_map::{path, path_mod, path_name};
|
||||
use syntax::ast_util;
|
||||
use syntax::codemap::span;
|
||||
use syntax::print::pprust::expr_to_str;
|
||||
use back::link::{
|
||||
mangle_internal_name_by_path,
|
||||
mangle_internal_name_by_path_and_seq};
|
||||
use util::ppaux::ty_to_str;
|
||||
use syntax::ast_map::{path, path_mod, path_name};
|
||||
use driver::session::session;
|
||||
use std::map::HashMap;
|
||||
use datum::{Datum, INIT, ByRef, ByValue, FromLvalue};
|
||||
|
||||
// ___Good to know (tm)__________________________________________________
|
||||
//
|
||||
|
@ -8,9 +8,10 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use common::*;
|
||||
use middle::trans::base::get_insn_ctxt;
|
||||
use middle::trans::common::*;
|
||||
|
||||
use syntax::{ast, ast_util, codemap, ast_map};
|
||||
use base::get_insn_ctxt;
|
||||
|
||||
fn const_lit(cx: @crate_ctxt, e: @ast::expr, lit: ast::lit)
|
||||
-> ValueRef {
|
||||
|
@ -9,9 +9,9 @@
|
||||
// except according to those terms.
|
||||
|
||||
use lib::llvm::ValueRef;
|
||||
use common::*;
|
||||
use datum::*;
|
||||
use base::*;
|
||||
use middle::trans::base::*;
|
||||
use middle::trans::common::*;
|
||||
use middle::trans::datum::*;
|
||||
|
||||
fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export.
|
||||
|
||||
|
@ -96,11 +96,11 @@
|
||||
* values. */
|
||||
|
||||
use lib::llvm::ValueRef;
|
||||
use base::*;
|
||||
use common::*;
|
||||
use build::*;
|
||||
use util::ppaux::ty_to_str;
|
||||
use middle::trans::base::*;
|
||||
use middle::trans::build::*;
|
||||
use middle::trans::common::*;
|
||||
use util::common::indenter;
|
||||
use util::ppaux::ty_to_str;
|
||||
|
||||
enum CopyAction {
|
||||
INIT,
|
||||
|
@ -8,21 +8,22 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::map;
|
||||
use std::map::HashMap;
|
||||
use lib::llvm::llvm;
|
||||
use driver::session;
|
||||
use lib::llvm::ValueRef;
|
||||
use trans::common::*;
|
||||
use trans::base;
|
||||
use trans::build::B;
|
||||
use lib::llvm::llvm;
|
||||
use middle::pat_util::*;
|
||||
use middle::trans::base;
|
||||
use middle::trans::build::B;
|
||||
use middle::trans::common::*;
|
||||
use middle::ty;
|
||||
use syntax::{ast, codemap, ast_util, ast_map};
|
||||
use syntax::parse::token::ident_interner;
|
||||
use codemap::{span, CharPos};
|
||||
use ast::Ty;
|
||||
use pat_util::*;
|
||||
use util::ppaux::ty_to_str;
|
||||
use driver::session::session;
|
||||
|
||||
use std::map::HashMap;
|
||||
use std::map;
|
||||
use syntax::ast::Ty;
|
||||
use syntax::codemap::{span, CharPos};
|
||||
use syntax::parse::token::ident_interner;
|
||||
use syntax::{ast, codemap, ast_util, ast_map};
|
||||
|
||||
export create_local_var;
|
||||
export create_function;
|
||||
|
@ -111,17 +111,18 @@ lvalues are *never* stored by value.
|
||||
|
||||
*/
|
||||
|
||||
use ty::struct_mutable_fields;
|
||||
use lib::llvm::ValueRef;
|
||||
use common::*;
|
||||
use datum::*;
|
||||
use base::*;
|
||||
use syntax::print::pprust::{expr_to_str};
|
||||
use util::ppaux::ty_to_str;
|
||||
use util::common::indenter;
|
||||
use ty::{AutoPtr, AutoBorrowVec, AutoBorrowVecRef, AutoBorrowFn};
|
||||
use callee::{AutorefArg, DoAutorefArg, DontAutorefArg};
|
||||
use middle::trans::base::*;
|
||||
use middle::trans::callee::{AutorefArg, DoAutorefArg, DontAutorefArg};
|
||||
use middle::trans::common::*;
|
||||
use middle::trans::datum::*;
|
||||
use middle::ty::MoveValue;
|
||||
use middle::ty::struct_mutable_fields;
|
||||
use middle::ty::{AutoPtr, AutoBorrowVec, AutoBorrowVecRef, AutoBorrowFn};
|
||||
use util::common::indenter;
|
||||
use util::ppaux::ty_to_str;
|
||||
|
||||
use syntax::print::pprust::{expr_to_str};
|
||||
|
||||
// The primary two functions for translating expressions:
|
||||
export trans_to_datum, trans_into;
|
||||
|
@ -11,26 +11,27 @@
|
||||
// The classification code for the x86_64 ABI is taken from the clay language
|
||||
// https://github.com/jckarter/clay/blob/master/compiler/src/externals.cpp
|
||||
|
||||
use driver::session::arch_x86_64;
|
||||
use syntax::codemap::span;
|
||||
use libc::c_uint;
|
||||
use syntax::{attr, ast_map};
|
||||
use lib::llvm::{ llvm, TypeRef, ValueRef, Integer, Pointer, Float, Double,
|
||||
Struct, Array, ModuleRef, CallConv, Attribute,
|
||||
StructRetAttribute, ByValAttribute,
|
||||
SequentiallyConsistent, Acquire, Release, Xchg };
|
||||
use syntax::{ast, ast_util};
|
||||
use back::{link, abi};
|
||||
use common::*;
|
||||
use build::*;
|
||||
use base::*;
|
||||
use type_of::*;
|
||||
use std::map::HashMap;
|
||||
use driver::session::arch_x86_64;
|
||||
use lib::llvm::{SequentiallyConsistent, Acquire, Release, Xchg};
|
||||
use lib::llvm::{Struct, Array, ModuleRef, CallConv, Attribute};
|
||||
use lib::llvm::{StructRetAttribute, ByValAttribute};
|
||||
use lib::llvm::{llvm, TypeRef, ValueRef, Integer, Pointer, Float, Double};
|
||||
use middle::trans::base::*;
|
||||
use middle::trans::build::*;
|
||||
use middle::trans::callee::*;
|
||||
use middle::trans::common::*;
|
||||
use middle::trans::datum::*;
|
||||
use middle::trans::expr::{Dest, Ignore};
|
||||
use middle::trans::type_of::*;
|
||||
use middle::ty::{FnTyBase, FnMeta, FnSig};
|
||||
use util::ppaux::ty_to_str;
|
||||
use datum::*;
|
||||
use callee::*;
|
||||
use expr::{Dest, Ignore};
|
||||
use ty::{FnTyBase, FnMeta, FnSig};
|
||||
|
||||
use core::libc::c_uint;
|
||||
use std::map::HashMap;
|
||||
use syntax::codemap::span;
|
||||
use syntax::{ast, ast_util};
|
||||
use syntax::{attr, ast_map};
|
||||
|
||||
export link_name, trans_foreign_mod, register_foreign_fn, trans_foreign_fn,
|
||||
trans_intrinsic;
|
||||
|
@ -13,10 +13,10 @@
|
||||
// Code relating to taking, dropping, etc as well as type descriptors.
|
||||
|
||||
use lib::llvm::{ValueRef, TypeRef};
|
||||
use base::*;
|
||||
use common::*;
|
||||
use build::*;
|
||||
use type_of::type_of;
|
||||
use middle::trans::base::*;
|
||||
use middle::trans::common::*;
|
||||
use middle::trans::build::*;
|
||||
use middle::trans::type_of::type_of;
|
||||
|
||||
fn trans_free(cx: block, v: ValueRef) -> block {
|
||||
let _icx = cx.insn_ctxt("trans_free");
|
||||
|
@ -8,12 +8,14 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use common::*;
|
||||
use middle::trans::base::{get_insn_ctxt};
|
||||
use middle::trans::base::{impl_owned_self, impl_self, no_self};
|
||||
use middle::trans::base::{trans_item, get_item_val, self_arg, trans_fn};
|
||||
use middle::trans::common::*;
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::ast_util::local_def;
|
||||
use syntax::ast_map::{path, path_mod, path_name};
|
||||
use base::{trans_item, get_item_val, self_arg, trans_fn, impl_owned_self,
|
||||
impl_self, no_self, get_insn_ctxt};
|
||||
use syntax::ast_util::local_def;
|
||||
|
||||
// `translate` will be true if this function is allowed to translate the
|
||||
// item and false otherwise. Currently, this parameter is set to false when
|
||||
|
@ -8,25 +8,25 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use libc::c_uint;
|
||||
use base::*;
|
||||
use common::*;
|
||||
use type_of::*;
|
||||
use build::*;
|
||||
use driver::session::{session, expect};
|
||||
use syntax::{ast, ast_map};
|
||||
use ast_map::{path, path_mod, path_name, node_id_to_str};
|
||||
use syntax::ast_util::local_def;
|
||||
use metadata::csearch;
|
||||
use back::{link, abi};
|
||||
use lib::llvm::llvm::LLVMGetParam;
|
||||
use lib::llvm::llvm;
|
||||
use lib::llvm::{ValueRef, TypeRef};
|
||||
use lib::llvm::llvm::LLVMGetParam;
|
||||
use std::map::HashMap;
|
||||
use metadata::csearch;
|
||||
use middle::trans::base::*;
|
||||
use middle::trans::build::*;
|
||||
use middle::trans::callee::*;
|
||||
use middle::trans::common::*;
|
||||
use middle::trans::expr::{SaveIn, Ignore};
|
||||
use middle::trans::type_of::*;
|
||||
use util::ppaux::{ty_to_str, tys_to_str};
|
||||
use callee::*;
|
||||
|
||||
use core::libc::c_uint;
|
||||
use std::map::HashMap;
|
||||
use syntax::ast_map::{path, path_mod, path_name, node_id_to_str};
|
||||
use syntax::ast_util::local_def;
|
||||
use syntax::print::pprust::expr_to_str;
|
||||
use expr::{SaveIn, Ignore};
|
||||
use syntax::{ast, ast_map};
|
||||
|
||||
fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export.
|
||||
|
||||
|
@ -8,20 +8,21 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use common::*;
|
||||
use syntax::ast;
|
||||
use syntax::ast_util::local_def;
|
||||
use syntax::ast_map::{path, path_mod, path_name};
|
||||
use base::{trans_item, get_item_val, no_self, self_arg, trans_fn,
|
||||
impl_self, decl_internal_cdecl_fn,
|
||||
set_inline_hint_if_appr, set_inline_hint,
|
||||
trans_enum_variant, trans_struct_dtor,
|
||||
get_insn_ctxt};
|
||||
use syntax::parse::token::special_idents;
|
||||
use type_of::type_of_fn_from_ty;
|
||||
use back::link::mangle_exported_name;
|
||||
use middle::trans::base::{get_insn_ctxt};
|
||||
use middle::trans::base::{set_inline_hint_if_appr, set_inline_hint};
|
||||
use middle::trans::base::{trans_enum_variant, trans_struct_dtor};
|
||||
use middle::trans::base::{trans_fn, impl_self, decl_internal_cdecl_fn};
|
||||
use middle::trans::base::{trans_item, get_item_val, no_self, self_arg};
|
||||
use middle::trans::common::*;
|
||||
use middle::trans::type_of::type_of_fn_from_ty;
|
||||
use middle::ty::{FnTyBase, FnMeta, FnSig};
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::ast_map::{path, path_mod, path_name};
|
||||
use syntax::ast_util::local_def;
|
||||
use syntax::parse::token::special_idents;
|
||||
|
||||
fn monomorphic_fn(ccx: @crate_ctxt,
|
||||
fn_id: ast::def_id,
|
||||
real_substs: ~[ty::t],
|
||||
|
@ -8,19 +8,20 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::map::HashMap;
|
||||
use lib::llvm::{TypeRef, ValueRef};
|
||||
use syntax::ast;
|
||||
use back::abi;
|
||||
use common::*;
|
||||
use build::*;
|
||||
use base::*;
|
||||
use type_of::*;
|
||||
use ast::def_id;
|
||||
use lib::llvm::{TypeRef, ValueRef};
|
||||
use middle::trans::base::*;
|
||||
use middle::trans::build::*;
|
||||
use middle::trans::callee::{ArgVals, DontAutorefArg};
|
||||
use middle::trans::common::*;
|
||||
use middle::trans::datum::*;
|
||||
use middle::trans::expr::SaveIn;
|
||||
use middle::trans::type_of::*;
|
||||
use util::ppaux::ty_to_str;
|
||||
use datum::*;
|
||||
use callee::{ArgVals, DontAutorefArg};
|
||||
use expr::SaveIn;
|
||||
|
||||
use std::map::HashMap;
|
||||
use syntax::ast::def_id;
|
||||
use syntax::ast;
|
||||
|
||||
enum reflector = {
|
||||
visitor_val: ValueRef,
|
||||
|
@ -11,25 +11,23 @@
|
||||
// A "shape" is a compact encoding of a type that is used by interpreted glue.
|
||||
// This substitutes for the runtime tags used by e.g. MLs.
|
||||
|
||||
use back::abi;
|
||||
use lib::llvm::llvm;
|
||||
use lib::llvm::{True, False, ModuleRef, TypeRef, ValueRef};
|
||||
use driver::session;
|
||||
use driver::session::session;
|
||||
use trans::base;
|
||||
use middle::trans::base;
|
||||
use middle::trans::common::*;
|
||||
use middle::trans::machine::*;
|
||||
use back::abi;
|
||||
use middle::ty;
|
||||
use middle::ty::field;
|
||||
use middle::ty;
|
||||
use util::ppaux::ty_to_str;
|
||||
|
||||
use core::dvec::DVec;
|
||||
use core::option::is_some;
|
||||
use std::map::HashMap;
|
||||
use syntax::ast;
|
||||
use syntax::ast_util::dummy_sp;
|
||||
use syntax::util::interner;
|
||||
use util::ppaux::ty_to_str;
|
||||
use syntax::codemap::span;
|
||||
use dvec::DVec;
|
||||
|
||||
use std::map::HashMap;
|
||||
use option::is_some;
|
||||
use syntax::util::interner;
|
||||
|
||||
use ty_ctxt = middle::ty::ctxt;
|
||||
|
||||
|
@ -8,18 +8,19 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use syntax::ast;
|
||||
use lib::llvm::{ValueRef, TypeRef};
|
||||
use back::abi;
|
||||
use syntax::codemap::span;
|
||||
use shape::llsize_of;
|
||||
use build::*;
|
||||
use common::*;
|
||||
use util::ppaux::ty_to_str;
|
||||
use expr::{Dest, SaveIn, Ignore};
|
||||
use datum::*;
|
||||
use syntax::print::pprust::{expr_to_str};
|
||||
use lib::llvm::{ValueRef, TypeRef};
|
||||
use middle::trans::build::*;
|
||||
use middle::trans::common::*;
|
||||
use middle::trans::datum::*;
|
||||
use middle::trans::expr::{Dest, Ignore, SaveIn};
|
||||
use middle::trans::shape::llsize_of;
|
||||
use util::common::indenter;
|
||||
use util::ppaux::ty_to_str;
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::codemap::span;
|
||||
use syntax::print::pprust::{expr_to_str};
|
||||
|
||||
// Boxed vector types are in some sense currently a "shorthand" for a box
|
||||
// containing an unboxed vector. This expands a boxed vector type into such an
|
||||
|
@ -8,12 +8,12 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use common::*;
|
||||
use lib::llvm::{TypeRef};
|
||||
use syntax::ast;
|
||||
use lib::llvm::llvm;
|
||||
use driver::session::session;
|
||||
use lib::llvm::{TypeRef};
|
||||
use middle::trans::common::*;
|
||||
|
||||
use std::map::HashMap;
|
||||
use syntax::ast;
|
||||
|
||||
export type_of;
|
||||
export type_of_dtor;
|
||||
|
@ -27,13 +27,16 @@
|
||||
// much information, but have the disadvantage of being very
|
||||
// invasive.)
|
||||
|
||||
use std::map::HashMap;
|
||||
use std::list;
|
||||
use std::list::{List, Cons, Nil};
|
||||
use metadata::csearch;
|
||||
use syntax::ast::*, syntax::ast_util, syntax::visit;
|
||||
use middle::trans::common::*;
|
||||
|
||||
use std::list::{List, Cons, Nil};
|
||||
use std::list;
|
||||
use std::map::HashMap;
|
||||
use syntax::ast::*;
|
||||
use syntax::ast_map;
|
||||
use common::*;
|
||||
use syntax::ast_util;
|
||||
use syntax::visit;
|
||||
|
||||
type type_uses = uint; // Bitmask
|
||||
const use_repr: uint = 1u; /* Dependency on size/alignment/mode and
|
||||
|
@ -8,12 +8,13 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use syntax::ast;
|
||||
use lib::llvm::ValueRef;
|
||||
use common::*;
|
||||
use build::*;
|
||||
use base::*;
|
||||
use datum::immediate_rvalue;
|
||||
use middle::trans::base::*;
|
||||
use middle::trans::build::*;
|
||||
use middle::trans::common::*;
|
||||
use middle::trans::datum::immediate_rvalue;
|
||||
|
||||
use syntax::ast;
|
||||
|
||||
export make_free_glue, autoderef, duplicate;
|
||||
|
||||
|
@ -52,12 +52,13 @@
|
||||
* an rptr (`&r.T`) use the region `r` that appears in the rptr.
|
||||
*/
|
||||
|
||||
use check::fn_ctxt;
|
||||
use rscope::{anon_rscope, binding_rscope, empty_rscope, in_anon_rscope};
|
||||
use rscope::{in_binding_rscope, region_scope, type_rscope};
|
||||
use ty::{FnTyBase, FnMeta, FnSig};
|
||||
use middle::ty::{FnTyBase, FnMeta, FnSig};
|
||||
use middle::typeck::check::fn_ctxt;
|
||||
use middle::typeck::rscope::{anon_rscope, binding_rscope, empty_rscope};
|
||||
use middle::typeck::rscope::{in_anon_rscope, in_binding_rscope};
|
||||
use middle::typeck::rscope::{region_scope, type_rscope};
|
||||
|
||||
trait ast_conv {
|
||||
pub trait ast_conv {
|
||||
fn tcx() -> ty::ctxt;
|
||||
fn ccx() -> @crate_ctxt;
|
||||
fn get_item_ty(id: ast::def_id) -> ty::ty_param_bounds_and_ty;
|
||||
@ -141,7 +142,7 @@ fn ast_path_to_substs_and_ty<AC: ast_conv, RS: region_scope Copy Owned>(
|
||||
{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,
|
||||
|
@ -8,9 +8,11 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use middle::pat_util::{pat_is_binding, pat_is_const};
|
||||
use middle::pat_util::{pat_is_variant_or_struct};
|
||||
|
||||
use syntax::ast_util::walk_pat;
|
||||
use syntax::print::pprust;
|
||||
use syntax::ast_util::{walk_pat};
|
||||
use pat_util::{pat_is_binding, pat_is_const, pat_is_variant_or_struct};
|
||||
|
||||
fn check_alt(fcx: @fn_ctxt,
|
||||
expr: @ast::expr,
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use check::fn_ctxt;
|
||||
use middle::typeck::check::fn_ctxt;
|
||||
|
||||
// Requires that the two types unify, and prints an error message if they
|
||||
// don't.
|
||||
@ -18,10 +18,10 @@ fn suptype(fcx: @fn_ctxt, sp: span,
|
||||
|sp, e, a, s| { fcx.report_mismatched_types(sp, e, a, s) })
|
||||
}
|
||||
|
||||
fn suptype_with_fn(fcx: @fn_ctxt, sp: span,
|
||||
expected: ty::t, actual: ty::t,
|
||||
fn suptype_with_fn(fcx: @fn_ctxt,
|
||||
sp: span,
|
||||
expected: ty::t, actual: ty::t,
|
||||
handle_err: fn(span, ty::t, ty::t, &ty::type_err)) {
|
||||
|
||||
// n.b.: order of actual, expected is reversed
|
||||
match infer::mk_subty(fcx.infcx(), false, sp,
|
||||
actual, expected) {
|
||||
@ -32,9 +32,7 @@ fn suptype_with_fn(fcx: @fn_ctxt, sp: span,
|
||||
}
|
||||
}
|
||||
|
||||
fn eqtype(fcx: @fn_ctxt, sp: span,
|
||||
expected: ty::t, actual: ty::t) {
|
||||
|
||||
fn eqtype(fcx: @fn_ctxt, sp: span, expected: ty::t, actual: ty::t) {
|
||||
match infer::mk_eqty(fcx.infcx(), false, sp, actual, expected) {
|
||||
Ok(()) => { /* ok */ }
|
||||
Err(ref err) => {
|
||||
|
@ -79,16 +79,18 @@ obtained the type `Foo`, we would never match this method.
|
||||
|
||||
*/
|
||||
|
||||
use coherence::get_base_type_def_id;
|
||||
use middle::resolve::{Impl, MethodInfo};
|
||||
use middle::ty::*;
|
||||
use syntax::ast::{def_id, sty_by_ref, sty_value, sty_region, sty_box,
|
||||
sty_uniq, sty_static, node_id, by_copy, by_ref,
|
||||
m_const, m_mutbl, m_imm};
|
||||
use middle::typeck::check;
|
||||
use middle::typeck::coherence::get_base_type_def_id;
|
||||
|
||||
use core::dvec::DVec;
|
||||
use syntax::ast::{def_id, sty_by_ref, sty_value, sty_region, sty_box};
|
||||
use syntax::ast::{sty_uniq, sty_static, node_id, by_copy, by_ref};
|
||||
use syntax::ast::{m_const, m_mutbl, m_imm};
|
||||
use syntax::ast_map;
|
||||
use syntax::ast_map::node_id_to_str;
|
||||
use syntax::ast_util::dummy_sp;
|
||||
use dvec::DVec;
|
||||
|
||||
fn lookup(
|
||||
fcx: @fn_ctxt,
|
||||
|
@ -76,35 +76,51 @@ type parameter).
|
||||
|
||||
*/
|
||||
|
||||
use astconv::{ast_conv, ast_path_to_ty, ast_ty_to_ty};
|
||||
use astconv::{ast_region_to_region};
|
||||
use middle::ty::{TyVid, vid, FnTyBase, FnMeta, FnSig, VariantInfo_};
|
||||
use regionmanip::{replace_bound_regions_in_fn_ty};
|
||||
use rscope::{anon_rscope, binding_rscope, empty_rscope, in_anon_rscope};
|
||||
use rscope::{in_binding_rscope, region_scope, type_rscope,
|
||||
bound_self_region};
|
||||
use syntax::ast::ty_i;
|
||||
use typeck::infer::{resolve_type, force_tvar};
|
||||
use result::{Result, Ok, Err};
|
||||
use syntax::print::pprust;
|
||||
use syntax::parse::token::special_idents;
|
||||
use syntax::ast_util::{is_local, visibility_to_privacy, Private, Public};
|
||||
use vtable::{LocationInfo, VtableContext};
|
||||
use middle::typeck::astconv::{ast_conv, ast_path_to_ty};
|
||||
use middle::typeck::astconv::{ast_region_to_region, ast_ty_to_ty};
|
||||
use middle::typeck::check::regionmanip::replace_bound_regions_in_fn_ty;
|
||||
use middle::typeck::check::vtable::{LocationInfo, VtableContext};
|
||||
use middle::typeck::infer::{resolve_type, force_tvar};
|
||||
use middle::typeck::rscope::{anon_rscope, binding_rscope, bound_self_region};
|
||||
use middle::typeck::rscope::{empty_rscope, in_anon_rscope};
|
||||
use middle::typeck::rscope::{in_binding_rscope, region_scope, type_rscope};
|
||||
use util::ppaux;
|
||||
|
||||
use core::result::{Result, Ok, Err};
|
||||
use std::map::HashMap;
|
||||
use syntax::ast::ty_i;
|
||||
use syntax::ast_util::{is_local, visibility_to_privacy, Private, Public};
|
||||
use syntax::parse::token::special_idents;
|
||||
use syntax::print::pprust;
|
||||
|
||||
export alt;
|
||||
export vtable;
|
||||
export writeback;
|
||||
export regionmanip;
|
||||
export regionck;
|
||||
export demand;
|
||||
export method;
|
||||
export fn_ctxt;
|
||||
export lookup_local;
|
||||
export impl_self_ty;
|
||||
export DerefArgs;
|
||||
export DontDerefArgs;
|
||||
export DoDerefArgs;
|
||||
export check_item_types;
|
||||
|
||||
#[legacy_exports]
|
||||
mod alt;
|
||||
pub mod alt;
|
||||
#[legacy_exports]
|
||||
mod vtable;
|
||||
pub mod vtable;
|
||||
#[legacy_exports]
|
||||
mod writeback;
|
||||
pub mod writeback;
|
||||
#[legacy_exports]
|
||||
mod regionmanip;
|
||||
pub mod regionmanip;
|
||||
#[legacy_exports]
|
||||
mod regionck;
|
||||
pub mod regionck;
|
||||
#[legacy_exports]
|
||||
mod demand;
|
||||
pub mod demand;
|
||||
#[legacy_exports]
|
||||
pub mod method;
|
||||
|
||||
@ -135,7 +151,7 @@ struct inherited {
|
||||
|
||||
enum FnKind { ForLoop, DoBlock, Vanilla }
|
||||
|
||||
struct fn_ctxt {
|
||||
pub struct fn_ctxt {
|
||||
// var_bindings, locals and next_var_id are shared
|
||||
// with any nested functions that capture the environment
|
||||
// (and with any functions whose environment is being captured).
|
||||
@ -252,9 +268,9 @@ fn check_fn(ccx: @crate_ctxt,
|
||||
let ret_ty = fn_ty.sig.output;
|
||||
|
||||
debug!("check_fn(arg_tys=%?, ret_ty=%?, self_info.self_ty=%?)",
|
||||
arg_tys.map(|a| ty_to_str(tcx, *a)),
|
||||
ty_to_str(tcx, ret_ty),
|
||||
option::map(&self_info, |s| ty_to_str(tcx, s.self_ty)));
|
||||
arg_tys.map(|a| ppaux::ty_to_str(tcx, *a)),
|
||||
ppaux::ty_to_str(tcx, ret_ty),
|
||||
option::map(&self_info, |s| ppaux::ty_to_str(tcx, s.self_ty)));
|
||||
|
||||
// ______________________________________________________________________
|
||||
// Create the function context. This is either derived from scratch or,
|
||||
@ -631,7 +647,7 @@ impl @fn_ctxt {
|
||||
#[inline(always)]
|
||||
fn write_ty(node_id: ast::node_id, ty: ty::t) {
|
||||
debug!("write_ty(%d, %s) in fcx %s",
|
||||
node_id, ty_to_str(self.tcx(), ty), self.tag());
|
||||
node_id, ppaux::ty_to_str(self.tcx(), ty), self.tag());
|
||||
self.inh.node_types.insert(node_id, ty);
|
||||
}
|
||||
|
||||
@ -793,12 +809,13 @@ impl @fn_ctxt {
|
||||
self.tcx().sess.span_err(sp, fmt!("A for-loop body must \
|
||||
return (), but it returns %s here. \
|
||||
Perhaps you meant to write a `do`-block?",
|
||||
ty_to_str(self.tcx(), a))),
|
||||
ppaux::ty_to_str(self.tcx(), a))),
|
||||
DoBlock if ty::type_is_bool(e) && ty::type_is_nil(a) =>
|
||||
// If we expected bool and got ()...
|
||||
self.tcx().sess.span_err(sp, fmt!("Do-block body must \
|
||||
return %s, but returns () here. Perhaps you meant \
|
||||
to write a `for`-loop?", ty_to_str(self.tcx(), e))),
|
||||
to write a `for`-loop?",
|
||||
ppaux::ty_to_str(self.tcx(), e))),
|
||||
_ => self.infcx().report_mismatched_types(sp, e, a, err)
|
||||
}
|
||||
}
|
||||
@ -921,10 +938,11 @@ fn check_expr(fcx: @fn_ctxt, expr: @ast::expr,
|
||||
// declared on the impl declaration e.g., `impl<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 {
|
||||
@ -1540,7 +1558,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||
|
||||
// (1) verify that the class id actually has a field called
|
||||
// field
|
||||
debug!("class named %s", ty_to_str(tcx, base_t));
|
||||
debug!("class named %s", ppaux::ty_to_str(tcx, base_t));
|
||||
let cls_items = ty::lookup_struct_fields(tcx, base_id);
|
||||
match lookup_field_ty(tcx, base_id, cls_items,
|
||||
field, &(*substs)) {
|
||||
@ -2400,9 +2418,9 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||
|
||||
debug!("type of expr %s is %s, expected is %s",
|
||||
syntax::print::pprust::expr_to_str(expr, tcx.sess.intr()),
|
||||
ty_to_str(tcx, fcx.expr_ty(expr)),
|
||||
ppaux::ty_to_str(tcx, fcx.expr_ty(expr)),
|
||||
match expected {
|
||||
Some(t) => ty_to_str(tcx, t),
|
||||
Some(t) => ppaux::ty_to_str(tcx, t),
|
||||
_ => ~"empty"
|
||||
});
|
||||
|
||||
@ -2565,7 +2583,7 @@ fn check_instantiable(tcx: ty::ctxt,
|
||||
tcx.sess.span_err(sp, fmt!("this type cannot be instantiated \
|
||||
without an instance of itself; \
|
||||
consider using `option<%s>`",
|
||||
ty_to_str(tcx, item_ty)));
|
||||
ppaux::ty_to_str(tcx, item_ty)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2678,7 +2696,7 @@ fn check_enum_variants(ccx: @crate_ctxt,
|
||||
check_instantiable(ccx.tcx, sp, id);
|
||||
}
|
||||
|
||||
fn lookup_local(fcx: @fn_ctxt, sp: span, id: ast::node_id) -> TyVid {
|
||||
pub fn lookup_local(fcx: @fn_ctxt, sp: span, id: ast::node_id) -> TyVid {
|
||||
match fcx.inh.locals.find(id) {
|
||||
Some(x) => x,
|
||||
_ => {
|
||||
@ -2893,7 +2911,7 @@ fn check_bounds_are_used(ccx: @crate_ctxt,
|
||||
tps: ~[ast::ty_param],
|
||||
ty: ty::t) {
|
||||
debug!("check_bounds_are_used(n_tps=%u, ty=%s)",
|
||||
tps.len(), ty_to_str(ccx.tcx, ty));
|
||||
tps.len(), ppaux::ty_to_str(ccx.tcx, ty));
|
||||
|
||||
// make a vector of booleans initially false, set to true when used
|
||||
if tps.len() == 0u { return; }
|
||||
@ -3158,6 +3176,6 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::foreign_item) {
|
||||
tcx, None, false, it.span, i_ty.ty, fty,
|
||||
|| fmt!("intrinsic has wrong type: \
|
||||
expected `%s`",
|
||||
ty_to_str(ccx.tcx, fty)));
|
||||
ppaux::ty_to_str(ccx.tcx, fty)));
|
||||
}
|
||||
}
|
||||
|
@ -27,18 +27,18 @@ this point a bit better.
|
||||
|
||||
*/
|
||||
|
||||
use util::ppaux;
|
||||
use ppaux::{note_and_explain_region, ty_to_str};
|
||||
use syntax::print::pprust;
|
||||
use infer::{resolve_and_force_all_but_regions, fres};
|
||||
use syntax::ast::{def_arg, def_binding, def_local, def_self, def_upvar};
|
||||
use syntax::ast::{ProtoBare, ProtoBox, ProtoUniq, ProtoBorrowed};
|
||||
use middle::freevars::get_freevars;
|
||||
use middle::kind::check_owned;
|
||||
use middle::pat_util::pat_bindings;
|
||||
use middle::ty::{encl_region, re_scope};
|
||||
use middle::ty::{ty_fn_proto, vstore_box, vstore_fixed, vstore_slice};
|
||||
use middle::ty::{vstore_uniq};
|
||||
use middle::typeck::infer::{resolve_and_force_all_but_regions, fres};
|
||||
use util::ppaux::{note_and_explain_region, ty_to_str};
|
||||
|
||||
use syntax::ast::{ProtoBare, ProtoBox, ProtoUniq, ProtoBorrowed};
|
||||
use syntax::ast::{def_arg, def_binding, def_local, def_self, def_upvar};
|
||||
use syntax::print::pprust;
|
||||
|
||||
enum rcx { rcx_({fcx: @fn_ctxt, mut errors_reported: uint}) }
|
||||
type rvt = visit::vt<@rcx>;
|
||||
|
@ -11,6 +11,8 @@
|
||||
// #[warn(deprecated_mode)];
|
||||
// #[warn(deprecated_pattern)];
|
||||
|
||||
use util::ppaux;
|
||||
|
||||
use syntax::print::pprust::{expr_to_str};
|
||||
|
||||
// Helper functions related to manipulating region types.
|
||||
@ -47,9 +49,9 @@ fn replace_bound_regions_in_fn_ty(
|
||||
|
||||
debug!("replace_bound_regions_in_fn_ty(self_info.self_ty=%?, fn_ty=%s, \
|
||||
all_tys=%?)",
|
||||
self_ty.map(|t| ty_to_str(tcx, *t)),
|
||||
ty_to_str(tcx, ty::mk_fn(tcx, *fn_ty)),
|
||||
all_tys.map(|t| ty_to_str(tcx, *t)));
|
||||
self_ty.map(|t| ppaux::ty_to_str(tcx, *t)),
|
||||
ppaux::ty_to_str(tcx, ty::mk_fn(tcx, *fn_ty)),
|
||||
all_tys.map(|t| ppaux::ty_to_str(tcx, *t)));
|
||||
let _i = indenter();
|
||||
|
||||
let isr = do create_bound_region_mapping(tcx, isr, all_tys) |br| {
|
||||
@ -64,8 +66,8 @@ fn replace_bound_regions_in_fn_ty(
|
||||
|
||||
debug!("result of replace_bound_regions_in_fn_ty: self_info.self_ty=%?, \
|
||||
fn_ty=%s",
|
||||
t_self.map(|t| ty_to_str(tcx, *t)),
|
||||
ty_to_str(tcx, t_fn));
|
||||
t_self.map(|t| ppaux::ty_to_str(tcx, *t)),
|
||||
ppaux::ty_to_str(tcx, t_fn));
|
||||
|
||||
|
||||
// Glue updated self_ty back together with its original def_id.
|
||||
|
@ -8,13 +8,15 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use check::{fn_ctxt, impl_self_ty};
|
||||
use infer::{infer_ctxt, resolve_type, resolve_and_force_all_but_regions,
|
||||
fixup_err_to_str};
|
||||
use middle::typeck::check::{fn_ctxt, impl_self_ty};
|
||||
use middle::typeck::infer::{fixup_err_to_str, infer_ctxt};
|
||||
use middle::typeck::infer::{resolve_and_force_all_but_regions, resolve_type};
|
||||
use util::common::indenter;
|
||||
use util::ppaux;
|
||||
|
||||
use result::{Result, Ok, Err};
|
||||
use syntax::codemap::span;
|
||||
use syntax::print::pprust;
|
||||
use result::{Result, Ok, Err};
|
||||
use util::common::indenter;
|
||||
|
||||
// vtable resolution looks for places where trait bounds are
|
||||
// subsituted in and figures out which vtable is used. There is some
|
||||
@ -81,14 +83,14 @@ fn lookup_vtables(vcx: &VtableContext,
|
||||
tcx, bounds[i]) |trait_ty| {
|
||||
|
||||
debug!("about to subst: %?, %?",
|
||||
ty_to_str(tcx, trait_ty),
|
||||
ppaux::ty_to_str(tcx, trait_ty),
|
||||
ty::substs_to_str(tcx, substs));
|
||||
|
||||
let new_substs = {self_ty: Some(*ty), ..*substs};
|
||||
let trait_ty = ty::subst(tcx, &new_substs, trait_ty);
|
||||
|
||||
debug!("after subst: %?",
|
||||
ty_to_str(tcx, trait_ty));
|
||||
ppaux::ty_to_str(tcx, trait_ty));
|
||||
|
||||
match lookup_vtable(vcx, location_info, *ty, trait_ty,
|
||||
allow_unsafe, is_early) {
|
||||
@ -98,8 +100,8 @@ fn lookup_vtables(vcx: &VtableContext,
|
||||
location_info.span,
|
||||
fmt!("failed to find an implementation of \
|
||||
trait %s for %s",
|
||||
ty_to_str(vcx.tcx(), trait_ty),
|
||||
ty_to_str(vcx.tcx(), *ty)));
|
||||
ppaux::ty_to_str(vcx.tcx(), trait_ty),
|
||||
ppaux::ty_to_str(vcx.tcx(), *ty)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -664,8 +666,8 @@ fn early_resolve_expr(ex: @ast::expr, &&fcx: @fn_ctxt, is_early: bool) {
|
||||
ex.span,
|
||||
fmt!("failed to find an implementation of trait \
|
||||
%s for %s",
|
||||
ty_to_str(fcx.tcx(), target_ty),
|
||||
ty_to_str(fcx.tcx(), ty)));
|
||||
ppaux::ty_to_str(fcx.tcx(), target_ty),
|
||||
ppaux::ty_to_str(fcx.tcx(), ty)));
|
||||
}
|
||||
}
|
||||
Some(vtable) => {
|
||||
|
@ -12,11 +12,15 @@
|
||||
// unresolved type variables and replaces "ty_var" types with their
|
||||
// substitutions.
|
||||
|
||||
use check::{fn_ctxt, lookup_local};
|
||||
use infer::{resolve_type, resolve_region, resolve_all, force_all};
|
||||
use middle::typeck::check::{fn_ctxt, lookup_local};
|
||||
use middle::typeck::infer::{force_all, resolve_all, resolve_region};
|
||||
use middle::typeck::infer::{resolve_type};
|
||||
use util::ppaux;
|
||||
|
||||
use result::{Result, Ok, Err};
|
||||
|
||||
export resolve_type_vars_in_fn;
|
||||
export resolve_type_vars_in_expr;
|
||||
use result::{Result, Ok, Err};
|
||||
|
||||
fn resolve_type_vars_in_type(fcx: @fn_ctxt, sp: span, typ: ty::t)
|
||||
-> Option<ty::t>
|
||||
@ -97,7 +101,7 @@ fn resolve_type_vars_for_node(wbcx: wb_ctxt, sp: span, id: ast::node_id)
|
||||
|
||||
Some(t) => {
|
||||
debug!("resolve_type_vars_for_node(id=%d, n_ty=%s, t=%s)",
|
||||
id, ty_to_str(tcx, n_ty), ty_to_str(tcx, t));
|
||||
id, ppaux::ty_to_str(tcx, n_ty), ppaux::ty_to_str(tcx, t));
|
||||
write_ty_to_tcx(tcx, id, t);
|
||||
match fcx.opt_node_ty_substs(id) {
|
||||
Some(ref substs) => {
|
||||
|
@ -43,11 +43,11 @@ use syntax::visit::{mk_simple_visitor, mk_vt, visit_crate, visit_item};
|
||||
use syntax::visit::{visit_mod};
|
||||
use util::ppaux::ty_to_str;
|
||||
|
||||
use dvec::DVec;
|
||||
use result::Ok;
|
||||
use core::dvec::DVec;
|
||||
use core::result::Ok;
|
||||
use std::map::HashMap;
|
||||
use uint::range;
|
||||
use vec::{len, push};
|
||||
use core::uint::range;
|
||||
use core::vec::{len, push};
|
||||
|
||||
fn get_base_type(inference_context: infer_ctxt, span: span, original_type: t)
|
||||
-> Option<t> {
|
||||
|
@ -30,14 +30,16 @@ are represented as `ty_param()` instances.
|
||||
|
||||
*/
|
||||
|
||||
use astconv::{ast_conv, ty_of_fn_decl, ty_of_arg, ast_ty_to_ty};
|
||||
use ast_util::trait_method_to_ty_method;
|
||||
use middle::ty::{FnMeta, FnSig, FnTyBase};
|
||||
use rscope::*;
|
||||
use ty::{FnTyBase, FnMeta, FnSig, InstantiatedTraitRef};
|
||||
use middle::ty::{FnMeta, FnSig, FnTyBase, InstantiatedTraitRef};
|
||||
use middle::typeck::astconv::{ast_conv, ty_of_fn_decl, ty_of_arg};
|
||||
use middle::typeck::astconv::{ast_ty_to_ty};
|
||||
use middle::typeck::rscope::*;
|
||||
use util::common::pluralize;
|
||||
use util::ppaux;
|
||||
use util::ppaux::bound_to_str;
|
||||
|
||||
use syntax::ast_util::trait_method_to_ty_method;
|
||||
|
||||
fn collect_item_types(ccx: @crate_ctxt, crate: @ast::crate) {
|
||||
|
||||
// FIXME (#2592): hooking into the "intrinsic" root module is crude.
|
||||
@ -403,10 +405,10 @@ fn compare_impl_method(tcx: ty::ctxt,
|
||||
// - replace self region with a fresh, dummy region
|
||||
let impl_fty = {
|
||||
let impl_fty = ty::mk_fn(tcx, impl_m.fty);
|
||||
debug!("impl_fty (pre-subst): %s", ty_to_str(tcx, impl_fty));
|
||||
debug!("impl_fty (pre-subst): %s", ppaux::ty_to_str(tcx, impl_fty));
|
||||
replace_bound_self(tcx, impl_fty, dummy_self_r)
|
||||
};
|
||||
debug!("impl_fty: %s", ty_to_str(tcx, impl_fty));
|
||||
debug!("impl_fty: %s", ppaux::ty_to_str(tcx, impl_fty));
|
||||
let trait_fty = {
|
||||
let dummy_tps = do vec::from_fn((*trait_m.tps).len()) |i| {
|
||||
// hack: we don't know the def id of the impl tp, but it
|
||||
@ -421,7 +423,7 @@ fn compare_impl_method(tcx: ty::ctxt,
|
||||
tps: vec::append(trait_tps, dummy_tps)
|
||||
};
|
||||
let trait_fty = ty::mk_fn(tcx, trait_m.fty);
|
||||
debug!("trait_fty (pre-subst): %s", ty_to_str(tcx, trait_fty));
|
||||
debug!("trait_fty (pre-subst): %s", ppaux::ty_to_str(tcx, trait_fty));
|
||||
ty::subst(tcx, &substs, trait_fty)
|
||||
};
|
||||
|
||||
@ -574,7 +576,7 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) {
|
||||
ast::item_trait(tps, supertraits, ref trait_methods) => {
|
||||
let tpt = ty_of_item(ccx, it);
|
||||
debug!("item_trait(it.id=%d, tpt.ty=%s)",
|
||||
it.id, ty_to_str(tcx, tpt.ty));
|
||||
it.id, ppaux::ty_to_str(tcx, tpt.ty));
|
||||
write_ty_to_tcx(tcx, it.id, tpt.ty);
|
||||
ensure_trait_methods(ccx, it.id, tpt.ty);
|
||||
ensure_supertraits(ccx, it.id, it.span, rp, supertraits);
|
||||
@ -774,7 +776,9 @@ fn ty_of_item(ccx: @crate_ctxt, it: @ast::item)
|
||||
region_param: None,
|
||||
ty: ty::mk_fn(ccx.tcx, tofd)};
|
||||
debug!("type of %s (id %d) is %s",
|
||||
tcx.sess.str_of(it.ident), it.id, ty_to_str(tcx, tpt.ty));
|
||||
tcx.sess.str_of(it.ident),
|
||||
it.id,
|
||||
ppaux::ty_to_str(tcx, tpt.ty));
|
||||
ccx.tcx.tcache.insert(local_def(it.id), tpt);
|
||||
return tpt;
|
||||
}
|
||||
|
@ -58,8 +58,8 @@
|
||||
// A. But this upper-bound might be stricter than what is truly
|
||||
// needed.
|
||||
|
||||
use to_str::ToStr;
|
||||
use combine::combine_fields;
|
||||
use middle::typeck::infer::combine::combine_fields;
|
||||
use middle::typeck::infer::to_str::ToStr;
|
||||
|
||||
fn to_ares(+c: cres<ty::t>) -> ares {
|
||||
match c {
|
||||
|
@ -54,8 +54,9 @@
|
||||
// terms of error reporting, although we do not do that properly right
|
||||
// now.
|
||||
|
||||
use to_str::ToStr;
|
||||
use ty::{FnTyBase, FnMeta, FnSig};
|
||||
use middle::ty::{FnTyBase, FnMeta, FnSig};
|
||||
use middle::typeck::infer::to_str::ToStr;
|
||||
|
||||
use syntax::ast::Onceness;
|
||||
|
||||
fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export.
|
||||
@ -92,7 +93,7 @@ trait combine {
|
||||
a: ty::vstore, b: ty::vstore) -> cres<ty::vstore>;
|
||||
}
|
||||
|
||||
struct combine_fields {
|
||||
pub struct combine_fields {
|
||||
infcx: infer_ctxt,
|
||||
a_is_expected: bool,
|
||||
span: span,
|
||||
@ -108,7 +109,7 @@ fn expected_found<C: combine,T>(
|
||||
}
|
||||
}
|
||||
|
||||
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| {
|
||||
|
@ -14,8 +14,8 @@ Code related to floating-point type inference.
|
||||
|
||||
*/
|
||||
|
||||
use to_str::ToStr;
|
||||
use middle::ty::ty_float;
|
||||
use middle::typeck::infer::to_str::ToStr;
|
||||
|
||||
// Bitvector to represent sets of floating-point types.
|
||||
pub enum float_ty_set = uint;
|
||||
|
@ -8,9 +8,10 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use combine::*;
|
||||
use lattice::*;
|
||||
use to_str::ToStr;
|
||||
use middle::typeck::infer::combine::*;
|
||||
use middle::typeck::infer::lattice::*;
|
||||
use middle::typeck::infer::to_str::ToStr;
|
||||
|
||||
use syntax::ast::{Many, Once};
|
||||
|
||||
enum Glb = combine_fields; // "greatest lower bound" (common subtype)
|
||||
|
@ -14,7 +14,7 @@ Code related to integral type inference.
|
||||
|
||||
*/
|
||||
|
||||
use to_str::ToStr;
|
||||
use middle::typeck::infer::to_str::ToStr;
|
||||
|
||||
// Bitvector to represent sets of integral types
|
||||
enum int_ty_set = uint;
|
||||
|
@ -8,9 +8,9 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use combine::*;
|
||||
use unify::*;
|
||||
use to_str::ToStr;
|
||||
use middle::typeck::infer::combine::*;
|
||||
use middle::typeck::infer::unify::*;
|
||||
use middle::typeck::infer::to_str::ToStr;
|
||||
|
||||
// ______________________________________________________________________
|
||||
// Lattice operations on variables
|
||||
|
@ -8,9 +8,10 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use combine::*;
|
||||
use lattice::*;
|
||||
use to_str::ToStr;
|
||||
use middle::typeck::infer::combine::*;
|
||||
use middle::typeck::infer::lattice::*;
|
||||
use middle::typeck::infer::to_str::ToStr;
|
||||
|
||||
use syntax::ast::{Many, Once};
|
||||
|
||||
fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export.
|
||||
|
@ -259,40 +259,40 @@ section on "Type Combining" below for details.
|
||||
#[warn(deprecated_mode)];
|
||||
#[warn(deprecated_pattern)];
|
||||
|
||||
use std::smallintmap;
|
||||
use std::smallintmap::smallintmap;
|
||||
use std::map::HashMap;
|
||||
use middle::ty::{TyVid, IntVid, FloatVid, RegionVid, vid};
|
||||
use middle::ty::{mk_fn, type_is_bot};
|
||||
use middle::ty::{ty_int, ty_uint, get, terr_fn, TyVar, IntVar, FloatVar};
|
||||
use middle::ty;
|
||||
use middle::ty::{TyVid, IntVid, FloatVid, RegionVid, vid,
|
||||
ty_int, ty_uint, get, terr_fn, TyVar, IntVar, FloatVar};
|
||||
use syntax::{ast, ast_util};
|
||||
use syntax::ast::{ret_style, purity};
|
||||
use util::ppaux::{ty_to_str, mt_to_str};
|
||||
use result::{Result, Ok, Err, map_vec, map_vec2, iter_vec2};
|
||||
use ty::{mk_fn, type_is_bot};
|
||||
use check::regionmanip::{replace_bound_regions_in_fn_ty};
|
||||
use middle::typeck::check::regionmanip::{replace_bound_regions_in_fn_ty};
|
||||
use middle::typeck::infer::assignment::Assign;
|
||||
use middle::typeck::infer::combine::{combine_fields, eq_tys};
|
||||
use middle::typeck::infer::floating::{float_ty_set, float_ty_set_all};
|
||||
use middle::typeck::infer::glb::Glb;
|
||||
use middle::typeck::infer::integral::{int_ty_set, int_ty_set_all};
|
||||
use middle::typeck::infer::lub::Lub;
|
||||
use middle::typeck::infer::region_inference::{RegionVarBindings};
|
||||
use middle::typeck::infer::resolve::{force_all, not_regions};
|
||||
use middle::typeck::infer::resolve::{force_tvar, force_rvar, force_ivar};
|
||||
use middle::typeck::infer::resolve::{resolve_and_force_all_but_regions};
|
||||
use middle::typeck::infer::resolve::{resolve_ivar, resolve_all};
|
||||
use middle::typeck::infer::resolve::{resolve_nested_tvar, resolve_rvar};
|
||||
use middle::typeck::infer::resolve::{resolver};
|
||||
use middle::typeck::infer::sub::Sub;
|
||||
use middle::typeck::infer::to_str::ToStr;
|
||||
use middle::typeck::infer::unify::{vals_and_bindings, root};
|
||||
use util::common::{indent, indenter};
|
||||
use ast::{unsafe_fn, impure_fn, pure_fn, extern_fn};
|
||||
use ast::{m_const, m_imm, m_mutbl};
|
||||
use dvec::DVec;
|
||||
use region_inference::{RegionVarBindings};
|
||||
use ast_util::dummy_sp;
|
||||
use cmp::Eq;
|
||||
use util::ppaux::{ty_to_str, mt_to_str};
|
||||
|
||||
// From submodules:
|
||||
use resolve::{resolve_nested_tvar, resolve_rvar, resolve_ivar, resolve_all,
|
||||
force_tvar, force_rvar, force_ivar, force_all, not_regions,
|
||||
resolve_and_force_all_but_regions, resolver};
|
||||
use unify::{vals_and_bindings, root};
|
||||
use integral::{int_ty_set, int_ty_set_all};
|
||||
use floating::{float_ty_set, float_ty_set_all};
|
||||
use combine::{combine_fields, eq_tys};
|
||||
use assignment::Assign;
|
||||
use to_str::ToStr;
|
||||
|
||||
use sub::Sub;
|
||||
use lub::Lub;
|
||||
use glb::Glb;
|
||||
use core::cmp::Eq;
|
||||
use core::dvec::DVec;
|
||||
use core::result::{Result, Ok, Err, map_vec, map_vec2, iter_vec2};
|
||||
use std::map::HashMap;
|
||||
use std::smallintmap;
|
||||
use syntax::ast::{ret_style, purity};
|
||||
use syntax::ast::{m_const, m_imm, m_mutbl};
|
||||
use syntax::ast::{unsafe_fn, impure_fn, pure_fn, extern_fn};
|
||||
use syntax::ast_util::dummy_sp;
|
||||
use syntax::{ast, ast_util};
|
||||
|
||||
export infer_ctxt;
|
||||
export new_infer_ctxt;
|
||||
@ -311,6 +311,18 @@ export cres, fres, fixup_err, fixup_err_to_str;
|
||||
export assignment;
|
||||
export root, to_str;
|
||||
export int_ty_set_all;
|
||||
export assignment;
|
||||
export combine;
|
||||
export floating;
|
||||
export glb;
|
||||
export integral;
|
||||
export lattice;
|
||||
export lub;
|
||||
export region_inference;
|
||||
export resolve;
|
||||
export sub;
|
||||
export to_str;
|
||||
export unify;
|
||||
|
||||
#[legacy_exports]
|
||||
mod assignment;
|
||||
|
@ -453,20 +453,20 @@ write it)
|
||||
#[warn(deprecated_mode)];
|
||||
#[warn(deprecated_pattern)];
|
||||
|
||||
use dvec::DVec;
|
||||
use middle::region::is_subregion_of;
|
||||
use middle::ty::{Region, RegionVid, re_static, re_infer, re_free, re_bound};
|
||||
use middle::ty::{re_scope, ReVar, ReSkolemized};
|
||||
use middle::typeck::infer::to_str::ToStr;
|
||||
use syntax::codemap;
|
||||
use util::ppaux::note_and_explain_region;
|
||||
|
||||
use core::dvec::DVec;
|
||||
use result::Result;
|
||||
use result::{Ok, Err};
|
||||
use std::map::HashMap;
|
||||
use std::cell::{Cell, empty_cell};
|
||||
use std::list::{List, Nil, Cons};
|
||||
|
||||
use region::is_subregion_of;
|
||||
use ty::{Region, RegionVid, re_static, re_infer, re_free, re_bound,
|
||||
re_scope, ReVar, ReSkolemized};
|
||||
use syntax::codemap;
|
||||
use to_str::ToStr;
|
||||
use util::ppaux::note_and_explain_region;
|
||||
|
||||
export RegionVarBindings;
|
||||
export make_subregion;
|
||||
export lub_regions;
|
||||
|
@ -46,9 +46,9 @@
|
||||
// future). If you want to resolve everything but one type, you are
|
||||
// probably better off writing `resolve_all - resolve_ivar`.
|
||||
|
||||
use integral::*;
|
||||
use floating::*;
|
||||
use to_str::ToStr;
|
||||
use middle::typeck::infer::floating::*;
|
||||
use middle::typeck::infer::integral::*;
|
||||
use middle::typeck::infer::to_str::ToStr;
|
||||
|
||||
const resolve_nested_tvar: uint = 0b00000001;
|
||||
const resolve_rvar: uint = 0b00000010;
|
||||
|
@ -8,9 +8,10 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use combine::*;
|
||||
use unify::*;
|
||||
use to_str::ToStr;
|
||||
use middle::typeck::infer::combine::*;
|
||||
use middle::typeck::infer::to_str::ToStr;
|
||||
use middle::typeck::infer::unify::*;
|
||||
|
||||
use std::list;
|
||||
|
||||
fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export.
|
||||
|
@ -8,9 +8,9 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use integral::{int_ty_set};
|
||||
use floating::{float_ty_set};
|
||||
use unify::{var_value, redirect, root};
|
||||
use middle::typeck::infer::integral::int_ty_set;
|
||||
use middle::typeck::infer::floating::float_ty_set;
|
||||
use middle::typeck::infer::unify::{redirect, root, var_value};
|
||||
|
||||
trait ToStr {
|
||||
fn to_str(cx: infer_ctxt) -> ~str;
|
||||
|
@ -8,10 +8,11 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use combine::combine;
|
||||
use integral::*;
|
||||
use floating::*;
|
||||
use to_str::ToStr;
|
||||
use middle::typeck::infer::combine::combine;
|
||||
use middle::typeck::infer::floating::*;
|
||||
use middle::typeck::infer::integral::*;
|
||||
use middle::typeck::infer::to_str::ToStr;
|
||||
|
||||
use std::smallintmap::SmallIntMap;
|
||||
|
||||
enum var_value<V:Copy, T:Copy> {
|
||||
|
@ -50,31 +50,31 @@ independently:
|
||||
|
||||
#[legacy_exports];
|
||||
|
||||
use result::Result;
|
||||
use syntax::{ast, ast_util, ast_map};
|
||||
use ast::spanned;
|
||||
use ast::{required, provided};
|
||||
use syntax::ast_map::node_id_to_str;
|
||||
use syntax::ast_util::{local_def, respan, split_trait_methods,
|
||||
has_legacy_export_attr};
|
||||
use syntax::visit;
|
||||
use metadata::csearch;
|
||||
use util::common::{block_query, loop_query};
|
||||
use syntax::codemap::span;
|
||||
use pat_util::{pat_id_map, PatIdMap};
|
||||
use middle::ty;
|
||||
use middle::pat_util::{pat_id_map, PatIdMap};
|
||||
use middle::ty::{arg, field, node_type_table, mk_nil, ty_param_bounds_and_ty};
|
||||
use middle::ty::{ty_param_substs_and_ty, vstore_uniq};
|
||||
use std::smallintmap;
|
||||
use std::map;
|
||||
use std::map::HashMap;
|
||||
use syntax::print::pprust::*;
|
||||
use util::ppaux::{ty_to_str, tys_to_str, region_to_str,
|
||||
bound_region_to_str, vstore_to_str, expr_repr};
|
||||
use util::common::{indent, indenter};
|
||||
use middle::ty;
|
||||
use util::common::{block_query, indent, indenter, loop_query};
|
||||
use util::ppaux::{bound_region_to_str, vstore_to_str, expr_repr};
|
||||
use util::ppaux::{ty_to_str, tys_to_str, region_to_str};
|
||||
use util::ppaux;
|
||||
|
||||
use core::dvec::DVec;
|
||||
use core::result::Result;
|
||||
use std::list::{List, Nil, Cons};
|
||||
use std::list;
|
||||
use list::{List, Nil, Cons};
|
||||
use dvec::DVec;
|
||||
use std::map::HashMap;
|
||||
use std::map;
|
||||
use std::smallintmap;
|
||||
use syntax::ast::{provided, required, spanned};
|
||||
use syntax::ast_map::node_id_to_str;
|
||||
use syntax::ast_util::{has_legacy_export_attr};
|
||||
use syntax::ast_util::{local_def, respan, split_trait_methods};
|
||||
use syntax::codemap::span;
|
||||
use syntax::print::pprust::*;
|
||||
use syntax::visit;
|
||||
use syntax::{ast, ast_util, ast_map};
|
||||
|
||||
export check;
|
||||
export check_crate;
|
||||
@ -89,24 +89,31 @@ export method_static, method_param, method_trait, method_self;
|
||||
export vtable_static, vtable_param, vtable_trait;
|
||||
export provided_methods_map;
|
||||
export coherence;
|
||||
export check;
|
||||
export rscope;
|
||||
export astconv;
|
||||
export infer;
|
||||
export collect;
|
||||
export coherence;
|
||||
export deriving;
|
||||
|
||||
#[legacy_exports]
|
||||
#[path = "check/mod.rs"]
|
||||
pub mod check;
|
||||
#[legacy_exports]
|
||||
mod rscope;
|
||||
pub mod rscope;
|
||||
#[legacy_exports]
|
||||
mod astconv;
|
||||
pub mod astconv;
|
||||
#[path = "infer/mod.rs"]
|
||||
mod infer;
|
||||
pub mod infer;
|
||||
#[legacy_exports]
|
||||
mod collect;
|
||||
pub mod collect;
|
||||
#[legacy_exports]
|
||||
mod coherence;
|
||||
pub mod coherence;
|
||||
|
||||
#[auto_serialize]
|
||||
#[auto_deserialize]
|
||||
enum method_origin {
|
||||
pub enum method_origin {
|
||||
// fully statically resolved method
|
||||
method_static(ast::def_id),
|
||||
|
||||
@ -139,7 +146,7 @@ type method_param = {
|
||||
bound_num: uint
|
||||
};
|
||||
|
||||
type method_map_entry = {
|
||||
pub type method_map_entry = {
|
||||
// the type and mode of the self parameter, which is not reflected
|
||||
// in the fn type (FIXME #3446)
|
||||
self_arg: ty::arg,
|
||||
@ -153,12 +160,12 @@ type method_map_entry = {
|
||||
|
||||
// maps from an expression id that corresponds to a method call to the details
|
||||
// of the method to be invoked
|
||||
type method_map = HashMap<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.
|
||||
@ -198,7 +205,7 @@ impl vtable_origin {
|
||||
vtable_trait(def_id, ref tys) => {
|
||||
fmt!("vtable_trait(%?:%s, %?)",
|
||||
def_id, ty::item_path_str(tcx, def_id),
|
||||
tys.map(|t| ty_to_str(tcx, *t)))
|
||||
tys.map(|t| ppaux::ty_to_str(tcx, *t)))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -220,7 +227,7 @@ enum crate_ctxt {
|
||||
|
||||
// Functions that write types into the node type table
|
||||
fn write_ty_to_tcx(tcx: ty::ctxt, node_id: ast::node_id, ty: ty::t) {
|
||||
debug!("write_ty_to_tcx(%d, %s)", node_id, ty_to_str(tcx, ty));
|
||||
debug!("write_ty_to_tcx(%d, %s)", node_id, ppaux::ty_to_str(tcx, ty));
|
||||
smallintmap::insert(*tcx.node_types, node_id as uint, ty);
|
||||
}
|
||||
fn write_substs_to_tcx(tcx: ty::ctxt,
|
||||
@ -228,7 +235,7 @@ fn write_substs_to_tcx(tcx: ty::ctxt,
|
||||
+substs: ~[ty::t]) {
|
||||
if substs.len() > 0u {
|
||||
debug!("write_substs_to_tcx(%d, %?)", node_id,
|
||||
substs.map(|t| ty_to_str(tcx, *t)));
|
||||
substs.map(|t| ppaux::ty_to_str(tcx, *t)));
|
||||
tcx.node_type_substs.insert(node_id, substs);
|
||||
}
|
||||
}
|
||||
@ -356,13 +363,13 @@ fn check_main_fn_ty(ccx: @crate_ctxt,
|
||||
main_span,
|
||||
fmt!("Wrong type in main function: found `%s`, \
|
||||
expected `fn() -> ()`",
|
||||
ty_to_str(tcx, main_t)));
|
||||
ppaux::ty_to_str(tcx, main_t)));
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
tcx.sess.span_bug(main_span,
|
||||
~"main has a non-function type: found `" +
|
||||
ty_to_str(tcx, main_t) + ~"`");
|
||||
ppaux::ty_to_str(tcx, main_t) + ~"`");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use result::Result;
|
||||
use core::result::Result;
|
||||
use syntax::parse::token::special_idents;
|
||||
|
||||
trait region_scope {
|
||||
|
@ -145,7 +145,7 @@ mod middle {
|
||||
#[path = "middle/lint.rs"]
|
||||
mod lint;
|
||||
#[path = "middle/borrowck/mod.rs"]
|
||||
mod borrowck;
|
||||
pub mod borrowck;
|
||||
#[legacy_exports]
|
||||
#[path = "middle/mem_categorization.rs"]
|
||||
mod mem_categorization;
|
||||
|
@ -17,19 +17,19 @@ query AST-related information, shielding the rest of Rustdoc from its
|
||||
non-sendableness.
|
||||
*/
|
||||
|
||||
use std::map::HashMap;
|
||||
use rustc::driver::session;
|
||||
use session::{basic_options, options};
|
||||
use session::Session;
|
||||
use rustc::driver::driver;
|
||||
use syntax::diagnostic;
|
||||
use syntax::diagnostic::handler;
|
||||
use syntax::ast;
|
||||
use syntax::codemap;
|
||||
use syntax::ast_map;
|
||||
use rustc::back::link;
|
||||
use rustc::metadata::filesearch;
|
||||
use rustc::driver::driver;
|
||||
use rustc::driver::session::Session;
|
||||
use rustc::driver::session::{basic_options, options};
|
||||
use rustc::driver::session;
|
||||
use rustc::front;
|
||||
use rustc::metadata::filesearch;
|
||||
use std::map::HashMap;
|
||||
use syntax::ast;
|
||||
use syntax::ast_map;
|
||||
use syntax::codemap;
|
||||
use syntax::diagnostic::handler;
|
||||
use syntax::diagnostic;
|
||||
|
||||
pub type Ctxt = {
|
||||
ast: @ast::crate,
|
||||
|
@ -10,12 +10,12 @@
|
||||
|
||||
//! AST-parsing helpers
|
||||
|
||||
use rustc::driver::driver::{file_input, str_input};
|
||||
use rustc::driver::driver;
|
||||
use driver::{file_input, str_input};
|
||||
use rustc::driver::session;
|
||||
use syntax::diagnostic;
|
||||
use syntax::ast;
|
||||
use syntax::codemap;
|
||||
use syntax::diagnostic;
|
||||
use syntax::parse;
|
||||
|
||||
pub fn from_file(file: &Path) -> @ast::crate {
|
||||
|
@ -28,7 +28,7 @@ extern mod rustc(vers = "0.5");
|
||||
extern mod syntax(vers = "0.5");
|
||||
|
||||
use core::*;
|
||||
use io::{ReaderUtil, WriterUtil};
|
||||
use core::io::{ReaderUtil, WriterUtil};
|
||||
use rustc::back;
|
||||
use rustc::driver::{driver, session};
|
||||
use rustc::front;
|
||||
@ -38,8 +38,8 @@ use rustc::middle::{freevars, kind, lint, trans, ty, typeck};
|
||||
use rustc::middle;
|
||||
use syntax::{ast, ast_util, codemap, diagnostic, fold, parse, print, visit};
|
||||
use syntax::ast_util::*;
|
||||
use parse::token;
|
||||
use print::{pp, pprust};
|
||||
use syntax::parse::token;
|
||||
use syntax::print::{pp, pprust};
|
||||
use std::rl;
|
||||
|
||||
/**
|
||||
|
@ -582,4 +582,4 @@ pub impl<D: Deserializer> D: DeserializerHelpers {
|
||||
}
|
||||
}
|
||||
|
||||
pub use traits::*;
|
||||
pub use serialization::traits::*;
|
||||
|
@ -12,9 +12,8 @@
|
||||
|
||||
#[forbid(deprecated_mode)];
|
||||
|
||||
use uv = uv;
|
||||
use uv::iotask;
|
||||
use iotask::IoTask;
|
||||
use uv::iotask::IoTask;
|
||||
use comm = core::comm;
|
||||
|
||||
/**
|
||||
|
@ -15,10 +15,10 @@
|
||||
use ll = uv_ll;
|
||||
use iotask = uv_iotask;
|
||||
use get_gl = get;
|
||||
use iotask::{IoTask, spawn_iotask};
|
||||
use uv_iotask::{IoTask, spawn_iotask};
|
||||
use private::{chan_from_global_ptr, weaken_task};
|
||||
use comm = core::comm;
|
||||
use comm::{Port, Chan, select2, listen};
|
||||
use core::comm::{Port, Chan, select2, listen};
|
||||
use task::TaskBuilder;
|
||||
use either::{Left, Right};
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
use libc::c_void;
|
||||
use ptr::addr_of;
|
||||
use comm = core::comm;
|
||||
use comm::{Port, Chan, listen};
|
||||
use core::comm::{Port, Chan, listen};
|
||||
use task::TaskBuilder;
|
||||
use ll = uv_ll;
|
||||
|
||||
|
@ -88,7 +88,7 @@ node twice.
|
||||
|
||||
*/
|
||||
|
||||
use base::*;
|
||||
use ext::base::*;
|
||||
use codemap::span;
|
||||
use std::map;
|
||||
use std::map::HashMap;
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
use codemap::span;
|
||||
use base::ext_ctxt;
|
||||
use ext::base::ext_ctxt;
|
||||
|
||||
fn mk_expr(cx: ext_ctxt, sp: codemap::span, expr: ast::expr_) ->
|
||||
@ast::expr {
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use base::*;
|
||||
use ext::base::*;
|
||||
|
||||
fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: ~[ast::token_tree])
|
||||
-> base::mac_result {
|
||||
|
@ -18,7 +18,7 @@ use ast::{pat_ident, pat_wild, public, pure_fn, re_anon, stmt, struct_def};
|
||||
use ast::{struct_variant_kind, sty_by_ref, sty_region, tuple_variant_kind};
|
||||
use ast::{ty_nil, ty_param, ty_param_bound, ty_path, ty_rptr, unnamed_field};
|
||||
use ast::{variant};
|
||||
use base::ext_ctxt;
|
||||
use ext::base::ext_ctxt;
|
||||
use codemap::span;
|
||||
use parse::token::special_idents::clownshoes_extensions;
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
* should all get sucked into either the compiler syntax extension plugin
|
||||
* interface.
|
||||
*/
|
||||
use base::*;
|
||||
use build::mk_uniq_str;
|
||||
use ext::base::*;
|
||||
use ext::build::mk_uniq_str;
|
||||
export expand_syntax_ext;
|
||||
|
||||
fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: ~[ast::token_tree])
|
||||
|
@ -16,7 +16,7 @@
|
||||
* compiler syntax extension plugin interface.
|
||||
*/
|
||||
use extfmt::ct::*;
|
||||
use base::*;
|
||||
use ext::base::*;
|
||||
use codemap::span;
|
||||
use ext::build::*;
|
||||
export expand_syntax_ext;
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use base::*;
|
||||
use ext::base::*;
|
||||
use io::WriterUtil;
|
||||
|
||||
fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, tt: ~[ast::token_tree])
|
||||
|
@ -17,7 +17,7 @@ use ast::{ident, node_id};
|
||||
use ast_util::{ident_to_path, respan, dummy_sp};
|
||||
use codemap::span;
|
||||
use ext::base::mk_ctxt;
|
||||
use quote::rt::*;
|
||||
use ext::quote::rt::*;
|
||||
|
||||
// Transitional reexports so qquote can find the paths it is looking for
|
||||
mod syntax {
|
||||
|
@ -31,7 +31,7 @@ that.
|
||||
|
||||
use ext::base::ext_ctxt;
|
||||
|
||||
use proto::{state, protocol, next_state};
|
||||
use ext::pipes::proto::{state, protocol, next_state};
|
||||
|
||||
impl ext_ctxt: proto::visitor<(), (), ()> {
|
||||
fn visit_proto(_proto: protocol,
|
||||
|
@ -49,9 +49,8 @@ use ast::tt_delim;
|
||||
use parse::lexer::{new_tt_reader, reader};
|
||||
use parse::parser::Parser;
|
||||
|
||||
use pipes::parse_proto::proto_parser;
|
||||
|
||||
use pipes::proto::{visit, protocol};
|
||||
use ext::pipes::parse_proto::proto_parser;
|
||||
use ext::pipes::proto::{visit, protocol};
|
||||
|
||||
#[legacy_exports]
|
||||
mod ast_builder;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user