Skip to content

Commit 93eb433

Browse files
committed
Move typeck into its own crate.
1 parent e135fa5 commit 93eb433

File tree

26 files changed

+100
-68
lines changed

26 files changed

+100
-68
lines changed

mk/crates.mk

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ TARGET_CRATES := libc std flate arena term \
5353
serialize getopts collections test time rand \
5454
log regex graphviz core rbml alloc rustrt \
5555
unicode
56-
HOST_CRATES := syntax rustc rustc_trans rustdoc regex_macros fmt_macros \
56+
HOST_CRATES := syntax rustc rustc_typeck rustc_trans rustdoc regex_macros fmt_macros \
5757
rustc_llvm rustc_back
5858
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5959
TOOLS := compiletest rustdoc rustc
@@ -67,7 +67,9 @@ DEPS_std := core libc rand alloc collections rustrt unicode \
6767
native:rust_builtin native:backtrace
6868
DEPS_graphviz := std
6969
DEPS_syntax := std term serialize log fmt_macros arena libc
70-
DEPS_rustc_trans := rustc rustc_back rustc_llvm libc
70+
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
71+
rustc_typeck log syntax serialize rustc_llvm
72+
DEPS_rustc_typeck := rustc syntax
7173
DEPS_rustc := syntax flate arena serialize getopts rbml \
7274
time log graphviz rustc_llvm rustc_back
7375
DEPS_rustc_llvm := native:rustllvm libc std
@@ -110,8 +112,11 @@ ONLY_RLIB_unicode := 1
110112
# You should not need to edit below this line
111113
################################################################################
112114

113-
DOC_CRATES := $(filter-out rustc, $(filter-out rustc_trans, $(filter-out syntax, $(CRATES))))
114-
COMPILER_DOC_CRATES := rustc rustc_trans syntax
115+
DOC_CRATES := $(filter-out rustc, \
116+
$(filter-out rustc_trans, \
117+
$(filter-out rustc_typeck, \
118+
$(filter-out syntax, $(CRATES)))))
119+
COMPILER_DOC_CRATES := rustc rustc_trans rustc_typeck syntax
115120

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

src/librustc/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,6 @@ pub mod middle {
9898
pub mod weak_lang_items;
9999
}
100100

101-
#[path="middle/typeck/mod.rs"]
102-
pub mod typeck;
103-
104101
pub mod metadata;
105102

106103
pub mod session;

src/librustc_trans/driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use middle;
2020
use plugin::load::Plugins;
2121
use plugin::registry::Registry;
2222
use plugin;
23-
use rustc::typeck;
23+
use rustc_typeck as typeck;
2424
use trans;
2525

2626
use util::common::time;

src/librustc_trans/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ extern crate getopts;
3232
extern crate graphviz;
3333
extern crate libc;
3434
extern crate rustc;
35+
extern crate rustc_typeck;
3536
extern crate rustc_back;
3637
#[phase(plugin, link)] extern crate log;
3738
#[phase(plugin, link)] extern crate syntax;

src/librustc/middle/typeck/astconv.rs renamed to src/librustc_typeck/astconv.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,9 @@ use middle::resolve_lifetime as rl;
5454
use middle::subst::{FnSpace, TypeSpace, AssocSpace, SelfSpace, Subst, Substs};
5555
use middle::subst::{VecPerParamSpace};
5656
use middle::ty::{mod, Ty};
57-
use typeck::lookup_def_tcx;
58-
use typeck::rscope::{mod, UnelidableRscope, RegionScope, SpecificRscope,
59-
ShiftedRscope, BindingRscope};
60-
use typeck::TypeAndSubsts;
57+
use rscope::{mod, UnelidableRscope, RegionScope, SpecificRscope,
58+
ShiftedRscope, BindingRscope};
59+
use TypeAndSubsts;
6160
use util::common::ErrorReported;
6261
use util::nodemap::DefIdMap;
6362
use util::ppaux::{mod, Repr, UserString};
@@ -429,9 +428,9 @@ pub fn instantiate_trait_ref<'tcx,AC,RS>(this: &AC,
429428
where AC: AstConv<'tcx>,
430429
RS: RegionScope
431430
{
432-
match lookup_def_tcx(this.tcx(),
433-
ast_trait_ref.path.span,
434-
ast_trait_ref.ref_id) {
431+
match ::lookup_def_tcx(this.tcx(),
432+
ast_trait_ref.path.span,
433+
ast_trait_ref.ref_id) {
435434
def::DefTrait(trait_def_id) => {
436435
let trait_ref = Rc::new(ast_path_to_trait_ref(this, rscope, trait_def_id,
437436
self_ty, &ast_trait_ref.path));
@@ -1477,7 +1476,7 @@ pub fn partition_bounds<'a>(tcx: &ty::ctxt,
14771476
for &ast_bound in ast_bounds.iter() {
14781477
match *ast_bound {
14791478
ast::TraitTyParamBound(ref b) => {
1480-
match lookup_def_tcx(tcx, b.trait_ref.path.span, b.trait_ref.ref_id) {
1479+
match ::lookup_def_tcx(tcx, b.trait_ref.path.span, b.trait_ref.ref_id) {
14811480
def::DefTrait(trait_did) => {
14821481
match trait_def_ids.get(&trait_did) {
14831482
// Already seen this trait. We forbid

src/librustc/middle/typeck/check/_match.rs renamed to src/librustc_typeck/check/_match.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
// except according to those terms.
1010

1111
use middle::def;
12+
use middle::infer::{mod, resolve};
1213
use middle::pat_util::{PatIdMap, pat_id_map, pat_is_binding, pat_is_const};
1314
use middle::subst::{Subst, Substs};
1415
use middle::ty::{mod, Ty};
15-
use typeck::check::{check_expr, check_expr_has_type, demand, FnCtxt};
16-
use typeck::check::{instantiate_path, structurally_resolved_type, valid_range_bounds};
17-
use middle::infer::{mod, resolve};
18-
use typeck::require_same_types;
16+
use check::{check_expr, check_expr_has_type, demand, FnCtxt};
17+
use check::{instantiate_path, structurally_resolved_type, valid_range_bounds};
18+
use require_same_types;
1919
use util::nodemap::FnvHashMap;
2020

2121
use std::cmp;

src/librustc/middle/typeck/check/closure.rs renamed to src/librustc_typeck/check/closure.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ use super::check_fn;
1414
use super::{Expectation, ExpectCastableToType, ExpectHasType, NoExpectation};
1515
use super::FnCtxt;
1616

17+
use astconv;
1718
use middle::infer;
1819
use middle::subst;
1920
use middle::ty::{mod, Ty};
20-
use typeck::astconv;
21-
use typeck::rscope::RegionScope;
21+
use rscope::RegionScope;
2222
use syntax::abi;
2323
use syntax::ast;
2424
use syntax::ast_util;

src/librustc/middle/typeck/check/demand.rs renamed to src/librustc_typeck/check/demand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// except according to those terms.
1010

1111

12+
use check::FnCtxt;
1213
use middle::ty::{mod, Ty};
13-
use typeck::check::FnCtxt;
1414
use middle::infer;
1515
use middle::infer::resolve_type;
1616
use middle::infer::resolve::try_resolve_tvar_shallow;

src/librustc/middle/typeck/check/method/confirm.rs renamed to src/librustc_typeck/check/method/confirm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
use super::probe;
1212

13+
use check::{mod, FnCtxt, NoPreference, PreferMutLvalue};
1314
use middle::subst::{mod, Subst};
1415
use middle::traits;
1516
use middle::ty::{mod, Ty};
1617
use middle::ty::{MethodCall, MethodCallee, MethodObject, MethodOrigin,
1718
MethodParam, MethodStatic, MethodTraitObject, MethodTypeParam};
18-
use typeck::check::{mod, FnCtxt, NoPreference, PreferMutLvalue};
1919
use middle::infer;
2020
use middle::infer::InferCtxt;
2121
use middle::ty_fold::HigherRankedFoldable;

0 commit comments

Comments
 (0)