Split resolve from rustc::middle into rustc_resolve.

This commit is contained in:
Eduard Burtescu 2014-12-19 00:46:26 +02:00
parent a74a050c44
commit c54fc980f3
8 changed files with 51 additions and 29 deletions

View File

@ -53,7 +53,8 @@ TARGET_CRATES := libc std flate arena term \
serialize getopts collections test time rand \
log regex graphviz core rbml alloc \
unicode
RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_driver rustc_trans rustc_back rustc_llvm
RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_resolve rustc_driver \
rustc_trans rustc_back rustc_llvm
HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc regex_macros fmt_macros
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
TOOLS := compiletest rustdoc rustc
@ -67,11 +68,12 @@ DEPS_std := core libc rand alloc collections unicode \
DEPS_graphviz := std
DEPS_syntax := std term serialize log fmt_macros arena libc
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
rustc_typeck log syntax serialize rustc_llvm rustc_trans
rustc_typeck rustc_resolve log syntax serialize rustc_llvm rustc_trans
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
log syntax serialize rustc_llvm
DEPS_rustc_typeck := rustc syntax
DEPS_rustc_borrowck := rustc log graphviz syntax
DEPS_rustc_resolve := rustc log syntax
DEPS_rustc := syntax flate arena serialize getopts rbml \
time log graphviz rustc_llvm rustc_back
DEPS_rustc_llvm := native:rustllvm libc std
@ -118,9 +120,11 @@ DOC_CRATES := $(filter-out rustc, \
$(filter-out rustc_trans, \
$(filter-out rustc_typeck, \
$(filter-out rustc_borrowck, \
$(filter-out rustc_resolve, \
$(filter-out rustc_driver, \
$(filter-out syntax, $(CRATES)))))))
COMPILER_DOC_CRATES := rustc rustc_trans rustc_borrowck rustc_typeck rustc_driver syntax
$(filter-out syntax, $(CRATES))))))))
COMPILER_DOC_CRATES := rustc rustc_trans rustc_borrowck rustc_resolve \
rustc_typeck rustc_driver syntax
# This macro creates some simple definitions for each crate being built, just
# some munging of all of the parameters above.

View File

@ -21,7 +21,8 @@ $(eval $(call RUST_CRATE,coretest))
TEST_TARGET_CRATES = $(filter-out core unicode,$(TARGET_CRATES)) coretest
TEST_DOC_CRATES = $(DOC_CRATES)
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_trans,$(HOST_CRATES))
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve rustc_trans,\
$(HOST_CRATES))
TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
######################################################################

View File

@ -90,7 +90,6 @@ pub mod middle {
pub mod reachable;
pub mod region;
pub mod recursion_limit;
pub mod resolve;
pub mod resolve_lifetime;
pub mod stability;
pub mod subst;

View File

@ -20,6 +20,7 @@ use rustc::plugin::registry::Registry;
use rustc::plugin;
use rustc::util::common::time;
use rustc_borrowck as borrowck;
use rustc_resolve as resolve;
use rustc_trans::back::link;
use rustc_trans::back::write;
use rustc_trans::save;
@ -341,7 +342,7 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
let lang_items = time(time_passes, "language item collection", (), |_|
middle::lang_items::collect_language_items(krate, &sess));
let middle::resolve::CrateMap {
let resolve::CrateMap {
def_map,
freevars,
capture_mode_map,
@ -350,8 +351,8 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
external_exports,
last_private_map
} =
time(time_passes, "resolution", (), |_|
middle::resolve::resolve_crate(&sess, &lang_items, krate));
time(time_passes, "resolution", (),
|_| resolve::resolve_crate(&sess, &lang_items, krate));
// Discard MTWT tables that aren't required past resolution.
syntax::ext::mtwt::clear_tables();

View File

@ -35,6 +35,7 @@ extern crate libc;
extern crate rustc;
extern crate rustc_back;
extern crate rustc_borrowck;
extern crate rustc_resolve;
extern crate rustc_trans;
extern crate rustc_typeck;
#[phase(plugin, link)] extern crate log;

View File

@ -13,9 +13,9 @@
use diagnostic;
use diagnostic::Emitter;
use driver;
use rustc_resolve as resolve;
use rustc_typeck::middle::lang_items;
use rustc_typeck::middle::region::{mod, CodeExtent};
use rustc_typeck::middle::resolve;
use rustc_typeck::middle::resolve_lifetime;
use rustc_typeck::middle::stability;
use rustc_typeck::middle::subst;

View File

@ -8,6 +8,22 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![crate_name = "rustc_resolve"]
#![experimental]
#![crate_type = "dylib"]
#![crate_type = "rlib"]
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![feature(globs, phase, slicing_syntax)]
#![feature(rustc_diagnostic_macros)]
#[phase(plugin, link)] extern crate log;
#[phase(plugin, link)] extern crate syntax;
extern crate rustc;
use self::PatternBindingMode::*;
use self::Namespace::*;
use self::NamespaceError::*;
@ -30,17 +46,17 @@ use self::ModuleKind::*;
use self::TraitReferenceType::*;
use self::FallbackChecks::*;
use session::Session;
use lint;
use metadata::csearch;
use metadata::decoder::{DefLike, DlDef, DlField, DlImpl};
use middle::def::*;
use middle::lang_items::LanguageItems;
use middle::pat_util::pat_bindings;
use middle::privacy::*;
use middle::subst::{ParamSpace, FnSpace, TypeSpace};
use middle::ty::{CaptureModeMap, Freevar, FreevarMap, TraitMap};
use util::nodemap::{NodeMap, NodeSet, DefIdSet, FnvHashMap};
use rustc::session::Session;
use rustc::lint;
use rustc::metadata::csearch;
use rustc::metadata::decoder::{DefLike, DlDef, DlField, DlImpl};
use rustc::middle::def::*;
use rustc::middle::lang_items::LanguageItems;
use rustc::middle::pat_util::pat_bindings;
use rustc::middle::privacy::*;
use rustc::middle::subst::{ParamSpace, FnSpace, TypeSpace};
use rustc::middle::ty::{CaptureModeMap, Freevar, FreevarMap, TraitMap};
use rustc::util::nodemap::{NodeMap, NodeSet, DefIdSet, FnvHashMap};
use syntax::ast::{Arm, BindByRef, BindByValue, BindingMode, Block, Crate, CrateNum};
use syntax::ast::{DeclItem, DefId, Expr, ExprAgain, ExprBreak, ExprField};

View File

@ -24,7 +24,7 @@ impl BarTy {
fn b(&self) {}
}
// If these fail, it's necessary to update middle::resolve and the cfail tests.
// If these fail, it's necessary to update rustc_resolve and the cfail tests.
impl Foo for *const BarTy {
fn bar(&self) {
self.baz();
@ -33,7 +33,7 @@ impl Foo for *const BarTy {
}
}
// If these fail, it's necessary to update middle::resolve and the cfail tests.
// If these fail, it's necessary to update rustc_resolve and the cfail tests.
impl<'a> Foo for &'a BarTy {
fn bar(&self) {
self.baz();
@ -45,7 +45,7 @@ impl<'a> Foo for &'a BarTy {
}
}
// If these fail, it's necessary to update middle::resolve and the cfail tests.
// If these fail, it's necessary to update rustc_resolve and the cfail tests.
impl<'a> Foo for &'a mut BarTy {
fn bar(&self) {
self.baz();
@ -57,7 +57,7 @@ impl<'a> Foo for &'a mut BarTy {
}
}
// If these fail, it's necessary to update middle::resolve and the cfail tests.
// If these fail, it's necessary to update rustc_resolve and the cfail tests.
impl Foo for Box<BarTy> {
fn bar(&self) {
self.baz();
@ -65,7 +65,7 @@ impl Foo for Box<BarTy> {
}
}
// If these fail, it's necessary to update middle::resolve and the cfail tests.
// If these fail, it's necessary to update rustc_resolve and the cfail tests.
impl Foo for *const int {
fn bar(&self) {
self.baz();
@ -73,7 +73,7 @@ impl Foo for *const int {
}
}
// If these fail, it's necessary to update middle::resolve and the cfail tests.
// If these fail, it's necessary to update rustc_resolve and the cfail tests.
impl<'a> Foo for &'a int {
fn bar(&self) {
self.baz();
@ -81,7 +81,7 @@ impl<'a> Foo for &'a int {
}
}
// If these fail, it's necessary to update middle::resolve and the cfail tests.
// If these fail, it's necessary to update rustc_resolve and the cfail tests.
impl<'a> Foo for &'a mut int {
fn bar(&self) {
self.baz();
@ -89,7 +89,7 @@ impl<'a> Foo for &'a mut int {
}
}
// If these fail, it's necessary to update middle::resolve and the cfail tests.
// If these fail, it's necessary to update rustc_resolve and the cfail tests.
impl Foo for Box<int> {
fn bar(&self) {
self.baz();