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

This reverts commit a8d37af247.
This commit is contained in:
Patrick Walton 2013-01-08 19:29:16 -08:00
parent a8d37af247
commit 44ab00ee37
250 changed files with 453 additions and 1342 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -111,7 +111,6 @@ lvalues are *never* stored by value.
*/
use core::prelude::*;
use lib::llvm::ValueRef;
use middle::resolve;

View file

@ -11,7 +11,6 @@
// 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 core::prelude::*;
use back::{link, abi};
use driver::session::arch_x86_64;

View file

@ -12,7 +12,6 @@
//
// Code relating to taking, dropping, etc as well as type descriptors.
use core::prelude::*;
use lib::llvm::{ValueRef, TypeRef};
use middle::trans::base::*;

View file

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

View file

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

View file

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

View file

@ -10,8 +10,6 @@
#[warn(deprecated_pattern)];
use core::prelude::*;
use driver::session;
use metadata::csearch;
use metadata;

View file

@ -52,24 +52,18 @@
* an rptr (`&r.T`) use the region `r` that appears in the rptr.
*/
use core::prelude::*;
use middle::pat_util::pat_id_map;
use middle::ty::{FnTyBase, FnMeta, FnSig, ty_param_substs_and_ty};
use middle::ty::{FnTyBase, FnMeta, FnSig};
use middle::ty;
use middle::typeck::check::fn_ctxt;
use middle::typeck::collect;
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};
use middle::typeck::{crate_ctxt, write_substs_to_tcx, write_ty_to_tcx};
use core::result;
use core::vec;
use syntax::ast;
use syntax::codemap::span;
use syntax::print::pprust::path_to_str;
use util::common::indent;
pub trait ast_conv {
fn tcx() -> ty::ctxt;

View file

@ -8,23 +8,17 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use middle::pat_util::{PatIdMap, pat_id_map, pat_is_binding, pat_is_const};
use middle::pat_util::{pat_is_binding, pat_is_const};
use middle::pat_util::{pat_is_variant_or_struct};
use middle::ty;
use middle::typeck::check::demand;
use middle::typeck::check::{check_block, check_expr_with, fn_ctxt};
use middle::typeck::check::{instantiate_path, lookup_def, lookup_local};
use middle::typeck::check::{structure_of, valid_range_bounds};
use middle::typeck::require_same_types;
use core::vec;
use std::map::HashMap;
use syntax::ast;
use syntax::ast_util::walk_pat;
use syntax::ast_util;
use syntax::codemap::span;
use syntax::print::pprust;
fn check_match(fcx: @fn_ctxt,

View file

@ -13,10 +13,8 @@ use middle::ty;
use middle::typeck::check::fn_ctxt;
use middle::typeck::infer;
use core::result::{Err, Ok};
use core::result;
use syntax::ast;
use syntax::codemap::span;
// Requires that the two types unify, and prints an error message if they
// don't.

View file

@ -79,29 +79,20 @@ obtained the type `Foo`, we would never match this method.
*/
use core::prelude::*;
use middle::resolve::{Impl, MethodInfo};
use middle::resolve;
use middle::ty::*;
use middle::ty;
use middle::typeck::check::{fn_ctxt, impl_self_ty};
use middle::typeck::check::{structurally_resolved_type};
use middle::typeck::check::vtable::VtableContext;
use middle::typeck::check::vtable;
use middle::typeck::check;
use middle::typeck::check::vtable;
use middle::typeck::coherence::get_base_type_def_id;
use middle::typeck::infer;
use middle::typeck::{method_map_entry, method_origin, method_param};
use middle::typeck::{method_self, method_static, method_trait};
use util::common::indenter;
use util::ppaux::expr_repr;
use core::dvec::DVec;
use core::result;
use core::uint;
use core::vec;
use std::map::HashMap;
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};
@ -109,7 +100,6 @@ use syntax::ast;
use syntax::ast_map;
use syntax::ast_map::node_id_to_str;
use syntax::ast_util::dummy_sp;
use syntax::codemap::span;
fn lookup(
fcx: @fn_ctxt,

View file

@ -76,14 +76,11 @@ type parameter).
*/
use core::prelude::*;
use middle::capture;
use middle::const_eval;
use middle::pat_util::pat_id_map;
use middle::pat_util;
use middle::ty::{TyVid, vid, FnTyBase, FnMeta, FnSig, VariantInfo_, field};
use middle::ty::{ty_param_bounds_and_ty, ty_param_substs_and_ty};
use middle::ty::{TyVid, vid, FnTyBase, FnMeta, FnSig, VariantInfo_};
use middle::ty;
use middle::typeck::astconv::{ast_conv, ast_path_to_ty};
use middle::typeck::astconv::{ast_region_to_region, ast_ty_to_ty};
@ -92,18 +89,12 @@ use middle::typeck::check::_match::pat_ctxt;
use middle::typeck::check::method::TransformTypeNormally;
use middle::typeck::check::regionmanip::replace_bound_regions_in_fn_ty;
use middle::typeck::check::vtable::{LocationInfo, VtableContext};
use middle::typeck::crate_ctxt;
use middle::typeck::infer::{resolve_type, force_tvar};
use middle::typeck::infer;
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 middle::typeck::rscope;
use middle::typeck::{isr_alist, lookup_def_ccx, method_map_entry};
use middle::typeck::{method_origin, method_self, method_trait, no_params};
use middle::typeck::{require_same_types};
use util::common::{block_query, indenter, loop_query};
use util::ppaux::{bound_region_to_str, expr_repr};
use util::ppaux;
use core::either;
@ -113,19 +104,15 @@ use core::result::{Result, Ok, Err};
use core::result;
use core::str;
use core::vec;
use std::list::Nil;
use std::map::HashMap;
use std::map;
use syntax::ast::{provided, required, spanned, ty_i};
use syntax::ast::ty_i;
use syntax::ast;
use syntax::ast_map;
use syntax::ast_util::{Private, Public, is_local, local_def, respan};
use syntax::ast_util::{visibility_to_privacy};
use syntax::ast_util::{is_local, visibility_to_privacy, Private, Public};
use syntax::ast_util;
use syntax::codemap::span;
use syntax::codemap;
use syntax::parse::token::special_idents;
use syntax::print::pprust::{expr_to_str, pat_to_str};
use syntax::print::pprust;
use syntax::visit;
use syntax;
@ -144,15 +131,6 @@ export DerefArgs;
export DontDerefArgs;
export DoDerefArgs;
export check_item_types;
export check_block;
export check_expr_with;
export fn_ctxt;
export lookup_def;
export structure_of;
export self_info;
export structurally_resolved_type;
export instantiate_path;
export valid_range_bounds;
#[legacy_exports]
pub mod _match;

View file

@ -27,7 +27,6 @@ this point a bit better.
*/
use core::prelude::*;
use middle::freevars::get_freevars;
use middle::pat_util::pat_bindings;
@ -35,17 +34,13 @@ 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::ty;
use middle::typeck::check::fn_ctxt;
use middle::typeck::check::lookup_def;
use middle::typeck::infer::{fres, resolve_and_force_all_but_regions};
use middle::typeck::infer::{resolve_type};
use middle::typeck::infer::{resolve_and_force_all_but_regions, fres};
use util::ppaux::{note_and_explain_region, ty_to_str};
use core::result;
use syntax::ast::{ProtoBare, ProtoBox, ProtoUniq, ProtoBorrowed};
use syntax::ast::{def_arg, def_binding, def_local, def_self, def_upvar};
use syntax::ast;
use syntax::codemap::span;
use syntax::print::pprust;
use syntax::visit;

View file

@ -10,16 +10,9 @@
// #[warn(deprecated_mode)];
use core::prelude::*;
use middle::ty;
use middle::typeck::check::self_info;
use middle::typeck::isr_alist;
use util::common::indenter;
use util::ppaux::region_to_str;
use util::ppaux;
use std::list::Cons;
use syntax::ast;
use syntax::print::pprust::{expr_to_str};

View file

@ -8,30 +8,23 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use middle::resolve;
use middle::ty;
use middle::typeck::check::{fn_ctxt, impl_self_ty};
use middle::typeck::check::{structurally_resolved_type};
use middle::typeck::infer::{fixup_err_to_str, infer_ctxt};
use middle::typeck::infer::{resolve_and_force_all_but_regions, resolve_type};
use middle::typeck::infer;
use middle::typeck::{crate_ctxt, vtable_origin, vtable_param, vtable_res};
use middle::typeck::{vtable_static, vtable_trait};
use util::common::indenter;
use util::ppaux::tys_to_str;
use util::ppaux;
use core::result;
use core::uint;
use core::vec;
use result::{Result, Ok, Err};
use std::map::HashMap;
use syntax::ast;
use syntax::ast_util;
use syntax::codemap::span;
use syntax::print::pprust::expr_to_str;
use syntax::print::pprust;
use syntax::visit;

View file

@ -12,24 +12,18 @@
// unresolved type variables and replaces "ty_var" types with their
// substitutions.
use core::prelude::*;
use middle::pat_util;
use middle::ty;
use middle::typeck::check::{fn_ctxt, lookup_local, self_info};
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 middle::typeck::infer;
use middle::typeck::{vtable_param, vtable_trait, write_substs_to_tcx};
use middle::typeck::{write_ty_to_tcx};
use util::ppaux;
use core::result::{Result, Ok, Err};
use core::vec;
use std::map::HashMap;
use syntax::ast;
use syntax::codemap::span;
use syntax::print::pprust::pat_to_str;
use syntax::visit;
export resolve_type_vars_in_fn;

View file

@ -14,7 +14,6 @@
// has at most one implementation for each type. Then we build a mapping from
// each trait in the system to its implementations.
use core::prelude::*;
use driver;
use metadata::csearch::{ProvidedTraitMethodInfo, each_path, get_impl_traits};
@ -26,14 +25,12 @@ use middle::resolve::{Impl, MethodInfo};
use middle::ty::{ProvidedMethodSource, ProvidedMethodInfo, bound_copy, get};
use middle::ty::{kind_can_be_copied, lookup_item_type, param_bounds, subst};
use middle::ty::{t, ty_bool, ty_bot, ty_box, ty_enum, ty_err, ty_estr};
use middle::ty::{ty_evec, ty_float, ty_fn, ty_infer, ty_int, ty_nil};
use middle::ty::{ty_opaque_box, ty_param, ty_param_bounds_and_ty, ty_ptr};
use middle::ty::{ty_rec, ty_rptr, ty_self, ty_struct, ty_trait, ty_tup};
use middle::ty::{ty_type, ty_uint, ty_uniq};
use middle::ty::{ty_evec, ty_float, ty_fn, ty_infer, ty_int, ty_nil, ty_ptr};
use middle::ty::{ty_rec, ty_rptr, ty_struct, ty_trait, ty_tup, ty_uint};
use middle::ty::{ty_param, ty_self, ty_type, ty_opaque_box, ty_uniq};
use middle::ty::{ty_opaque_closure_ptr, ty_unboxed_vec, type_kind_ext};
use middle::ty::{type_is_ty_var};
use middle::ty;
use middle::typeck::crate_ctxt;
use middle::typeck::infer::{infer_ctxt, can_mk_subty};
use middle::typeck::infer::{new_infer_ctxt, resolve_ivar};
use middle::typeck::infer::{resolve_nested_tvar, resolve_type};
@ -45,7 +42,7 @@ use syntax::ast::{trait_ref};
use syntax::ast;
use syntax::ast_map::node_item;
use syntax::ast_map;
use syntax::ast_util::{def_id_of_def, dummy_sp, local_def};
use syntax::ast_util::{def_id_of_def, dummy_sp};
use syntax::attr;
use syntax::codemap::span;
use syntax::parse;

View file

@ -30,11 +30,8 @@ are represented as `ty_param()` instances.
*/
use core::prelude::*;
use metadata::csearch;
use middle::ty::{FnMeta, FnSig, FnTyBase, InstantiatedTraitRef};
use middle::ty::{ty_param_substs_and_ty};
use middle::ty;
use middle::typeck::astconv::{ast_conv, ty_of_fn_decl, ty_of_arg};
use middle::typeck::astconv::{ast_ty_to_ty};
@ -42,8 +39,7 @@ use middle::typeck::astconv;
use middle::typeck::infer;
use middle::typeck::rscope::*;
use middle::typeck::rscope;
use middle::typeck::{crate_ctxt, lookup_def_tcx, no_params, write_ty_to_tcx};
use util::common::{indenter, pluralize};
use util::common::pluralize;
use util::ppaux;
use util::ppaux::bound_to_str;
@ -52,12 +48,9 @@ use core::option;
use core::vec;
use syntax::ast;
use syntax::ast_map;
use syntax::ast_util::{local_def, split_trait_methods};
use syntax::ast_util::{trait_method_to_ty_method};
use syntax::ast_util::trait_method_to_ty_method;
use syntax::ast_util;
use syntax::codemap::span;
use syntax::codemap;
use syntax::print::pprust::path_to_str;
use syntax::visit;
fn collect_item_types(ccx: @crate_ctxt, crate: @ast::crate) {

View file

@ -58,18 +58,12 @@
// A. But this upper-bound might be stricter than what is truly
// needed.
use core::prelude::*;
use middle::ty::TyVar;
use middle::ty;
use middle::typeck::infer::{ares, cres};
use middle::typeck::infer::combine::combine_fields;
use middle::typeck::infer::sub::Sub;
use middle::typeck::infer::to_str::ToStr;
use util::common::{indent, indenter};
use core::option;
use syntax::ast::{m_const, m_imm, m_mutbl};
use syntax::ast;
fn to_ares(+c: cres<ty::t>) -> ares {

View file

@ -54,22 +54,14 @@
// terms of error reporting, although we do not do that properly right
// now.
use core::prelude::*;
use middle::ty::{FloatVar, FnTyBase, FnMeta, FnSig, IntVar, TyVar};
use middle::ty;
use middle::typeck::infer::glb::Glb;
use middle::typeck::infer::lub::Lub;
use middle::ty::{FnTyBase, FnMeta, FnSig};
use middle::typeck::infer::sub::Sub;
use middle::typeck::infer::to_str::ToStr;
use middle::typeck::infer::{cres, infer_ctxt, ures};
use util::common::indent;
use core::result::{iter_vec2, map_vec2};
use core::vec;
use syntax::ast::{Onceness, purity, ret_style};
use syntax::ast::Onceness;
use syntax::ast;
use syntax::codemap::span;
fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export.

View file

@ -14,10 +14,9 @@ Code related to floating-point type inference.
*/
use core::prelude::*;
use middle::ty::{get, ty_float};
use middle::ty;
use middle::ty::ty_float;
use middle::typeck::infer::to_str::ToStr;
use core::uint;

View file

@ -8,21 +8,17 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use middle::ty;
use middle::typeck::infer::combine::*;
use middle::typeck::infer::lattice::*;
use middle::typeck::infer::glb::Glb;
use middle::typeck::infer::lub::Lub;
use middle::typeck::infer::sub::Sub;
use middle::typeck::infer::to_str::ToStr;
use syntax::ast::{Many, Once, extern_fn, impure_fn, m_const, m_imm, m_mutbl};
use syntax::ast::{noreturn, pure_fn, ret_style, return_val, unsafe_fn};
use util::ppaux::mt_to_str;
use std::list;
use syntax::ast::{Many, Once};
enum Glb = combine_fields; // "greatest lower bound" (common subtype)
impl Glb: combine {

View file

@ -14,9 +14,6 @@ Code related to integral type inference.
*/
use core::prelude::*;
use middle::ty::{get, ty_int, ty_uint};
use middle::ty;
use middle::typeck::infer::to_str::ToStr;

View file

@ -8,14 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use middle::ty::TyVar;
use middle::ty;
use middle::typeck::infer::*;
use middle::typeck::infer::combine::*;
use middle::typeck::infer::glb::Glb;
use middle::typeck::infer::lub::Lub;
use middle::typeck::infer::unify::*;
use middle::typeck::infer::to_str::ToStr;

View file

@ -8,21 +8,15 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use middle::ty::RegionVid;
use middle::ty;
use middle::typeck::infer::combine::*;
use middle::typeck::infer::glb::Glb;
use middle::typeck::infer::lattice::*;
use middle::typeck::infer::sub::Sub;
use middle::typeck::infer::to_str::ToStr;
use middle::typeck::isr_alist;
use util::ppaux::mt_to_str;
use std::list;
use syntax::ast::{Many, Once, extern_fn, m_const, impure_fn, noreturn};
use syntax::ast::{pure_fn, ret_style, return_val, unsafe_fn};
use syntax::ast::{Many, Once};
fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export.

View file

@ -259,8 +259,6 @@ section on "Type Combining" below for details.
#[warn(deprecated_mode)];
#[warn(deprecated_pattern)];
use core::prelude::*;
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};
@ -282,25 +280,21 @@ 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 middle::typeck::isr_alist;
use util::common::{indent, indenter};
use util::ppaux::{bound_region_to_str, ty_to_str, mt_to_str};
use util::ppaux::{ty_to_str, mt_to_str};
use core::cmp::Eq;
use core::dvec::DVec;
use core::result::{Result, Ok, Err, map_vec, map_vec2, iter_vec2};
use core::result;
use core::vec;
use std::list::Nil;
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;
use syntax::ast_util::dummy_sp;
use syntax::ast_util;
use syntax::codemap::span;
use syntax::{ast, ast_util};
export infer_ctxt;
export new_infer_ctxt;
@ -331,13 +325,6 @@ export resolve;
export sub;
export to_str;
export unify;
export uok;
export cyclic_ty, unresolved_ty, region_var_bound_by_region_var;
export bound, bounds;
export ures;
export ares;
export infer_ctxt;
export fixup_err;
#[legacy_exports]
mod assignment;
@ -570,7 +557,7 @@ impl<T:Copy Eq> cres<T>: CresCompare<T> {
}
}
pub fn uok() -> ures {
fn uok() -> ures {
Ok(())
}

View file

@ -539,16 +539,13 @@ more convincing in the future.
#[warn(deprecated_mode)];
#[warn(deprecated_pattern)];
use core::prelude::*;
use middle::region::is_subregion_of;
use middle::region;
use middle::ty;
use middle::ty::{Region, RegionVid, br_fresh, re_bound, re_free, re_infer};
use middle::ty::{re_scope, re_static, ReVar, ReSkolemized};
use middle::typeck::infer::cres;
use middle::ty::{Region, RegionVid, re_static, re_infer, re_free, re_bound};
use middle::ty::{re_scope, ReVar, ReSkolemized, br_fresh};
use middle::typeck::infer::to_str::ToStr;
use util::common::indenter;
use syntax::codemap;
use util::ppaux::note_and_explain_region;
use core::cmp;
@ -561,8 +558,6 @@ use result::{Ok, Err};
use std::map::HashMap;
use std::cell::{Cell, empty_cell};
use std::list::{List, Nil, Cons};
use syntax::codemap::span;
use syntax::codemap;
export RegionVarBindings;
export make_subregion;

View file

@ -46,21 +46,13 @@
// future). If you want to resolve everything but one type, you are
// probably better off writing `resolve_all - resolve_ivar`.
use core::prelude::*;
use middle::ty::{FloatVar, FloatVid, IntVar, IntVid, RegionVid, TyVar, TyVid};
use middle::ty::{type_is_bot};
use middle::ty;
use middle::typeck::infer::{cyclic_ty, fixup_err, fres, infer_ctxt};
use middle::typeck::infer::{region_var_bound_by_region_var, unresolved_ty};
use middle::typeck::infer::floating::*;
use middle::typeck::infer::floating;
use middle::typeck::infer::integral::*;
use middle::typeck::infer::integral;
use middle::typeck::infer::to_str::ToStr;
use middle::typeck::infer::unify::root;
use util::common::indent;
use util::ppaux::ty_to_str;
use core::uint;
use core::vec;

View file

@ -8,22 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use middle::ty;
use middle::typeck::check::regionmanip::replace_bound_regions_in_fn_ty;
use middle::typeck::infer::combine::*;
use middle::typeck::infer::cres;
use middle::typeck::infer::glb::Glb;
use middle::typeck::infer::infer_ctxt;
use middle::typeck::infer::lub::Lub;
use middle::typeck::infer::to_str::ToStr;
use middle::typeck::infer::unify::*;
use util::ppaux::bound_region_to_str;
use std::list::Nil;
use std::list;
use syntax::ast::{m_const, purity, ret_style};
fn macros() { include!("macros.rs"); } // FIXME(#3114): Macro import/export.

View file

@ -16,24 +16,22 @@ Note: This module is only compiled when doing unit testing.
*/
use core::prelude::*;
use driver::diagnostic;
use driver::driver::{optgroups, build_session_options, build_session};
use driver::driver::{str_input, build_configuration};
use middle::lang_items::{LanguageItems, language_items};
use middle::ty::{FnTyBase, FnMeta, FnSig};
use util::ppaux::ty_to_str;
use std::getopts::groups::{optopt, optmulti, optflag, optflagopt, getopts};
use std::getopts::groups;
use std::getopts::{opt_present};
use std::getopts;
use dvec::DVec;
use std::getopts;
use std::map::HashMap;
use syntax::ast_util::dummy_sp;
use syntax::parse::parse_crate_from_source_str;
use std::getopts;
use std::getopts::{opt_present};
use std::getopts::groups;
use std::getopts::groups::{optopt, optmulti, optflag, optflagopt, getopts};
use driver::driver::{optgroups, build_session_options, build_session,
str_input, build_configuration};
use driver::diagnostic;
use syntax::{ast, attr, parse};
use syntax::parse::parse_crate_from_source_str;
use middle::lang_items::LanguageItems;
use util::ppaux::ty_to_str;
use syntax::ast_util::dummy_sp;
use middle::ty::{FnTyBase, FnMeta, FnSig};
struct Env {
crate: @ast::crate,

View file

@ -8,16 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use middle::ty::vid;
use middle::ty;
use middle::typeck::infer::{bound, bounds};
use middle::typeck::infer::floating::float_ty_set;
use middle::typeck::infer::infer_ctxt;
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};
use util::ppaux::{mt_to_str, ty_to_str};
use util::ppaux;
use core::uint;

View file

@ -8,19 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use middle::ty::vid;
use middle::ty;
use middle::typeck::infer::{bound, bounds, cres, uok, ures};
use middle::typeck::infer::combine::combine;
use middle::typeck::infer::floating::*;
use middle::typeck::infer::floating;
use middle::typeck::infer::infer_ctxt;
use middle::typeck::infer::integral::*;
use middle::typeck::infer::integral;
use middle::typeck::infer::to_str::ToStr;
use util::common::{indent, indenter};
use core::result;
use std::smallintmap::SmallIntMap;

View file

@ -50,8 +50,6 @@ independently:
#[legacy_exports];
use core::prelude::*;
use metadata::csearch;
use middle::pat_util::{pat_id_map, PatIdMap};
use middle::resolve;
@ -101,12 +99,6 @@ export infer;
export collect;
export coherence;
export deriving;
export crate_ctxt;
export write_ty_to_tcx, write_substs_to_tcx;
export no_params;
export isr_alist;
export require_same_types;
export lookup_def_ccx, lookup_def_tcx;
#[legacy_exports]
#[path = "check/mod.rs"]
@ -233,7 +225,7 @@ struct crate_ctxt__ {
tcx: ty::ctxt
}
pub enum crate_ctxt {
enum crate_ctxt {
crate_ctxt_(crate_ctxt__)
}

View file

@ -8,14 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
use middle::ty;
use core::result::Result;
use core::result;
use syntax::ast;
use syntax::codemap::span;
use syntax::parse::token::special_idents;
trait region_scope {

View file

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

View file

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