Skip to content

Commit c54fc98

Browse files
committed
Split resolve from rustc::middle into rustc_resolve.
1 parent a74a050 commit c54fc98

File tree

8 files changed

+51
-29
lines changed

8 files changed

+51
-29
lines changed

mk/crates.mk

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ TARGET_CRATES := libc std flate arena term \
5353
serialize getopts collections test time rand \
5454
log regex graphviz core rbml alloc \
5555
unicode
56-
RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_driver rustc_trans rustc_back rustc_llvm
56+
RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_resolve rustc_driver \
57+
rustc_trans rustc_back rustc_llvm
5758
HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc regex_macros fmt_macros
5859
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5960
TOOLS := compiletest rustdoc rustc
@@ -67,11 +68,12 @@ DEPS_std := core libc rand alloc collections unicode \
6768
DEPS_graphviz := std
6869
DEPS_syntax := std term serialize log fmt_macros arena libc
6970
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
70-
rustc_typeck log syntax serialize rustc_llvm rustc_trans
71+
rustc_typeck rustc_resolve log syntax serialize rustc_llvm rustc_trans
7172
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
7273
log syntax serialize rustc_llvm
7374
DEPS_rustc_typeck := rustc syntax
7475
DEPS_rustc_borrowck := rustc log graphviz syntax
76+
DEPS_rustc_resolve := rustc log syntax
7577
DEPS_rustc := syntax flate arena serialize getopts rbml \
7678
time log graphviz rustc_llvm rustc_back
7779
DEPS_rustc_llvm := native:rustllvm libc std
@@ -118,9 +120,11 @@ DOC_CRATES := $(filter-out rustc, \
118120
$(filter-out rustc_trans, \
119121
$(filter-out rustc_typeck, \
120122
$(filter-out rustc_borrowck, \
123+
$(filter-out rustc_resolve, \
121124
$(filter-out rustc_driver, \
122-
$(filter-out syntax, $(CRATES)))))))
123-
COMPILER_DOC_CRATES := rustc rustc_trans rustc_borrowck rustc_typeck rustc_driver syntax
125+
$(filter-out syntax, $(CRATES))))))))
126+
COMPILER_DOC_CRATES := rustc rustc_trans rustc_borrowck rustc_resolve \
127+
rustc_typeck rustc_driver syntax
124128

125129
# This macro creates some simple definitions for each crate being built, just
126130
# some munging of all of the parameters above.

mk/tests.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ $(eval $(call RUST_CRATE,coretest))
2121

2222
TEST_TARGET_CRATES = $(filter-out core unicode,$(TARGET_CRATES)) coretest
2323
TEST_DOC_CRATES = $(DOC_CRATES)
24-
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_trans,$(HOST_CRATES))
24+
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve rustc_trans,\
25+
$(HOST_CRATES))
2526
TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
2627

2728
######################################################################

src/librustc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ pub mod middle {
9090
pub mod reachable;
9191
pub mod region;
9292
pub mod recursion_limit;
93-
pub mod resolve;
9493
pub mod resolve_lifetime;
9594
pub mod stability;
9695
pub mod subst;

src/librustc_driver/driver.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use rustc::plugin::registry::Registry;
2020
use rustc::plugin;
2121
use rustc::util::common::time;
2222
use rustc_borrowck as borrowck;
23+
use rustc_resolve as resolve;
2324
use rustc_trans::back::link;
2425
use rustc_trans::back::write;
2526
use rustc_trans::save;
@@ -341,7 +342,7 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
341342
let lang_items = time(time_passes, "language item collection", (), |_|
342343
middle::lang_items::collect_language_items(krate, &sess));
343344

344-
let middle::resolve::CrateMap {
345+
let resolve::CrateMap {
345346
def_map,
346347
freevars,
347348
capture_mode_map,
@@ -350,8 +351,8 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
350351
external_exports,
351352
last_private_map
352353
} =
353-
time(time_passes, "resolution", (), |_|
354-
middle::resolve::resolve_crate(&sess, &lang_items, krate));
354+
time(time_passes, "resolution", (),
355+
|_| resolve::resolve_crate(&sess, &lang_items, krate));
355356

356357
// Discard MTWT tables that aren't required past resolution.
357358
syntax::ext::mtwt::clear_tables();

src/librustc_driver/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ extern crate libc;
3535
extern crate rustc;
3636
extern crate rustc_back;
3737
extern crate rustc_borrowck;
38+
extern crate rustc_resolve;
3839
extern crate rustc_trans;
3940
extern crate rustc_typeck;
4041
#[phase(plugin, link)] extern crate log;

src/librustc_driver/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
use diagnostic;
1414
use diagnostic::Emitter;
1515
use driver;
16+
use rustc_resolve as resolve;
1617
use rustc_typeck::middle::lang_items;
1718
use rustc_typeck::middle::region::{mod, CodeExtent};
18-
use rustc_typeck::middle::resolve;
1919
use rustc_typeck::middle::resolve_lifetime;
2020
use rustc_typeck::middle::stability;
2121
use rustc_typeck::middle::subst;

src/librustc/middle/resolve.rs renamed to src/librustc_resolve/lib.rs

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![crate_name = "rustc_resolve"]
12+
#![experimental]
13+
#![crate_type = "dylib"]
14+
#![crate_type = "rlib"]
15+
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
16+
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
17+
html_root_url = "http://doc.rust-lang.org/nightly/")]
18+
19+
#![feature(globs, phase, slicing_syntax)]
20+
#![feature(rustc_diagnostic_macros)]
21+
22+
#[phase(plugin, link)] extern crate log;
23+
#[phase(plugin, link)] extern crate syntax;
24+
25+
extern crate rustc;
26+
1127
use self::PatternBindingMode::*;
1228
use self::Namespace::*;
1329
use self::NamespaceError::*;
@@ -30,17 +46,17 @@ use self::ModuleKind::*;
3046
use self::TraitReferenceType::*;
3147
use self::FallbackChecks::*;
3248

33-
use session::Session;
34-
use lint;
35-
use metadata::csearch;
36-
use metadata::decoder::{DefLike, DlDef, DlField, DlImpl};
37-
use middle::def::*;
38-
use middle::lang_items::LanguageItems;
39-
use middle::pat_util::pat_bindings;
40-
use middle::privacy::*;
41-
use middle::subst::{ParamSpace, FnSpace, TypeSpace};
42-
use middle::ty::{CaptureModeMap, Freevar, FreevarMap, TraitMap};
43-
use util::nodemap::{NodeMap, NodeSet, DefIdSet, FnvHashMap};
49+
use rustc::session::Session;
50+
use rustc::lint;
51+
use rustc::metadata::csearch;
52+
use rustc::metadata::decoder::{DefLike, DlDef, DlField, DlImpl};
53+
use rustc::middle::def::*;
54+
use rustc::middle::lang_items::LanguageItems;
55+
use rustc::middle::pat_util::pat_bindings;
56+
use rustc::middle::privacy::*;
57+
use rustc::middle::subst::{ParamSpace, FnSpace, TypeSpace};
58+
use rustc::middle::ty::{CaptureModeMap, Freevar, FreevarMap, TraitMap};
59+
use rustc::util::nodemap::{NodeMap, NodeSet, DefIdSet, FnvHashMap};
4460

4561
use syntax::ast::{Arm, BindByRef, BindByValue, BindingMode, Block, Crate, CrateNum};
4662
use syntax::ast::{DeclItem, DefId, Expr, ExprAgain, ExprBreak, ExprField};

src/test/run-pass/issue-14254.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl BarTy {
2424
fn b(&self) {}
2525
}
2626

27-
// If these fail, it's necessary to update middle::resolve and the cfail tests.
27+
// If these fail, it's necessary to update rustc_resolve and the cfail tests.
2828
impl Foo for *const BarTy {
2929
fn bar(&self) {
3030
self.baz();
@@ -33,7 +33,7 @@ impl Foo for *const BarTy {
3333
}
3434
}
3535

36-
// If these fail, it's necessary to update middle::resolve and the cfail tests.
36+
// If these fail, it's necessary to update rustc_resolve and the cfail tests.
3737
impl<'a> Foo for &'a BarTy {
3838
fn bar(&self) {
3939
self.baz();
@@ -45,7 +45,7 @@ impl<'a> Foo for &'a BarTy {
4545
}
4646
}
4747

48-
// If these fail, it's necessary to update middle::resolve and the cfail tests.
48+
// If these fail, it's necessary to update rustc_resolve and the cfail tests.
4949
impl<'a> Foo for &'a mut BarTy {
5050
fn bar(&self) {
5151
self.baz();
@@ -57,39 +57,39 @@ impl<'a> Foo for &'a mut BarTy {
5757
}
5858
}
5959

60-
// If these fail, it's necessary to update middle::resolve and the cfail tests.
60+
// If these fail, it's necessary to update rustc_resolve and the cfail tests.
6161
impl Foo for Box<BarTy> {
6262
fn bar(&self) {
6363
self.baz();
6464
Foo::bah(None::<Box<BarTy>>);
6565
}
6666
}
6767

68-
// If these fail, it's necessary to update middle::resolve and the cfail tests.
68+
// If these fail, it's necessary to update rustc_resolve and the cfail tests.
6969
impl Foo for *const int {
7070
fn bar(&self) {
7171
self.baz();
7272
Foo::bah(None::<*const int>);
7373
}
7474
}
7575

76-
// If these fail, it's necessary to update middle::resolve and the cfail tests.
76+
// If these fail, it's necessary to update rustc_resolve and the cfail tests.
7777
impl<'a> Foo for &'a int {
7878
fn bar(&self) {
7979
self.baz();
8080
Foo::bah(None::<&int>);
8181
}
8282
}
8383

84-
// If these fail, it's necessary to update middle::resolve and the cfail tests.
84+
// If these fail, it's necessary to update rustc_resolve and the cfail tests.
8585
impl<'a> Foo for &'a mut int {
8686
fn bar(&self) {
8787
self.baz();
8888
Foo::bah(None::<&mut int>);
8989
}
9090
}
9191

92-
// If these fail, it's necessary to update middle::resolve and the cfail tests.
92+
// If these fail, it's necessary to update rustc_resolve and the cfail tests.
9393
impl Foo for Box<int> {
9494
fn bar(&self) {
9595
self.baz();

0 commit comments

Comments
 (0)