about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2014-11-26 06:11:29 -0500
committerNiko Matsakis <niko@alum.mit.edu>2014-12-04 10:04:52 -0500
commit93eb4333a085008a55e98259e454c5c592a03d45 (patch)
treead79b50f0e5674d1e6a4f64ab0c7b8f576c9f205
parente135fa5b49b215e03802ea6fc99405fab8cbe8e9 (diff)
downloadrust-93eb4333a085008a55e98259e454c5c592a03d45.tar.gz
rust-93eb4333a085008a55e98259e454c5c592a03d45.zip
Move typeck into its own crate.
-rw-r--r--mk/crates.mk13
-rw-r--r--src/librustc/lib.rs3
-rw-r--r--src/librustc_trans/driver/driver.rs2
-rw-r--r--src/librustc_trans/lib.rs1
-rw-r--r--src/librustc_typeck/astconv.rs (renamed from src/librustc/middle/typeck/astconv.rs)15
-rw-r--r--src/librustc_typeck/check/_match.rs (renamed from src/librustc/middle/typeck/check/_match.rs)8
-rw-r--r--src/librustc_typeck/check/closure.rs (renamed from src/librustc/middle/typeck/check/closure.rs)4
-rw-r--r--src/librustc_typeck/check/demand.rs (renamed from src/librustc/middle/typeck/check/demand.rs)2
-rw-r--r--src/librustc_typeck/check/method/confirm.rs (renamed from src/librustc/middle/typeck/check/method/confirm.rs)2
-rw-r--r--src/librustc_typeck/check/method/doc.rs (renamed from src/librustc/middle/typeck/check/method/doc.rs)0
-rw-r--r--src/librustc_typeck/check/method/mod.rs (renamed from src/librustc/middle/typeck/check/method/mod.rs)10
-rw-r--r--src/librustc_typeck/check/method/probe.rs (renamed from src/librustc/middle/typeck/check/method/probe.rs)4
-rw-r--r--src/librustc_typeck/check/mod.rs (renamed from src/librustc/middle/typeck/check/mod.rs)14
-rw-r--r--src/librustc_typeck/check/regionck.rs (renamed from src/librustc/middle/typeck/check/regionck.rs)8
-rw-r--r--src/librustc_typeck/check/regionmanip.rs (renamed from src/librustc/middle/typeck/check/regionmanip.rs)0
-rw-r--r--src/librustc_typeck/check/vtable.rs (renamed from src/librustc/middle/typeck/check/vtable.rs)3
-rw-r--r--src/librustc_typeck/check/wf.rs (renamed from src/librustc/middle/typeck/check/wf.rs)6
-rw-r--r--src/librustc_typeck/check/writeback.rs (renamed from src/librustc/middle/typeck/check/writeback.rs)8
-rw-r--r--src/librustc_typeck/coherence/mod.rs (renamed from src/librustc/middle/typeck/coherence/mod.rs)2
-rw-r--r--src/librustc_typeck/coherence/orphan.rs (renamed from src/librustc/middle/typeck/coherence/orphan.rs)0
-rw-r--r--src/librustc_typeck/coherence/overlap.rs (renamed from src/librustc/middle/typeck/coherence/overlap.rs)0
-rw-r--r--src/librustc_typeck/collect.rs (renamed from src/librustc/middle/typeck/collect.rs)25
-rw-r--r--src/librustc_typeck/diagnostics.rs4
-rw-r--r--src/librustc_typeck/lib.rs (renamed from src/librustc/middle/typeck/mod.rs)34
-rw-r--r--src/librustc_typeck/rscope.rs (renamed from src/librustc/middle/typeck/rscope.rs)0
-rw-r--r--src/librustc_typeck/variance.rs (renamed from src/librustc/middle/typeck/variance.rs)0
26 files changed, 100 insertions, 68 deletions
diff --git a/mk/crates.mk b/mk/crates.mk
index 77cea02f43b..839631f02ab 100644
--- a/mk/crates.mk
+++ b/mk/crates.mk
@@ -53,7 +53,7 @@ TARGET_CRATES := libc std flate arena term \
                  serialize getopts collections test time rand \
                  log regex graphviz core rbml alloc rustrt \
                  unicode
-HOST_CRATES := syntax rustc rustc_trans rustdoc regex_macros fmt_macros \
+HOST_CRATES := syntax rustc rustc_typeck rustc_trans rustdoc regex_macros fmt_macros \
 	       rustc_llvm rustc_back
 CRATES := $(TARGET_CRATES) $(HOST_CRATES)
 TOOLS := compiletest rustdoc rustc
@@ -67,7 +67,9 @@ DEPS_std := core libc rand alloc collections rustrt unicode \
 	native:rust_builtin native:backtrace
 DEPS_graphviz := std
 DEPS_syntax := std term serialize log fmt_macros arena libc
-DEPS_rustc_trans := rustc rustc_back rustc_llvm libc
+DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
+                    rustc_typeck log syntax serialize rustc_llvm
+DEPS_rustc_typeck := rustc syntax
 DEPS_rustc := syntax flate arena serialize getopts rbml \
               time log graphviz rustc_llvm rustc_back
 DEPS_rustc_llvm := native:rustllvm libc std
@@ -110,8 +112,11 @@ ONLY_RLIB_unicode := 1
 # You should not need to edit below this line
 ################################################################################
 
-DOC_CRATES := $(filter-out rustc, $(filter-out rustc_trans, $(filter-out syntax, $(CRATES))))
-COMPILER_DOC_CRATES := rustc rustc_trans syntax
+DOC_CRATES := $(filter-out rustc, \
+              $(filter-out rustc_trans, \
+              $(filter-out rustc_typeck, \
+              $(filter-out syntax, $(CRATES)))))
+COMPILER_DOC_CRATES := rustc rustc_trans rustc_typeck syntax
 
 # This macro creates some simple definitions for each crate being built, just
 # some munging of all of the parameters above.
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index aa31144182d..a964609e4e6 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -98,9 +98,6 @@ pub mod middle {
     pub mod weak_lang_items;
 }
 
-#[path="middle/typeck/mod.rs"]
-pub mod typeck;
-
 pub mod metadata;
 
 pub mod session;
diff --git a/src/librustc_trans/driver/driver.rs b/src/librustc_trans/driver/driver.rs
index 47ba048a21b..f7cdc7de560 100644
--- a/src/librustc_trans/driver/driver.rs
+++ b/src/librustc_trans/driver/driver.rs
@@ -20,7 +20,7 @@ use middle;
 use plugin::load::Plugins;
 use plugin::registry::Registry;
 use plugin;
-use rustc::typeck;
+use rustc_typeck as typeck;
 use trans;
 
 use util::common::time;
diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs
index 4dc8c4d1736..8070b319f18 100644
--- a/src/librustc_trans/lib.rs
+++ b/src/librustc_trans/lib.rs
@@ -32,6 +32,7 @@ extern crate getopts;
 extern crate graphviz;
 extern crate libc;
 extern crate rustc;
+extern crate rustc_typeck;
 extern crate rustc_back;
 #[phase(plugin, link)] extern crate log;
 #[phase(plugin, link)] extern crate syntax;
diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc_typeck/astconv.rs
index f35b4d66022..d95ad9a11c8 100644
--- a/src/librustc/middle/typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -54,10 +54,9 @@ use middle::resolve_lifetime as rl;
 use middle::subst::{FnSpace, TypeSpace, AssocSpace, SelfSpace, Subst, Substs};
 use middle::subst::{VecPerParamSpace};
 use middle::ty::{mod, Ty};
-use typeck::lookup_def_tcx;
-use typeck::rscope::{mod, UnelidableRscope, RegionScope, SpecificRscope,
-                     ShiftedRscope, BindingRscope};
-use typeck::TypeAndSubsts;
+use rscope::{mod, UnelidableRscope, RegionScope, SpecificRscope,
+             ShiftedRscope, BindingRscope};
+use TypeAndSubsts;
 use util::common::ErrorReported;
 use util::nodemap::DefIdMap;
 use util::ppaux::{mod, Repr, UserString};
@@ -429,9 +428,9 @@ pub fn instantiate_trait_ref<'tcx,AC,RS>(this: &AC,
                                          where AC: AstConv<'tcx>,
                                                RS: RegionScope
 {
-    match lookup_def_tcx(this.tcx(),
-                         ast_trait_ref.path.span,
-                         ast_trait_ref.ref_id) {
+    match ::lookup_def_tcx(this.tcx(),
+                           ast_trait_ref.path.span,
+                           ast_trait_ref.ref_id) {
         def::DefTrait(trait_def_id) => {
             let trait_ref = Rc::new(ast_path_to_trait_ref(this, rscope, trait_def_id,
                                                           self_ty, &ast_trait_ref.path));
@@ -1477,7 +1476,7 @@ pub fn partition_bounds<'a>(tcx: &ty::ctxt,
     for &ast_bound in ast_bounds.iter() {
         match *ast_bound {
             ast::TraitTyParamBound(ref b) => {
-                match lookup_def_tcx(tcx, b.trait_ref.path.span, b.trait_ref.ref_id) {
+                match ::lookup_def_tcx(tcx, b.trait_ref.path.span, b.trait_ref.ref_id) {
                     def::DefTrait(trait_did) => {
                         match trait_def_ids.get(&trait_did) {
                             // Already seen this trait. We forbid
diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs
index acc06cbd1cc..7dcf0aa3e21 100644
--- a/src/librustc/middle/typeck/check/_match.rs
+++ b/src/librustc_typeck/check/_match.rs
@@ -9,13 +9,13 @@
 // except according to those terms.
 
 use middle::def;
+use middle::infer::{mod, resolve};
 use middle::pat_util::{PatIdMap, pat_id_map, pat_is_binding, pat_is_const};
 use middle::subst::{Subst, Substs};
 use middle::ty::{mod, Ty};
-use typeck::check::{check_expr, check_expr_has_type, demand, FnCtxt};
-use typeck::check::{instantiate_path, structurally_resolved_type, valid_range_bounds};
-use middle::infer::{mod, resolve};
-use typeck::require_same_types;
+use check::{check_expr, check_expr_has_type, demand, FnCtxt};
+use check::{instantiate_path, structurally_resolved_type, valid_range_bounds};
+use require_same_types;
 use util::nodemap::FnvHashMap;
 
 use std::cmp;
diff --git a/src/librustc/middle/typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs
index 37059dec30f..34030ae4493 100644
--- a/src/librustc/middle/typeck/check/closure.rs
+++ b/src/librustc_typeck/check/closure.rs
@@ -14,11 +14,11 @@ use super::check_fn;
 use super::{Expectation, ExpectCastableToType, ExpectHasType, NoExpectation};
 use super::FnCtxt;
 
+use astconv;
 use middle::infer;
 use middle::subst;
 use middle::ty::{mod, Ty};
-use typeck::astconv;
-use typeck::rscope::RegionScope;
+use rscope::RegionScope;
 use syntax::abi;
 use syntax::ast;
 use syntax::ast_util;
diff --git a/src/librustc/middle/typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs
index 694ed890d76..2b8a52f050d 100644
--- a/src/librustc/middle/typeck/check/demand.rs
+++ b/src/librustc_typeck/check/demand.rs
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 
+use check::FnCtxt;
 use middle::ty::{mod, Ty};
-use typeck::check::FnCtxt;
 use middle::infer;
 use middle::infer::resolve_type;
 use middle::infer::resolve::try_resolve_tvar_shallow;
diff --git a/src/librustc/middle/typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs
index 078f4b64ac4..1fe73f0478d 100644
--- a/src/librustc/middle/typeck/check/method/confirm.rs
+++ b/src/librustc_typeck/check/method/confirm.rs
@@ -10,12 +10,12 @@
 
 use super::probe;
 
+use check::{mod, FnCtxt, NoPreference, PreferMutLvalue};
 use middle::subst::{mod, Subst};
 use middle::traits;
 use middle::ty::{mod, Ty};
 use middle::ty::{MethodCall, MethodCallee, MethodObject, MethodOrigin,
                  MethodParam, MethodStatic, MethodTraitObject, MethodTypeParam};
-use typeck::check::{mod, FnCtxt, NoPreference, PreferMutLvalue};
 use middle::infer;
 use middle::infer::InferCtxt;
 use middle::ty_fold::HigherRankedFoldable;
diff --git a/src/librustc/middle/typeck/check/method/doc.rs b/src/librustc_typeck/check/method/doc.rs
index 6129e38e39c..6129e38e39c 100644
--- a/src/librustc/middle/typeck/check/method/doc.rs
+++ b/src/librustc_typeck/check/method/doc.rs
diff --git a/src/librustc/middle/typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs
index 117eb385eff..f87a4c9294b 100644
--- a/src/librustc/middle/typeck/check/method/mod.rs
+++ b/src/librustc_typeck/check/method/mod.rs
@@ -10,16 +10,16 @@
 
 //! Method lookup: the secret sauce of Rust. See `doc.rs`.
 
+use astconv::AstConv;
+use check::{FnCtxt};
+use check::{impl_self_ty};
+use check::vtable;
+use check::vtable::select_new_fcx_obligations;
 use middle::subst;
 use middle::subst::{Subst};
 use middle::traits;
 use middle::ty::*;
 use middle::ty;
-use typeck::astconv::AstConv;
-use typeck::check::{FnCtxt};
-use typeck::check::{impl_self_ty};
-use typeck::check::vtable;
-use typeck::check::vtable::select_new_fcx_obligations;
 use middle::infer;
 use util::ppaux::{Repr, UserString};
 
diff --git a/src/librustc/middle/typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs
index 73e7c5c6635..6ff276edbce 100644
--- a/src/librustc/middle/typeck/check/method/probe.rs
+++ b/src/librustc_typeck/check/method/probe.rs
@@ -12,6 +12,8 @@ use super::{MethodError,Ambiguity,NoMatch};
 use super::MethodIndex;
 use super::{CandidateSource,ImplSource,TraitSource};
 
+use check;
+use check::{FnCtxt, NoPreference};
 use middle::fast_reject;
 use middle::subst;
 use middle::subst::Subst;
@@ -19,8 +21,6 @@ use middle::traits;
 use middle::ty::{mod, Ty};
 use middle::ty::{MethodObject};
 use middle::ty_fold::HigherRankedFoldable;
-use typeck::check;
-use typeck::check::{FnCtxt, NoPreference};
 use middle::infer;
 use middle::infer::InferCtxt;
 use syntax::ast;
diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index e2ec9ba1ccb..a0f3f2734d9 100644
--- a/src/librustc/middle/typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -31,7 +31,7 @@ can be broken down into several distinct phases:
 
   In the process of checking, various constraints will be placed on
   these type variables through the subtyping relationships requested
-  through the `demand` module.  The `typeck::infer` module is in charge
+  through the `demand` module.  The `infer` module is in charge
   of resolving those constraints.
 
 - regionck: after main is complete, the regionck pass goes over all
@@ -82,7 +82,8 @@ pub use self::Expectation::*;
 use self::IsBinopAssignment::*;
 use self::TupleArgumentsFlag::*;
 
-use session::Session;
+use astconv::{mod, ast_region_to_region, ast_ty_to_ty, AstConv};
+use check::_match::pat_ctxt;
 use middle::{const_eval, def, traits};
 use middle::infer;
 use middle::lang_items::IteratorItem;
@@ -96,11 +97,10 @@ use middle::ty::{mod, Ty};
 use middle::ty::liberate_late_bound_regions;
 use middle::ty::{MethodCall, MethodCallee, MethodMap, ObjectCastMap};
 use middle::ty_fold::TypeFolder;
-use typeck::astconv::{mod, ast_region_to_region, ast_ty_to_ty, AstConv};
-use typeck::check::_match::pat_ctxt;
-use typeck::rscope::RegionScope;
-use typeck::{CrateCtxt, lookup_def_ccx, no_params, require_same_types};
-use typeck::TypeAndSubsts;
+use rscope::RegionScope;
+use session::Session;
+use {CrateCtxt, lookup_def_ccx, no_params, require_same_types};
+use TypeAndSubsts;
 use middle::lang_items::TypeIdLangItem;
 use lint;
 use util::common::{block_query, indenter, loop_query};
diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs
index bb5f6a4cf48..2aec4393de9 100644
--- a/src/librustc/middle/typeck/check/regionck.rs
+++ b/src/librustc_typeck/check/regionck.rs
@@ -114,16 +114,16 @@
 //! then mean that all later passes would have to check for these figments
 //! and report an error, and it just seems like more mess in the end.)
 
+use astconv::AstConv;
+use check::FnCtxt;
+use check::regionmanip;
+use check::vtable;
 use middle::def;
 use middle::mem_categorization as mc;
 use middle::region::CodeExtent;
 use middle::traits;
 use middle::ty::{ReScope};
 use middle::ty::{mod, Ty, MethodCall};
-use typeck::astconv::AstConv;
-use typeck::check::FnCtxt;
-use typeck::check::regionmanip;
-use typeck::check::vtable;
 use middle::infer::resolve_and_force_all_but_regions;
 use middle::infer::resolve_type;
 use middle::infer;
diff --git a/src/librustc/middle/typeck/check/regionmanip.rs b/src/librustc_typeck/check/regionmanip.rs
index 92dfd8b5f56..92dfd8b5f56 100644
--- a/src/librustc/middle/typeck/check/regionmanip.rs
+++ b/src/librustc_typeck/check/regionmanip.rs
diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc_typeck/check/vtable.rs
index 46b21825854..c2b263885bd 100644
--- a/src/librustc/middle/typeck/check/vtable.rs
+++ b/src/librustc_typeck/check/vtable.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use check::{FnCtxt, structurally_resolved_type};
 use middle::subst::{SelfSpace, FnSpace};
 use middle::traits;
 use middle::traits::{SelectionError, OutputTypeParameterMismatch, Overflow, Unimplemented};
@@ -15,8 +16,6 @@ use middle::traits::{Obligation, obligation_for_builtin_bound};
 use middle::traits::{FulfillmentError, CodeSelectionError, CodeAmbiguity};
 use middle::traits::{ObligationCause};
 use middle::ty::{mod, Ty};
-use typeck::check::{FnCtxt,
-                            structurally_resolved_type};
 use middle::infer;
 use std::rc::Rc;
 use syntax::ast;
diff --git a/src/librustc/middle/typeck/check/wf.rs b/src/librustc_typeck/check/wf.rs
index 290658650ab..1769c588ec1 100644
--- a/src/librustc/middle/typeck/check/wf.rs
+++ b/src/librustc_typeck/check/wf.rs
@@ -8,6 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use astconv::AstConv;
+use check::{FnCtxt, Inherited, blank_fn_ctxt, vtable, regionck};
+use CrateCtxt;
 use middle::region;
 use middle::subst;
 use middle::subst::{Subst};
@@ -15,9 +18,6 @@ use middle::traits;
 use middle::ty::{mod, Ty};
 use middle::ty::liberate_late_bound_regions;
 use middle::ty_fold::{TypeFolder, TypeFoldable};
-use typeck::astconv::AstConv;
-use typeck::check::{FnCtxt, Inherited, blank_fn_ctxt, vtable, regionck};
-use typeck::CrateCtxt;
 use util::ppaux::Repr;
 
 use std::collections::HashSet;
diff --git a/src/librustc/middle/typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs
index 318e4a8fa6b..777f354bec1 100644
--- a/src/librustc/middle/typeck/check/writeback.rs
+++ b/src/librustc_typeck/check/writeback.rs
@@ -13,17 +13,17 @@
 // substitutions.
 use self::ResolveReason::*;
 
+use astconv::AstConv;
+use check::FnCtxt;
 use middle::def;
 use middle::pat_util;
 use middle::ty::{mod, Ty, MethodCall, MethodCallee};
 use middle::ty_fold::{TypeFolder,TypeFoldable};
-use typeck::astconv::AstConv;
-use typeck::check::FnCtxt;
 use middle::infer::{force_all, resolve_all, resolve_region};
 use middle::infer::resolve_type;
 use middle::infer;
-use typeck::write_substs_to_tcx;
-use typeck::write_ty_to_tcx;
+use write_substs_to_tcx;
+use write_ty_to_tcx;
 use util::ppaux::Repr;
 
 use std::cell::Cell;
diff --git a/src/librustc/middle/typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs
index d353ccf0b58..b8642ddde40 100644
--- a/src/librustc/middle/typeck/coherence/mod.rs
+++ b/src/librustc_typeck/coherence/mod.rs
@@ -30,7 +30,7 @@ use middle::ty::{ty_closure};
 use middle::ty::type_is_ty_var;
 use middle::subst::Subst;
 use middle::ty;
-use typeck::CrateCtxt;
+use CrateCtxt;
 use middle::infer::combine::Combine;
 use middle::infer::InferCtxt;
 use middle::infer::{new_infer_ctxt, resolve_ivar, resolve_type};
diff --git a/src/librustc/middle/typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs
index dc3afaae35f..dc3afaae35f 100644
--- a/src/librustc/middle/typeck/coherence/orphan.rs
+++ b/src/librustc_typeck/coherence/orphan.rs
diff --git a/src/librustc/middle/typeck/coherence/overlap.rs b/src/librustc_typeck/coherence/overlap.rs
index 0e74d4578d9..0e74d4578d9 100644
--- a/src/librustc/middle/typeck/coherence/overlap.rs
+++ b/src/librustc_typeck/coherence/overlap.rs
diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc_typeck/collect.rs
index 6b4df1f1dc9..717e886029a 100644
--- a/src/librustc/middle/typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -32,6 +32,9 @@ as `ty_param()` instances.
 use self::ConvertMethodContext::*;
 use self::CreateTypeParametersForAssociatedTypesFlag::*;
 
+use astconv::{AstConv, ty_of_arg};
+use astconv::{ast_ty_to_ty, ast_region_to_region};
+use astconv;
 use metadata::csearch;
 use middle::def;
 use middle::lang_items::SizedTraitLangItem;
@@ -43,13 +46,9 @@ use middle::ty::{ImplContainer, ImplOrTraitItemContainer, TraitContainer};
 use middle::ty::{Polytype};
 use middle::ty::{mod, Ty};
 use middle::ty_fold::TypeFolder;
-use typeck::astconv::{AstConv, ty_of_arg};
-use typeck::astconv::{ast_ty_to_ty, ast_region_to_region};
-use typeck::astconv;
 use middle::infer;
-use typeck::rscope::*;
-use typeck::{CrateCtxt, lookup_def_tcx, no_params, write_ty_to_tcx};
-use typeck;
+use rscope::*;
+use {CrateCtxt, lookup_def_tcx, no_params, write_ty_to_tcx};
 use util::nodemap::{FnvHashMap, FnvHashSet};
 use util::ppaux;
 use util::ppaux::{Repr,UserString};
@@ -2159,13 +2158,13 @@ fn check_method_self_type<'a, 'tcx, RS:RegionScope>(
                base_type.repr(crate_context.tcx),
                base_type_free.repr(crate_context.tcx));
         let infcx = infer::new_infer_ctxt(crate_context.tcx);
-        drop(typeck::require_same_types(crate_context.tcx,
-                                        Some(&infcx),
-                                        false,
-                                        explicit_self.span,
-                                        base_type_free,
-                                        required_type_free,
-                                        || {
+        drop(::require_same_types(crate_context.tcx,
+                                  Some(&infcx),
+                                  false,
+                                  explicit_self.span,
+                                  base_type_free,
+                                  required_type_free,
+                                  || {
                 format!("mismatched self type: expected `{}`",
                         ppaux::ty_to_string(crate_context.tcx, required_type))
         }));
diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs
index afbb18faa0b..36e81f18103 100644
--- a/src/librustc_typeck/diagnostics.rs
+++ b/src/librustc_typeck/diagnostics.rs
@@ -145,5 +145,7 @@ register_diagnostics!(
     E0166,
     E0167,
     E0168,
-    E0169
+    E0169,
+    E0171,
+    E0172
 )
diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc_typeck/lib.rs
index c2b3fe1f008..2f5b473567f 100644
--- a/src/librustc/middle/typeck/mod.rs
+++ b/src/librustc_typeck/lib.rs
@@ -1,4 +1,4 @@
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-/*
+/*!
 
 typeck.rs, an introduction
 
@@ -57,10 +57,37 @@ independently:
   all subtyping and assignment constraints are met.  In essence, the check
   module specifies the constraints, and the infer module solves them.
 
+# Note
+
+This API is completely unstable and subject to change.
+
 */
 
+#![crate_name = "rustc_typeck"]
+#![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(default_type_params, globs, if_let, import_shadowing, macro_rules, phase, quote)]
+#![feature(slicing_syntax, tuple_indexing, unsafe_destructor)]
+#![feature(rustc_diagnostic_macros)]
 #![allow(non_camel_case_types)]
 
+#[phase(plugin, link)] extern crate log;
+#[phase(plugin, link)] extern crate syntax;
+
+extern crate arena;
+extern crate rustc;
+
+pub use rustc::lint;
+pub use rustc::metadata;
+pub use rustc::middle;
+pub use rustc::session;
+pub use rustc::util;
+
 use middle::def;
 use middle::resolve;
 use middle::infer;
@@ -76,6 +103,9 @@ use syntax::codemap::Span;
 use syntax::print::pprust::*;
 use syntax::{ast, ast_map, abi};
 
+#[cfg(stage0)]
+mod diagnostics;
+
 mod check;
 mod rscope;
 mod astconv;
diff --git a/src/librustc/middle/typeck/rscope.rs b/src/librustc_typeck/rscope.rs
index 3bca24f479f..3bca24f479f 100644
--- a/src/librustc/middle/typeck/rscope.rs
+++ b/src/librustc_typeck/rscope.rs
diff --git a/src/librustc/middle/typeck/variance.rs b/src/librustc_typeck/variance.rs
index ade3144ce41..ade3144ce41 100644
--- a/src/librustc/middle/typeck/variance.rs
+++ b/src/librustc_typeck/variance.rs