about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2014-11-25 14:21:20 -0500
committerNiko Matsakis <niko@alum.mit.edu>2014-12-04 10:04:26 -0500
commit7c44561ad6f4651047255d0c630a0c3f80c3fdd4 (patch)
treec737e2c7f366b607d2b99906b5655db912823e98
parent6d965cc2c99787a949d38abf225412fe502d3ed8 (diff)
downloadrust-7c44561ad6f4651047255d0c630a0c3f80c3fdd4.tar.gz
rust-7c44561ad6f4651047255d0c630a0c3f80c3fdd4.zip
Move various data structures out of typeck and into ty.
-rw-r--r--src/librustc/lint/builtin.rs12
-rw-r--r--src/librustc/metadata/csearch.rs3
-rw-r--r--src/librustc/metadata/decoder.rs3
-rw-r--r--src/librustc/middle/astencode.rs79
-rw-r--r--src/librustc/middle/cfg/construct.rs5
-rw-r--r--src/librustc/middle/check_const.rs3
-rw-r--r--src/librustc/middle/dead.rs12
-rw-r--r--src/librustc/middle/effect.rs2
-rw-r--r--src/librustc/middle/expr_use_visitor.rs9
-rw-r--r--src/librustc/middle/liveness.rs4
-rw-r--r--src/librustc/middle/mem_categorization.rs15
-rw-r--r--src/librustc/middle/privacy.rs4
-rw-r--r--src/librustc/middle/reachable.rs5
-rw-r--r--src/librustc/middle/ty.rs198
-rw-r--r--src/librustc/middle/ty_fold.rs41
-rw-r--r--src/librustc/middle/typeck/check/method/confirm.rs4
-rw-r--r--src/librustc/middle/typeck/check/method/mod.rs2
-rw-r--r--src/librustc/middle/typeck/check/method/probe.rs2
-rw-r--r--src/librustc/middle/typeck/check/mod.rs11
-rw-r--r--src/librustc/middle/typeck/check/regionck.rs3
-rw-r--r--src/librustc/middle/typeck/check/writeback.rs3
-rw-r--r--src/librustc/middle/typeck/mod.rs188
-rw-r--r--src/librustc/util/ppaux.rs18
-rw-r--r--src/librustc_trans/save/mod.rs10
-rw-r--r--src/librustc_trans/trans/callee.rs2
-rw-r--r--src/librustc_trans/trans/common.rs7
-rw-r--r--src/librustc_trans/trans/controlflow.rs2
-rw-r--r--src/librustc_trans/trans/expr.rs17
-rw-r--r--src/librustc_trans/trans/meth.rs11
29 files changed, 331 insertions, 344 deletions
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index 9a214d531d1..cb617b169a0 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -30,7 +30,7 @@ use metadata::csearch;
 use middle::def::*;
 use middle::ty::{mod, Ty};
 use middle::typeck::astconv::ast_ty_to_ty;
-use middle::typeck::{mod, infer};
+use middle::typeck::infer;
 use middle::{def, pat_util, stability};
 use middle::const_eval::{eval_const_expr_partial, const_int, const_uint};
 use util::ppaux::{ty_to_string};
@@ -1589,22 +1589,22 @@ impl LintPass for Stability {
             }
             ast::ExprMethodCall(i, _, _) => {
                 span = i.span;
-                let method_call = typeck::MethodCall::expr(e.id);
+                let method_call = ty::MethodCall::expr(e.id);
                 match cx.tcx.method_map.borrow().get(&method_call) {
                     Some(method) => {
                         match method.origin {
-                            typeck::MethodStatic(def_id) => {
+                            ty::MethodStatic(def_id) => {
                                 def_id
                             }
-                            typeck::MethodStaticUnboxedClosure(def_id) => {
+                            ty::MethodStaticUnboxedClosure(def_id) => {
                                 def_id
                             }
-                            typeck::MethodTypeParam(typeck::MethodParam {
+                            ty::MethodTypeParam(ty::MethodParam {
                                 ref trait_ref,
                                 method_num: index,
                                 ..
                             }) |
-                            typeck::MethodTraitObject(typeck::MethodObject {
+                            ty::MethodTraitObject(ty::MethodObject {
                                 ref trait_ref,
                                 method_num: index,
                                 ..
diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs
index 20e3f27f2ae..ebf5cca6a31 100644
--- a/src/librustc/metadata/csearch.rs
+++ b/src/librustc/metadata/csearch.rs
@@ -21,7 +21,6 @@ use middle::def;
 use middle::lang_items;
 use middle::resolve;
 use middle::ty;
-use middle::typeck;
 use middle::subst::VecPerParamSpace;
 
 use rbml;
@@ -268,7 +267,7 @@ pub fn get_impl_trait<'tcx>(tcx: &ty::ctxt<'tcx>,
 // Given a def_id for an impl, return information about its vtables
 pub fn get_impl_vtables<'tcx>(tcx: &ty::ctxt<'tcx>,
                               def: ast::DefId)
-                              -> typeck::vtable_res<'tcx> {
+                              -> ty::vtable_res<'tcx> {
     let cstore = &tcx.sess.cstore;
     let cdata = cstore.get_crate_data(def.krate);
     decoder::get_impl_vtables(&*cdata, def.node, tcx)
diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs
index ec812cea372..f352a28df69 100644
--- a/src/librustc/metadata/decoder.rs
+++ b/src/librustc/metadata/decoder.rs
@@ -30,7 +30,6 @@ use middle::resolve::{TraitItemKind, TypeTraitItemKind};
 use middle::subst;
 use middle::ty::{ImplContainer, TraitContainer};
 use middle::ty::{mod, Ty};
-use middle::typeck;
 use middle::astencode::vtable_decoder_helpers;
 
 use std::hash::Hash;
@@ -422,7 +421,7 @@ pub fn get_impl_trait<'tcx>(cdata: Cmd,
 pub fn get_impl_vtables<'tcx>(cdata: Cmd,
                               id: ast::NodeId,
                               tcx: &ty::ctxt<'tcx>)
-                              -> typeck::vtable_res<'tcx>
+                              -> ty::vtable_res<'tcx>
 {
     let item_doc = lookup_item(id, cdata.data());
     let vtables_doc = reader::get_doc(item_doc, tag_item_impl_vtables);
diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs
index 523e997a8de..113d127503f 100644
--- a/src/librustc/middle/astencode.rs
+++ b/src/librustc/middle/astencode.rs
@@ -26,8 +26,7 @@ use metadata::tyencode;
 use middle::mem_categorization::Typer;
 use middle::subst;
 use middle::subst::VecPerParamSpace;
-use middle::typeck::{mod, MethodCall, MethodCallee, MethodOrigin};
-use middle::ty::{mod, Ty};
+use middle::ty::{mod, Ty, MethodCall, MethodCallee, MethodOrigin};
 use util::ppaux::ty_to_string;
 
 use syntax::{ast, ast_map, ast_util, codemap, fold};
@@ -576,12 +575,12 @@ impl tr for ty::UpvarBorrow {
 
 trait read_method_callee_helper<'tcx> {
     fn read_method_callee<'a, 'b>(&mut self, dcx: &DecodeContext<'a, 'b, 'tcx>)
-        -> (typeck::ExprAdjustment, MethodCallee<'tcx>);
+        -> (ty::ExprAdjustment, MethodCallee<'tcx>);
 }
 
 fn encode_method_callee<'a, 'tcx>(ecx: &e::EncodeContext<'a, 'tcx>,
                                   rbml_w: &mut Encoder,
-                                  adjustment: typeck::ExprAdjustment,
+                                  adjustment: ty::ExprAdjustment,
                                   method: &MethodCallee<'tcx>) {
     use serialize::Encoder;
 
@@ -603,7 +602,7 @@ fn encode_method_callee<'a, 'tcx>(ecx: &e::EncodeContext<'a, 'tcx>,
 
 impl<'a, 'tcx> read_method_callee_helper<'tcx> for reader::Decoder<'a> {
     fn read_method_callee<'a, 'b>(&mut self, dcx: &DecodeContext<'a, 'b, 'tcx>)
-        -> (typeck::ExprAdjustment, MethodCallee<'tcx>) {
+        -> (ty::ExprAdjustment, MethodCallee<'tcx>) {
 
         self.read_struct("MethodCallee", 4, |this| {
             let adjustment = this.read_struct_field("adjustment", 0, |this| {
@@ -627,22 +626,22 @@ impl<'a, 'tcx> read_method_callee_helper<'tcx> for reader::Decoder<'a> {
 impl<'tcx> tr for MethodOrigin<'tcx> {
     fn tr(&self, dcx: &DecodeContext) -> MethodOrigin<'tcx> {
         match *self {
-            typeck::MethodStatic(did) => typeck::MethodStatic(did.tr(dcx)),
-            typeck::MethodStaticUnboxedClosure(did) => {
-                typeck::MethodStaticUnboxedClosure(did.tr(dcx))
+            ty::MethodStatic(did) => ty::MethodStatic(did.tr(dcx)),
+            ty::MethodStaticUnboxedClosure(did) => {
+                ty::MethodStaticUnboxedClosure(did.tr(dcx))
             }
-            typeck::MethodTypeParam(ref mp) => {
-                typeck::MethodTypeParam(
-                    typeck::MethodParam {
+            ty::MethodTypeParam(ref mp) => {
+                ty::MethodTypeParam(
+                    ty::MethodParam {
                         // def-id is already translated when we read it out
                         trait_ref: mp.trait_ref.clone(),
                         method_num: mp.method_num,
                     }
                 )
             }
-            typeck::MethodTraitObject(ref mo) => {
-                typeck::MethodTraitObject(
-                    typeck::MethodObject {
+            ty::MethodTraitObject(ref mo) => {
+                ty::MethodTraitObject(
+                    ty::MethodObject {
                         trait_ref: mo.trait_ref.clone(),
                         .. *mo
                     }
@@ -687,16 +686,16 @@ pub trait vtable_decoder_helpers<'tcx> {
     fn read_vtable_res_with_key(&mut self,
                                 tcx: &ty::ctxt<'tcx>,
                                 cdata: &cstore::crate_metadata)
-                                -> (typeck::ExprAdjustment, typeck::vtable_res<'tcx>);
+                                -> (ty::ExprAdjustment, ty::vtable_res<'tcx>);
     fn read_vtable_res(&mut self,
                        tcx: &ty::ctxt<'tcx>, cdata: &cstore::crate_metadata)
-                      -> typeck::vtable_res<'tcx>;
+                      -> ty::vtable_res<'tcx>;
     fn read_vtable_param_res(&mut self,
                        tcx: &ty::ctxt<'tcx>, cdata: &cstore::crate_metadata)
-                      -> typeck::vtable_param_res<'tcx>;
+                      -> ty::vtable_param_res<'tcx>;
     fn read_vtable_origin(&mut self,
                           tcx: &ty::ctxt<'tcx>, cdata: &cstore::crate_metadata)
-                          -> typeck::vtable_origin<'tcx>;
+                          -> ty::vtable_origin<'tcx>;
 }
 
 impl<'tcx, 'a> vtable_decoder_helpers<'tcx> for reader::Decoder<'a> {
@@ -714,7 +713,7 @@ impl<'tcx, 'a> vtable_decoder_helpers<'tcx> for reader::Decoder<'a> {
     fn read_vtable_res_with_key(&mut self,
                                 tcx: &ty::ctxt<'tcx>,
                                 cdata: &cstore::crate_metadata)
-                                -> (typeck::ExprAdjustment, typeck::vtable_res<'tcx>) {
+                                -> (ty::ExprAdjustment, ty::vtable_res<'tcx>) {
         self.read_struct("VtableWithKey", 2, |this| {
             let adjustment = this.read_struct_field("adjustment", 0, |this| {
                 Decodable::decode(this)
@@ -728,7 +727,7 @@ impl<'tcx, 'a> vtable_decoder_helpers<'tcx> for reader::Decoder<'a> {
     fn read_vtable_res(&mut self,
                        tcx: &ty::ctxt<'tcx>,
                        cdata: &cstore::crate_metadata)
-                       -> typeck::vtable_res<'tcx>
+                       -> ty::vtable_res<'tcx>
     {
         self.read_vec_per_param_space(
             |this| this.read_vtable_param_res(tcx, cdata))
@@ -736,14 +735,14 @@ impl<'tcx, 'a> vtable_decoder_helpers<'tcx> for reader::Decoder<'a> {
 
     fn read_vtable_param_res(&mut self,
                              tcx: &ty::ctxt<'tcx>, cdata: &cstore::crate_metadata)
-                      -> typeck::vtable_param_res<'tcx> {
+                      -> ty::vtable_param_res<'tcx> {
         self.read_to_vec(|this| Ok(this.read_vtable_origin(tcx, cdata)))
              .unwrap().into_iter().collect()
     }
 
     fn read_vtable_origin(&mut self,
                           tcx: &ty::ctxt<'tcx>, cdata: &cstore::crate_metadata)
-        -> typeck::vtable_origin<'tcx> {
+        -> ty::vtable_origin<'tcx> {
         self.read_enum("vtable_origin", |this| {
             this.read_enum_variant(&["vtable_static",
                                      "vtable_param",
@@ -752,7 +751,7 @@ impl<'tcx, 'a> vtable_decoder_helpers<'tcx> for reader::Decoder<'a> {
                                    |this, i| {
                 Ok(match i {
                   0 => {
-                    typeck::vtable_static(
+                    ty::vtable_static(
                         this.read_enum_variant_arg(0u, |this| {
                             Ok(this.read_def_id_nodcx(cdata))
                         }).unwrap(),
@@ -765,7 +764,7 @@ impl<'tcx, 'a> vtable_decoder_helpers<'tcx> for reader::Decoder<'a> {
                     )
                   }
                   1 => {
-                    typeck::vtable_param(
+                    ty::vtable_param(
                         this.read_enum_variant_arg(0u, |this| {
                             Decodable::decode(this)
                         }).unwrap(),
@@ -775,14 +774,14 @@ impl<'tcx, 'a> vtable_decoder_helpers<'tcx> for reader::Decoder<'a> {
                     )
                   }
                   2 => {
-                    typeck::vtable_unboxed_closure(
+                    ty::vtable_unboxed_closure(
                         this.read_enum_variant_arg(0u, |this| {
                             Ok(this.read_def_id_nodcx(cdata))
                         }).unwrap()
                     )
                   }
                   3 => {
-                    typeck::vtable_error
+                    ty::vtable_error
                   }
                   _ => panic!("bad enum variant")
                 })
@@ -826,7 +825,7 @@ trait rbml_writer_helpers<'tcx> {
                              closure_type: &ty::ClosureTy<'tcx>);
     fn emit_method_origin<'a>(&mut self,
                               ecx: &e::EncodeContext<'a, 'tcx>,
-                              method_origin: &typeck::MethodOrigin<'tcx>);
+                              method_origin: &ty::MethodOrigin<'tcx>);
     fn emit_ty<'a>(&mut self, ecx: &e::EncodeContext<'a, 'tcx>, ty: Ty<'tcx>);
     fn emit_tys<'a>(&mut self, ecx: &e::EncodeContext<'a, 'tcx>, tys: &[Ty<'tcx>]);
     fn emit_type_param_def<'a>(&mut self, ecx: &e::EncodeContext<'a, 'tcx>,
@@ -860,25 +859,25 @@ impl<'a, 'tcx> rbml_writer_helpers<'tcx> for Encoder<'a> {
 
     fn emit_method_origin<'a>(&mut self,
                               ecx: &e::EncodeContext<'a, 'tcx>,
-                              method_origin: &typeck::MethodOrigin<'tcx>)
+                              method_origin: &ty::MethodOrigin<'tcx>)
     {
         use serialize::Encoder;
 
         self.emit_enum("MethodOrigin", |this| {
             match *method_origin {
-                typeck::MethodStatic(def_id) => {
+                ty::MethodStatic(def_id) => {
                     this.emit_enum_variant("MethodStatic", 0, 1, |this| {
                         Ok(this.emit_def_id(def_id))
                     })
                 }
 
-                typeck::MethodStaticUnboxedClosure(def_id) => {
+                ty::MethodStaticUnboxedClosure(def_id) => {
                     this.emit_enum_variant("MethodStaticUnboxedClosure", 1, 1, |this| {
                         Ok(this.emit_def_id(def_id))
                     })
                 }
 
-                typeck::MethodTypeParam(ref p) => {
+                ty::MethodTypeParam(ref p) => {
                     this.emit_enum_variant("MethodTypeParam", 2, 1, |this| {
                         this.emit_struct("MethodParam", 2, |this| {
                             try!(this.emit_struct_field("trait_ref", 0, |this| {
@@ -892,7 +891,7 @@ impl<'a, 'tcx> rbml_writer_helpers<'tcx> for Encoder<'a> {
                     })
                 }
 
-                typeck::MethodTraitObject(ref o) => {
+                ty::MethodTraitObject(ref o) => {
                     this.emit_enum_variant("MethodTraitObject", 3, 1, |this| {
                         this.emit_struct("MethodObject", 2, |this| {
                             try!(this.emit_struct_field("trait_ref", 0, |this| {
@@ -1330,7 +1329,7 @@ impl<'a> doc_decoder_helpers for rbml::Doc<'a> {
 
 trait rbml_decoder_decoder_helpers<'tcx> {
     fn read_method_origin<'a, 'b>(&mut self, dcx: &DecodeContext<'a, 'b, 'tcx>)
-                                  -> typeck::MethodOrigin<'tcx>;
+                                  -> ty::MethodOrigin<'tcx>;
     fn read_ty<'a, 'b>(&mut self, dcx: &DecodeContext<'a, 'b, 'tcx>) -> Ty<'tcx>;
     fn read_tys<'a, 'b>(&mut self, dcx: &DecodeContext<'a, 'b, 'tcx>) -> Vec<Ty<'tcx>>;
     fn read_trait_ref<'a, 'b>(&mut self, dcx: &DecodeContext<'a, 'b, 'tcx>)
@@ -1409,7 +1408,7 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
     }
 
     fn read_method_origin<'a, 'b>(&mut self, dcx: &DecodeContext<'a, 'b, 'tcx>)
-                                  -> typeck::MethodOrigin<'tcx>
+                                  -> ty::MethodOrigin<'tcx>
     {
         self.read_enum("MethodOrigin", |this| {
             let variants = &["MethodStatic", "MethodStaticUnboxedClosure",
@@ -1418,18 +1417,18 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
                 Ok(match i {
                     0 => {
                         let def_id = this.read_def_id(dcx);
-                        typeck::MethodStatic(def_id)
+                        ty::MethodStatic(def_id)
                     }
 
                     1 => {
                         let def_id = this.read_def_id(dcx);
-                        typeck::MethodStaticUnboxedClosure(def_id)
+                        ty::MethodStaticUnboxedClosure(def_id)
                     }
 
                     2 => {
                         this.read_struct("MethodTypeParam", 2, |this| {
-                            Ok(typeck::MethodTypeParam(
-                                typeck::MethodParam {
+                            Ok(ty::MethodTypeParam(
+                                ty::MethodParam {
                                     trait_ref: {
                                         this.read_struct_field("trait_ref", 0, |this| {
                                             Ok(this.read_trait_ref(dcx))
@@ -1446,8 +1445,8 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
 
                     3 => {
                         this.read_struct("MethodTraitObject", 2, |this| {
-                            Ok(typeck::MethodTraitObject(
-                                typeck::MethodObject {
+                            Ok(ty::MethodTraitObject(
+                                ty::MethodObject {
                                     trait_ref: {
                                         this.read_struct_field("trait_ref", 0, |this| {
                                             Ok(this.read_trait_ref(dcx))
diff --git a/src/librustc/middle/cfg/construct.rs b/src/librustc/middle/cfg/construct.rs
index b42fb8ccc41..90919609e2e 100644
--- a/src/librustc/middle/cfg/construct.rs
+++ b/src/librustc/middle/cfg/construct.rs
@@ -12,7 +12,6 @@ use middle::cfg::*;
 use middle::def;
 use middle::graph;
 use middle::region::CodeExtent;
-use middle::typeck;
 use middle::ty;
 use syntax::ast;
 use syntax::ast_util;
@@ -510,7 +509,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
             pred: CFGIndex,
             func_or_rcvr: &ast::Expr,
             args: I) -> CFGIndex {
-        let method_call = typeck::MethodCall::expr(call_expr.id);
+        let method_call = ty::MethodCall::expr(call_expr.id);
         let return_ty = ty::ty_fn_ret(match self.tcx.method_map.borrow().get(&method_call) {
             Some(method) => method.ty,
             None => ty::expr_ty(self.tcx, func_or_rcvr)
@@ -635,7 +634,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
     }
 
     fn is_method_call(&self, expr: &ast::Expr) -> bool {
-        let method_call = typeck::MethodCall::expr(expr.id);
+        let method_call = ty::MethodCall::expr(expr.id);
         self.tcx.method_map.borrow().contains_key(&method_call)
     }
 }
diff --git a/src/librustc/middle/check_const.rs b/src/librustc/middle/check_const.rs
index 8cb63fcd827..de140fd5c30 100644
--- a/src/librustc/middle/check_const.rs
+++ b/src/librustc/middle/check_const.rs
@@ -11,7 +11,6 @@
 
 use middle::def::*;
 use middle::ty;
-use middle::typeck;
 use util::ppaux;
 
 use syntax::ast;
@@ -111,7 +110,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &ast::Expr) -> bool {
         }
         ast::ExprLit(ref lit) if ast_util::lit_is_str(&**lit) => {}
         ast::ExprBinary(..) | ast::ExprUnary(..) => {
-            let method_call = typeck::MethodCall::expr(e.id);
+            let method_call = ty::MethodCall::expr(e.id);
             if v.tcx.method_map.borrow().contains_key(&method_call) {
                 span_err!(v.tcx.sess, e.span, E0011,
                           "user-defined operators are not allowed in constant \
diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs
index cf2e9a65859..03fe8782421 100644
--- a/src/librustc/middle/dead.rs
+++ b/src/librustc/middle/dead.rs
@@ -12,7 +12,7 @@
 // closely. The idea is that all reachable symbols are live, codes called
 // from live codes are live, and everything else is dead.
 
-use middle::{def, pat_util, privacy, ty, typeck};
+use middle::{def, pat_util, privacy, ty};
 use lint;
 use util::nodemap::NodeSet;
 
@@ -90,23 +90,23 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
 
     fn lookup_and_handle_method(&mut self, id: ast::NodeId,
                                 span: codemap::Span) {
-        let method_call = typeck::MethodCall::expr(id);
+        let method_call = ty::MethodCall::expr(id);
         match self.tcx.method_map.borrow().get(&method_call) {
             Some(method) => {
                 match method.origin {
-                    typeck::MethodStatic(def_id) => {
+                    ty::MethodStatic(def_id) => {
                         match ty::provided_source(self.tcx, def_id) {
                             Some(p_did) => self.check_def_id(p_did),
                             None => self.check_def_id(def_id)
                         }
                     }
-                    typeck::MethodStaticUnboxedClosure(_) => {}
-                    typeck::MethodTypeParam(typeck::MethodParam {
+                    ty::MethodStaticUnboxedClosure(_) => {}
+                    ty::MethodTypeParam(ty::MethodParam {
                         ref trait_ref,
                         method_num: index,
                         ..
                     }) |
-                    typeck::MethodTraitObject(typeck::MethodObject {
+                    ty::MethodTraitObject(ty::MethodObject {
                         ref trait_ref,
                         method_num: index,
                         ..
diff --git a/src/librustc/middle/effect.rs b/src/librustc/middle/effect.rs
index e67df0332dc..dbec69f4205 100644
--- a/src/librustc/middle/effect.rs
+++ b/src/librustc/middle/effect.rs
@@ -14,7 +14,7 @@ use self::UnsafeContext::*;
 
 use middle::def;
 use middle::ty::{mod, Ty};
-use middle::typeck::MethodCall;
+use middle::ty::MethodCall;
 use util::ppaux;
 
 use syntax::ast;
diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs
index cbf36aeff51..7d2bb7458ac 100644
--- a/src/librustc/middle/expr_use_visitor.rs
+++ b/src/librustc/middle/expr_use_visitor.rs
@@ -24,10 +24,9 @@ use middle::{def, region, pat_util};
 use middle::mem_categorization as mc;
 use middle::mem_categorization::Typer;
 use middle::ty::{mod, Ty};
-use middle::typeck::{MethodCall, MethodObject, MethodTraitObject};
-use middle::typeck::{MethodOrigin, MethodParam, MethodTypeParam};
-use middle::typeck::{MethodStatic, MethodStaticUnboxedClosure};
-use middle::typeck;
+use middle::ty::{MethodCall, MethodObject, MethodTraitObject};
+use middle::ty::{MethodOrigin, MethodParam, MethodTypeParam};
+use middle::ty::{MethodStatic, MethodStaticUnboxedClosure};
 use util::ppaux::Repr;
 
 use syntax::ast;
@@ -825,7 +824,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
         debug!("walk_autoderefs expr={} autoderefs={}", expr.repr(self.tcx()), autoderefs);
 
         for i in range(0, autoderefs) {
-            let deref_id = typeck::MethodCall::autoderef(expr.id, i);
+            let deref_id = ty::MethodCall::autoderef(expr.id, i);
             match self.typer.node_method_ty(deref_id) {
                 None => {}
                 Some(method_ty) => {
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index fcc23d8ac55..523c9f33309 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -111,7 +111,7 @@ use self::VarKind::*;
 
 use middle::def::*;
 use middle::mem_categorization::Typer;
-use middle::{pat_util, typeck, ty};
+use middle::{pat_util, ty};
 use lint;
 use util::nodemap::NodeMap;
 
@@ -1156,7 +1156,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
           }
 
           ast::ExprMethodCall(_, _, ref args) => {
-            let method_call = typeck::MethodCall::expr(expr.id);
+            let method_call = ty::MethodCall::expr(expr.id);
             let method_ty = self.ir.tcx.method_map.borrow().get(&method_call).unwrap().ty;
             let diverges = ty::ty_fn_ret(method_ty) == ty::FnDiverging;
             let succ = if diverges {
diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs
index ce166fc5de6..cd70d8e2b48 100644
--- a/src/librustc/middle/mem_categorization.rs
+++ b/src/librustc/middle/mem_categorization.rs
@@ -74,7 +74,6 @@ pub use self::categorization::*;
 use middle::def;
 use middle::region;
 use middle::ty::{mod, Ty};
-use middle::typeck;
 use util::nodemap::{DefIdMap, NodeMap};
 use util::ppaux::{ty_to_string, Repr};
 
@@ -283,7 +282,7 @@ pub type McResult<T> = Result<T, ()>;
 pub trait Typer<'tcx> {
     fn tcx<'a>(&'a self) -> &'a ty::ctxt<'tcx>;
     fn node_ty(&self, id: ast::NodeId) -> McResult<Ty<'tcx>>;
-    fn node_method_ty(&self, method_call: typeck::MethodCall) -> Option<Ty<'tcx>>;
+    fn node_method_ty(&self, method_call: ty::MethodCall) -> Option<Ty<'tcx>>;
     fn adjustments<'a>(&'a self) -> &'a RefCell<NodeMap<ty::AutoAdjustment<'tcx>>>;
     fn is_method_call(&self, id: ast::NodeId) -> bool;
     fn temporary_scope(&self, rvalue_id: ast::NodeId) -> Option<region::CodeExtent>;
@@ -509,7 +508,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
           }
 
           ast::ExprIndex(ref base, _) => {
-            let method_call = typeck::MethodCall::expr(expr.id());
+            let method_call = ty::MethodCall::expr(expr.id());
             match self.typer.node_method_ty(method_call) {
                 Some(method_ty) => {
                     // If this is an index implemented by a method call, then it will
@@ -890,12 +889,12 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
                              implicit: bool)
                              -> cmt<'tcx> {
         let adjustment = match self.typer.adjustments().borrow().get(&node.id()) {
-            Some(adj) if ty::adjust_is_object(adj) => typeck::AutoObject,
-            _ if deref_cnt != 0 => typeck::AutoDeref(deref_cnt),
-            _ => typeck::NoAdjustment
+            Some(adj) if ty::adjust_is_object(adj) => ty::AutoObject,
+            _ if deref_cnt != 0 => ty::AutoDeref(deref_cnt),
+            _ => ty::NoAdjustment
         };
 
-        let method_call = typeck::MethodCall {
+        let method_call = ty::MethodCall {
             expr_id: node.id(),
             adjustment: adjustment
         };
@@ -980,7 +979,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
         //! - `elt`: the AST node being indexed
         //! - `base_cmt`: the cmt of `elt`
 
-        let method_call = typeck::MethodCall::expr(elt.id());
+        let method_call = ty::MethodCall::expr(elt.id());
         let method_ty = self.typer.node_method_ty(method_call);
 
         let element_ty = match method_ty {
diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs
index 5e182ba8337..5770b601a69 100644
--- a/src/librustc/middle/privacy.rs
+++ b/src/librustc/middle/privacy.rs
@@ -19,8 +19,8 @@ use std::mem::replace;
 use metadata::csearch;
 use middle::{def, resolve};
 use middle::ty::{mod, Ty};
-use middle::typeck::{MethodCall, MethodMap, MethodOrigin, MethodParam, MethodTypeParam};
-use middle::typeck::{MethodStatic, MethodStaticUnboxedClosure, MethodObject, MethodTraitObject};
+use middle::ty::{MethodCall, MethodMap, MethodOrigin, MethodParam, MethodTypeParam};
+use middle::ty::{MethodStatic, MethodStaticUnboxedClosure, MethodObject, MethodTraitObject};
 use util::nodemap::{NodeMap, NodeSet};
 
 use syntax::{ast, ast_map};
diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs
index 96e1aacb0ce..fa02c940aa7 100644
--- a/src/librustc/middle/reachable.rs
+++ b/src/librustc/middle/reachable.rs
@@ -17,7 +17,6 @@
 
 use middle::def;
 use middle::ty;
-use middle::typeck;
 use middle::privacy;
 use session::config;
 use util::nodemap::NodeSet;
@@ -137,9 +136,9 @@ impl<'a, 'tcx, 'v> Visitor<'v> for ReachableContext<'a, 'tcx> {
                 }
             }
             ast::ExprMethodCall(..) => {
-                let method_call = typeck::MethodCall::expr(expr.id);
+                let method_call = ty::MethodCall::expr(expr.id);
                 match (*self.tcx.method_map.borrow())[method_call].origin {
-                    typeck::MethodStatic(def_id) => {
+                    ty::MethodStatic(def_id) => {
                         if is_local(def_id) {
                             if self.def_id_represents_local_inlined_item(def_id) {
                                 self.worklist.push(def_id.node)
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 35aed356303..fe8121375ad 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -35,6 +35,9 @@ pub use self::ImplOrTraitItem::*;
 pub use self::BoundRegion::*;
 pub use self::sty::*;
 pub use self::IntVarValue::*;
+pub use self::ExprAdjustment::*;
+pub use self::vtable_origin::*;
+pub use self::MethodOrigin::*;
 
 use back::svh::Svh;
 use session::Session;
@@ -53,7 +56,6 @@ use middle::stability;
 use middle::subst::{mod, Subst, Substs, VecPerParamSpace};
 use middle::traits;
 use middle::ty;
-use middle::typeck;
 use middle::ty_fold::{mod, TypeFoldable, TypeFolder, HigherRankedFoldable};
 use middle;
 use util::ppaux::{note_and_explain_region, bound_region_ptr_to_string};
@@ -412,7 +414,161 @@ pub fn type_of_adjust<'tcx>(cx: &ctxt<'tcx>, adj: &AutoAdjustment<'tcx>) -> Opti
     }
 }
 
+#[deriving(Clone, Encodable, Decodable, PartialEq, PartialOrd, Show)]
+pub struct param_index {
+    pub space: subst::ParamSpace,
+    pub index: uint
+}
+
+#[deriving(Clone, Show)]
+pub enum MethodOrigin<'tcx> {
+    // fully statically resolved method
+    MethodStatic(ast::DefId),
+
+    // fully statically resolved unboxed closure invocation
+    MethodStaticUnboxedClosure(ast::DefId),
+
+    // method invoked on a type parameter with a bounded trait
+    MethodTypeParam(MethodParam<'tcx>),
+
+    // method invoked on a trait instance
+    MethodTraitObject(MethodObject<'tcx>),
+
+}
+
+// details for a method invoked with a receiver whose type is a type parameter
+// with a bounded trait.
+#[deriving(Clone, Show)]
+pub struct MethodParam<'tcx> {
+    // the precise trait reference that occurs as a bound -- this may
+    // be a supertrait of what the user actually typed.
+    pub trait_ref: Rc<ty::TraitRef<'tcx>>,
+
+    // index of uint in the list of methods for the trait
+    pub method_num: uint,
+}
+
+// details for a method invoked with a receiver whose type is an object
+#[deriving(Clone, Show)]
+pub struct MethodObject<'tcx> {
+    // the (super)trait containing the method to be invoked
+    pub trait_ref: Rc<ty::TraitRef<'tcx>>,
+
+    // the actual base trait id of the object
+    pub object_trait_id: ast::DefId,
+
+    // index of the method to be invoked amongst the trait's methods
+    pub method_num: uint,
+
+    // index into the actual runtime vtable.
+    // the vtable is formed by concatenating together the method lists of
+    // the base object trait and all supertraits;  this is the index into
+    // that vtable
+    pub real_index: uint,
+}
+
+#[deriving(Clone)]
+pub struct MethodCallee<'tcx> {
+    pub origin: MethodOrigin<'tcx>,
+    pub ty: Ty<'tcx>,
+    pub substs: subst::Substs<'tcx>
+}
+
+/// With method calls, we store some extra information in
+/// side tables (i.e method_map). We use
+/// MethodCall as a key to index into these tables instead of
+/// just directly using the expression's NodeId. The reason
+/// for this being that we may apply adjustments (coercions)
+/// with the resulting expression also needing to use the
+/// side tables. The problem with this is that we don't
+/// assign a separate NodeId to this new expression
+/// and so it would clash with the base expression if both
+/// needed to add to the side tables. Thus to disambiguate
+/// we also keep track of whether there's an adjustment in
+/// our key.
+#[deriving(Clone, PartialEq, Eq, Hash, Show)]
+pub struct MethodCall {
+    pub expr_id: ast::NodeId,
+    pub adjustment: ExprAdjustment
+}
+
+#[deriving(Clone, PartialEq, Eq, Hash, Show, Encodable, Decodable)]
+pub enum ExprAdjustment {
+    NoAdjustment,
+    AutoDeref(uint),
+    AutoObject
+}
+
+impl MethodCall {
+    pub fn expr(id: ast::NodeId) -> MethodCall {
+        MethodCall {
+            expr_id: id,
+            adjustment: NoAdjustment
+        }
+    }
+
+    pub fn autoobject(id: ast::NodeId) -> MethodCall {
+        MethodCall {
+            expr_id: id,
+            adjustment: AutoObject
+        }
+    }
+
+    pub fn autoderef(expr_id: ast::NodeId, autoderef: uint) -> MethodCall {
+        MethodCall {
+            expr_id: expr_id,
+            adjustment: AutoDeref(1 + autoderef)
+        }
+    }
+}
+
+// maps from an expression id that corresponds to a method call to the details
+// of the method to be invoked
+pub type MethodMap<'tcx> = RefCell<FnvHashMap<MethodCall, MethodCallee<'tcx>>>;
+
+pub type vtable_param_res<'tcx> = Vec<vtable_origin<'tcx>>;
 
+// Resolutions for bounds of all parameters, left to right, for a given path.
+pub type vtable_res<'tcx> = VecPerParamSpace<vtable_param_res<'tcx>>;
+
+#[deriving(Clone)]
+pub enum vtable_origin<'tcx> {
+    /*
+      Statically known vtable. def_id gives the impl item
+      from whence comes the vtable, and tys are the type substs.
+      vtable_res is the vtable itself.
+     */
+    vtable_static(ast::DefId, subst::Substs<'tcx>, vtable_res<'tcx>),
+
+    /*
+      Dynamic vtable, comes from a parameter that has a bound on it:
+      fn foo<T:quux,baz,bar>(a: T) -- a's vtable would have a
+      vtable_param origin
+
+      The first argument is the param index (identifying T in the example),
+      and the second is the bound number (identifying baz)
+     */
+    vtable_param(param_index, uint),
+
+    /*
+      Vtable automatically generated for an unboxed closure. The def ID is the
+      ID of the closure expression.
+     */
+    vtable_unboxed_closure(ast::DefId),
+
+    /*
+      Asked to determine the vtable for ty_err. This is the value used
+      for the vtables of `Self` in a virtual call like `foo.bar()`
+      where `foo` is of object type. The same value is also used when
+      type errors occur.
+     */
+    vtable_error,
+}
+
+
+// For every explicit cast into an object type, maps from the cast
+// expr to the associated trait ref.
+pub type ObjectCastMap<'tcx> = RefCell<NodeMap<Rc<ty::TraitRef<'tcx>>>>;
 
 /// A restriction that certain types must be the same size. The use of
 /// `transmute` gives rise to these restrictions.
@@ -473,7 +629,7 @@ pub struct ctxt<'tcx> {
 
     /// Maps from node-id of a trait object cast (like `foo as
     /// Box<Trait>`) to the trait reference.
-    pub object_cast_map: typeck::ObjectCastMap<'tcx>,
+    pub object_cast_map: ObjectCastMap<'tcx>,
 
     pub map: ast_map::Map<'tcx>,
     pub intrinsic_defs: RefCell<DefIdMap<Ty<'tcx>>>,
@@ -548,7 +704,7 @@ pub struct ctxt<'tcx> {
     pub extern_const_statics: RefCell<DefIdMap<ast::NodeId>>,
     pub extern_const_variants: RefCell<DefIdMap<ast::NodeId>>,
 
-    pub method_map: typeck::MethodMap<'tcx>,
+    pub method_map: MethodMap<'tcx>,
 
     pub dependency_formats: RefCell<dependency_format::Dependencies>,
 
@@ -3658,7 +3814,7 @@ pub fn adjust_ty<'tcx>(cx: &ctxt<'tcx>,
                        expr_id: ast::NodeId,
                        unadjusted_ty: Ty<'tcx>,
                        adjustment: Option<&AutoAdjustment<'tcx>>,
-                       method_type: |typeck::MethodCall| -> Option<Ty<'tcx>>)
+                       method_type: |MethodCall| -> Option<Ty<'tcx>>)
                        -> Ty<'tcx> {
 
     if let ty_err = unadjusted_ty.sty {
@@ -3699,7 +3855,7 @@ pub fn adjust_ty<'tcx>(cx: &ctxt<'tcx>,
 
                     if !ty::type_is_error(adjusted_ty) {
                         for i in range(0, adj.autoderefs) {
-                            let method_call = typeck::MethodCall::autoderef(expr_id, i);
+                            let method_call = MethodCall::autoderef(expr_id, i);
                             match method_type(method_call) {
                                 Some(method_ty) => {
                                     if let ty::FnConverging(result_type) = ty_fn_ret(method_ty) {
@@ -3830,7 +3986,7 @@ pub enum ExprKind {
 }
 
 pub fn expr_kind(tcx: &ctxt, expr: &ast::Expr) -> ExprKind {
-    if tcx.method_map.borrow().contains_key(&typeck::MethodCall::expr(expr.id)) {
+    if tcx.method_map.borrow().contains_key(&MethodCall::expr(expr.id)) {
         // Overloaded operations are generally calls, and hence they are
         // generated via DPS, but there are a few exceptions:
         return match expr.node {
@@ -5747,7 +5903,7 @@ impl<'tcx> mc::Typer<'tcx> for ty::ctxt<'tcx> {
         Ok(ty::node_id_to_type(self, id))
     }
 
-    fn node_method_ty(&self, method_call: typeck::MethodCall) -> Option<Ty<'tcx>> {
+    fn node_method_ty(&self, method_call: MethodCall) -> Option<Ty<'tcx>> {
         self.method_map.borrow().get(&method_call).map(|method| method.ty)
     }
 
@@ -5756,7 +5912,7 @@ impl<'tcx> mc::Typer<'tcx> for ty::ctxt<'tcx> {
     }
 
     fn is_method_call(&self, id: ast::NodeId) -> bool {
-        self.method_map.borrow().contains_key(&typeck::MethodCall::expr(id))
+        self.method_map.borrow().contains_key(&MethodCall::expr(id))
     }
 
     fn temporary_scope(&self, rvalue_id: ast::NodeId) -> Option<region::CodeExtent> {
@@ -6010,3 +6166,29 @@ impl<'tcx> Repr<'tcx> for TyTrait<'tcx> {
                 self.bounds.repr(tcx))
     }
 }
+
+impl<'tcx> Repr<'tcx> for vtable_origin<'tcx> {
+    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
+        match *self {
+            vtable_static(def_id, ref tys, ref vtable_res) => {
+                format!("vtable_static({}:{}, {}, {})",
+                        def_id,
+                        ty::item_path_str(tcx, def_id),
+                        tys.repr(tcx),
+                        vtable_res.repr(tcx))
+            }
+
+            vtable_param(x, y) => {
+                format!("vtable_param({}, {})", x, y)
+            }
+
+            vtable_unboxed_closure(def_id) => {
+                format!("vtable_unboxed_closure({})", def_id)
+            }
+
+            vtable_error => {
+                format!("vtable_error")
+            }
+        }
+    }
+}
diff --git a/src/librustc/middle/ty_fold.rs b/src/librustc/middle/ty_fold.rs
index de9eb426498..77092025349 100644
--- a/src/librustc/middle/ty_fold.rs
+++ b/src/librustc/middle/ty_fold.rs
@@ -38,7 +38,6 @@ use middle::subst;
 use middle::subst::VecPerParamSpace;
 use middle::ty::{mod, Ty};
 use middle::traits;
-use middle::typeck;
 use std::rc::Rc;
 use syntax::owned_slice::OwnedSlice;
 use util::ppaux::Repr;
@@ -304,23 +303,23 @@ impl<'tcx> TypeFoldable<'tcx> for ty::AutoRef<'tcx> {
     }
 }
 
-impl<'tcx> TypeFoldable<'tcx> for typeck::MethodOrigin<'tcx> {
-    fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> typeck::MethodOrigin<'tcx> {
+impl<'tcx> TypeFoldable<'tcx> for ty::MethodOrigin<'tcx> {
+    fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> ty::MethodOrigin<'tcx> {
         match *self {
-            typeck::MethodStatic(def_id) => {
-                typeck::MethodStatic(def_id)
+            ty::MethodStatic(def_id) => {
+                ty::MethodStatic(def_id)
             }
-            typeck::MethodStaticUnboxedClosure(def_id) => {
-                typeck::MethodStaticUnboxedClosure(def_id)
+            ty::MethodStaticUnboxedClosure(def_id) => {
+                ty::MethodStaticUnboxedClosure(def_id)
             }
-            typeck::MethodTypeParam(ref param) => {
-                typeck::MethodTypeParam(typeck::MethodParam {
+            ty::MethodTypeParam(ref param) => {
+                ty::MethodTypeParam(ty::MethodParam {
                     trait_ref: param.trait_ref.fold_with(folder),
                     method_num: param.method_num
                 })
             }
-            typeck::MethodTraitObject(ref object) => {
-                typeck::MethodTraitObject(typeck::MethodObject {
+            ty::MethodTraitObject(ref object) => {
+                ty::MethodTraitObject(ty::MethodObject {
                     trait_ref: object.trait_ref.fold_with(folder),
                     object_trait_id: object.object_trait_id,
                     method_num: object.method_num,
@@ -331,22 +330,22 @@ impl<'tcx> TypeFoldable<'tcx> for typeck::MethodOrigin<'tcx> {
     }
 }
 
-impl<'tcx> TypeFoldable<'tcx> for typeck::vtable_origin<'tcx> {
-    fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> typeck::vtable_origin<'tcx> {
+impl<'tcx> TypeFoldable<'tcx> for ty::vtable_origin<'tcx> {
+    fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> ty::vtable_origin<'tcx> {
         match *self {
-            typeck::vtable_static(def_id, ref substs, ref origins) => {
+            ty::vtable_static(def_id, ref substs, ref origins) => {
                 let r_substs = substs.fold_with(folder);
                 let r_origins = origins.fold_with(folder);
-                typeck::vtable_static(def_id, r_substs, r_origins)
+                ty::vtable_static(def_id, r_substs, r_origins)
             }
-            typeck::vtable_param(n, b) => {
-                typeck::vtable_param(n, b)
+            ty::vtable_param(n, b) => {
+                ty::vtable_param(n, b)
             }
-            typeck::vtable_unboxed_closure(def_id) => {
-                typeck::vtable_unboxed_closure(def_id)
+            ty::vtable_unboxed_closure(def_id) => {
+                ty::vtable_unboxed_closure(def_id)
             }
-            typeck::vtable_error => {
-                typeck::vtable_error
+            ty::vtable_error => {
+                ty::vtable_error
             }
         }
     }
diff --git a/src/librustc/middle/typeck/check/method/confirm.rs b/src/librustc/middle/typeck/check/method/confirm.rs
index e866627be3d..4e541f120ab 100644
--- a/src/librustc/middle/typeck/check/method/confirm.rs
+++ b/src/librustc/middle/typeck/check/method/confirm.rs
@@ -13,9 +13,9 @@ use super::probe;
 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 middle::typeck::check::{mod, FnCtxt, NoPreference, PreferMutLvalue};
-use middle::typeck::{MethodCall, MethodCallee, MethodObject, MethodOrigin,
-                     MethodParam, MethodStatic, MethodTraitObject, MethodTypeParam};
 use middle::typeck::infer::{mod, InferCtxt};
 use middle::ty_fold::HigherRankedFoldable;
 use syntax::ast;
diff --git a/src/librustc/middle/typeck/check/method/mod.rs b/src/librustc/middle/typeck/check/method/mod.rs
index 34c3292f8cd..001f5be69a1 100644
--- a/src/librustc/middle/typeck/check/method/mod.rs
+++ b/src/librustc/middle/typeck/check/method/mod.rs
@@ -21,8 +21,6 @@ use middle::typeck::check::{impl_self_ty};
 use middle::typeck::check::vtable;
 use middle::typeck::check::vtable::select_new_fcx_obligations;
 use middle::typeck::infer;
-use middle::typeck::{MethodCallee};
-use middle::typeck::{MethodParam, MethodTypeParam};
 use util::ppaux::{Repr, UserString};
 
 use std::rc::Rc;
diff --git a/src/librustc/middle/typeck/check/method/probe.rs b/src/librustc/middle/typeck/check/method/probe.rs
index 484d72130e6..689071b77e4 100644
--- a/src/librustc/middle/typeck/check/method/probe.rs
+++ b/src/librustc/middle/typeck/check/method/probe.rs
@@ -17,10 +17,10 @@ use middle::subst;
 use middle::subst::Subst;
 use middle::traits;
 use middle::ty::{mod, Ty};
+use middle::ty::{MethodObject};
 use middle::ty_fold::HigherRankedFoldable;
 use middle::typeck::check;
 use middle::typeck::check::{FnCtxt, NoPreference};
-use middle::typeck::{MethodObject};
 use middle::typeck::infer;
 use middle::typeck::infer::InferCtxt;
 use syntax::ast;
diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs
index 641cbd11d64..0033613d9c6 100644
--- a/src/librustc/middle/typeck/check/mod.rs
+++ b/src/librustc/middle/typeck/check/mod.rs
@@ -93,12 +93,13 @@ use middle::ty::{FnSig, VariantInfo, Polytype};
 use middle::ty::{Disr, ParamTy, ParameterEnvironment};
 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 middle::typeck::astconv::{mod, ast_region_to_region, ast_ty_to_ty, AstConv};
 use middle::typeck::check::_match::pat_ctxt;
 use middle::typeck::rscope::RegionScope;
-use middle::typeck::{mod, CrateCtxt, infer, lookup_def_ccx, no_params, require_same_types};
-use middle::typeck::{MethodCall, MethodCallee, MethodMap, ObjectCastMap, TypeAndSubsts};
+use middle::typeck::{CrateCtxt, infer, lookup_def_ccx, no_params, require_same_types};
+use middle::typeck::TypeAndSubsts;
 use middle::lang_items::TypeIdLangItem;
 use lint;
 use util::common::{block_query, indenter, loop_query};
@@ -279,7 +280,7 @@ impl<'a, 'tcx> mem_categorization::Typer<'tcx> for FnCtxt<'a, 'tcx> {
     fn node_ty(&self, id: ast::NodeId) -> McResult<Ty<'tcx>> {
         Ok(self.node_ty(id))
     }
-    fn node_method_ty(&self, method_call: typeck::MethodCall)
+    fn node_method_ty(&self, method_call: ty::MethodCall)
                       -> Option<Ty<'tcx>> {
         self.inh.method_map.borrow().get(&method_call).map(|m| m.ty)
     }
@@ -287,7 +288,7 @@ impl<'a, 'tcx> mem_categorization::Typer<'tcx> for FnCtxt<'a, 'tcx> {
         &self.inh.adjustments
     }
     fn is_method_call(&self, id: ast::NodeId) -> bool {
-        self.inh.method_map.borrow().contains_key(&typeck::MethodCall::expr(id))
+        self.inh.method_map.borrow().contains_key(&ty::MethodCall::expr(id))
     }
     fn temporary_scope(&self, rvalue_id: ast::NodeId) -> Option<CodeExtent> {
         self.tcx().temporary_scope(rvalue_id)
@@ -3260,7 +3261,7 @@ fn check_expr_with_unifier<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
             Some(method) => {
                 let method_ty = method.ty;
                 // HACK(eddyb) Fully qualified path to work around a resolve bug.
-                let method_call = ::middle::typeck::MethodCall::expr(op_ex.id);
+                let method_call = ::middle::ty::MethodCall::expr(op_ex.id);
                 fcx.inh.method_map.borrow_mut().insert(method_call, method);
                 match check_method_argument_types(fcx,
                                             op_ex.span,
diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs
index 08f7f9cf5e3..1c938bc1e1f 100644
--- a/src/librustc/middle/typeck/check/regionck.rs
+++ b/src/librustc/middle/typeck/check/regionck.rs
@@ -119,7 +119,7 @@ use middle::mem_categorization as mc;
 use middle::region::CodeExtent;
 use middle::traits;
 use middle::ty::{ReScope};
-use middle::ty::{mod, Ty};
+use middle::ty::{mod, Ty, MethodCall};
 use middle::typeck::astconv::AstConv;
 use middle::typeck::check::FnCtxt;
 use middle::typeck::check::regionmanip;
@@ -127,7 +127,6 @@ use middle::typeck::check::vtable;
 use middle::typeck::infer::resolve_and_force_all_but_regions;
 use middle::typeck::infer::resolve_type;
 use middle::typeck::infer;
-use middle::typeck::MethodCall;
 use middle::pat_util;
 use util::nodemap::{DefIdMap, NodeMap, FnvHashMap};
 use util::ppaux::{ty_to_string, Repr};
diff --git a/src/librustc/middle/typeck/check/writeback.rs b/src/librustc/middle/typeck/check/writeback.rs
index 23af30b44d9..8205e83fb05 100644
--- a/src/librustc/middle/typeck/check/writeback.rs
+++ b/src/librustc/middle/typeck/check/writeback.rs
@@ -15,14 +15,13 @@ use self::ResolveReason::*;
 
 use middle::def;
 use middle::pat_util;
-use middle::ty::{mod, Ty};
+use middle::ty::{mod, Ty, MethodCall, MethodCallee};
 use middle::ty_fold::{TypeFolder,TypeFoldable};
 use middle::typeck::astconv::AstConv;
 use middle::typeck::check::FnCtxt;
 use middle::typeck::infer::{force_all, resolve_all, resolve_region};
 use middle::typeck::infer::resolve_type;
 use middle::typeck::infer;
-use middle::typeck::{MethodCall, MethodCallee};
 use middle::typeck::write_substs_to_tcx;
 use middle::typeck::write_ty_to_tcx;
 use util::ppaux::Repr;
diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs
index 501dfcb2e2d..a95849e083d 100644
--- a/src/librustc/middle/typeck/mod.rs
+++ b/src/librustc/middle/typeck/mod.rs
@@ -61,10 +61,6 @@ independently:
 
 #![allow(non_camel_case_types)]
 
-pub use self::ExprAdjustment::*;
-pub use self::vtable_origin::*;
-pub use self::MethodOrigin::*;
-
 use middle::def;
 use middle::resolve;
 use middle::subst;
@@ -74,10 +70,7 @@ use session::config;
 use util::common::time;
 use util::ppaux::Repr;
 use util::ppaux;
-use util::nodemap::{NodeMap, FnvHashMap};
 
-use std::cell::RefCell;
-use std::rc::Rc;
 use syntax::codemap::Span;
 use syntax::print::pprust::*;
 use syntax::{ast, ast_map, abi};
@@ -90,192 +83,11 @@ pub mod collect;
 pub mod coherence;
 pub mod variance;
 
-#[deriving(Clone, Encodable, Decodable, PartialEq, PartialOrd, Show)]
-pub struct param_index {
-    pub space: subst::ParamSpace,
-    pub index: uint
-}
-
-#[deriving(Clone, Show)]
-pub enum MethodOrigin<'tcx> {
-    // fully statically resolved method
-    MethodStatic(ast::DefId),
-
-    // fully statically resolved unboxed closure invocation
-    MethodStaticUnboxedClosure(ast::DefId),
-
-    // method invoked on a type parameter with a bounded trait
-    MethodTypeParam(MethodParam<'tcx>),
-
-    // method invoked on a trait instance
-    MethodTraitObject(MethodObject<'tcx>),
-
-}
-
-// details for a method invoked with a receiver whose type is a type parameter
-// with a bounded trait.
-#[deriving(Clone, Show)]
-pub struct MethodParam<'tcx> {
-    // the precise trait reference that occurs as a bound -- this may
-    // be a supertrait of what the user actually typed.
-    pub trait_ref: Rc<ty::TraitRef<'tcx>>,
-
-    // index of uint in the list of methods for the trait
-    pub method_num: uint,
-}
-
-// details for a method invoked with a receiver whose type is an object
-#[deriving(Clone, Show)]
-pub struct MethodObject<'tcx> {
-    // the (super)trait containing the method to be invoked
-    pub trait_ref: Rc<ty::TraitRef<'tcx>>,
-
-    // the actual base trait id of the object
-    pub object_trait_id: ast::DefId,
-
-    // index of the method to be invoked amongst the trait's methods
-    pub method_num: uint,
-
-    // index into the actual runtime vtable.
-    // the vtable is formed by concatenating together the method lists of
-    // the base object trait and all supertraits;  this is the index into
-    // that vtable
-    pub real_index: uint,
-}
-
-#[deriving(Clone)]
-pub struct MethodCallee<'tcx> {
-    pub origin: MethodOrigin<'tcx>,
-    pub ty: Ty<'tcx>,
-    pub substs: subst::Substs<'tcx>
-}
-
-/// With method calls, we store some extra information in
-/// side tables (i.e method_map). We use
-/// MethodCall as a key to index into these tables instead of
-/// just directly using the expression's NodeId. The reason
-/// for this being that we may apply adjustments (coercions)
-/// with the resulting expression also needing to use the
-/// side tables. The problem with this is that we don't
-/// assign a separate NodeId to this new expression
-/// and so it would clash with the base expression if both
-/// needed to add to the side tables. Thus to disambiguate
-/// we also keep track of whether there's an adjustment in
-/// our key.
-#[deriving(Clone, PartialEq, Eq, Hash, Show)]
-pub struct MethodCall {
-    pub expr_id: ast::NodeId,
-    pub adjustment: ExprAdjustment
-}
-
-#[deriving(Clone, PartialEq, Eq, Hash, Show, Encodable, Decodable)]
-pub enum ExprAdjustment {
-    NoAdjustment,
-    AutoDeref(uint),
-    AutoObject
-}
-
 pub struct TypeAndSubsts<'tcx> {
     pub substs: subst::Substs<'tcx>,
     pub ty: Ty<'tcx>,
 }
 
-impl MethodCall {
-    pub fn expr(id: ast::NodeId) -> MethodCall {
-        MethodCall {
-            expr_id: id,
-            adjustment: NoAdjustment
-        }
-    }
-
-    pub fn autoobject(id: ast::NodeId) -> MethodCall {
-        MethodCall {
-            expr_id: id,
-            adjustment: AutoObject
-        }
-    }
-
-    pub fn autoderef(expr_id: ast::NodeId, autoderef: uint) -> MethodCall {
-        MethodCall {
-            expr_id: expr_id,
-            adjustment: AutoDeref(1 + autoderef)
-        }
-    }
-}
-
-// maps from an expression id that corresponds to a method call to the details
-// of the method to be invoked
-pub type MethodMap<'tcx> = RefCell<FnvHashMap<MethodCall, MethodCallee<'tcx>>>;
-
-pub type vtable_param_res<'tcx> = Vec<vtable_origin<'tcx>>;
-
-// Resolutions for bounds of all parameters, left to right, for a given path.
-pub type vtable_res<'tcx> = VecPerParamSpace<vtable_param_res<'tcx>>;
-
-#[deriving(Clone)]
-pub enum vtable_origin<'tcx> {
-    /*
-      Statically known vtable. def_id gives the impl item
-      from whence comes the vtable, and tys are the type substs.
-      vtable_res is the vtable itself.
-     */
-    vtable_static(ast::DefId, subst::Substs<'tcx>, vtable_res<'tcx>),
-
-    /*
-      Dynamic vtable, comes from a parameter that has a bound on it:
-      fn foo<T:quux,baz,bar>(a: T) -- a's vtable would have a
-      vtable_param origin
-
-      The first argument is the param index (identifying T in the example),
-      and the second is the bound number (identifying baz)
-     */
-    vtable_param(param_index, uint),
-
-    /*
-      Vtable automatically generated for an unboxed closure. The def ID is the
-      ID of the closure expression.
-     */
-    vtable_unboxed_closure(ast::DefId),
-
-    /*
-      Asked to determine the vtable for ty_err. This is the value used
-      for the vtables of `Self` in a virtual call like `foo.bar()`
-      where `foo` is of object type. The same value is also used when
-      type errors occur.
-     */
-    vtable_error,
-}
-
-impl<'tcx> Repr<'tcx> for vtable_origin<'tcx> {
-    fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
-        match *self {
-            vtable_static(def_id, ref tys, ref vtable_res) => {
-                format!("vtable_static({}:{}, {}, {})",
-                        def_id,
-                        ty::item_path_str(tcx, def_id),
-                        tys.repr(tcx),
-                        vtable_res.repr(tcx))
-            }
-
-            vtable_param(x, y) => {
-                format!("vtable_param({}, {})", x, y)
-            }
-
-            vtable_unboxed_closure(def_id) => {
-                format!("vtable_unboxed_closure({})", def_id)
-            }
-
-            vtable_error => {
-                format!("vtable_error")
-            }
-        }
-    }
-}
-
-// For every explicit cast into an object type, maps from the cast
-// expr to the associated trait ref.
-pub type ObjectCastMap<'tcx> = RefCell<NodeMap<Rc<ty::TraitRef<'tcx>>>>;
-
 pub struct CrateCtxt<'a, 'tcx: 'a> {
     // A mapping from method call sites to traits that have that method.
     trait_map: resolve::TraitMap,
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs
index b739a97f734..1dfedd4c85c 100644
--- a/src/librustc/util/ppaux.rs
+++ b/src/librustc/util/ppaux.rs
@@ -23,7 +23,6 @@ use middle::ty::{ty_param, ty_ptr, ty_rptr, ty_tup, ty_open};
 use middle::ty::{ty_unboxed_closure};
 use middle::ty::{ty_uniq, ty_trait, ty_int, ty_uint, ty_infer};
 use middle::ty;
-use middle::typeck;
 use middle::typeck::check::regionmanip;
 
 use std::rc::Rc;
@@ -1018,7 +1017,7 @@ impl<'tcx> Repr<'tcx> for ty::FnOutput<'tcx> {
     }
 }
 
-impl<'tcx> Repr<'tcx> for typeck::MethodCallee<'tcx> {
+impl<'tcx> Repr<'tcx> for ty::MethodCallee<'tcx> {
     fn repr(&self, tcx: &ctxt<'tcx>) -> String {
         format!("MethodCallee {{origin: {}, ty: {}, {}}}",
                 self.origin.repr(tcx),
@@ -1027,26 +1026,26 @@ impl<'tcx> Repr<'tcx> for typeck::MethodCallee<'tcx> {
     }
 }
 
-impl<'tcx> Repr<'tcx> for typeck::MethodOrigin<'tcx> {
+impl<'tcx> Repr<'tcx> for ty::MethodOrigin<'tcx> {
     fn repr(&self, tcx: &ctxt<'tcx>) -> String {
         match self {
-            &typeck::MethodStatic(def_id) => {
+            &ty::MethodStatic(def_id) => {
                 format!("MethodStatic({})", def_id.repr(tcx))
             }
-            &typeck::MethodStaticUnboxedClosure(def_id) => {
+            &ty::MethodStaticUnboxedClosure(def_id) => {
                 format!("MethodStaticUnboxedClosure({})", def_id.repr(tcx))
             }
-            &typeck::MethodTypeParam(ref p) => {
+            &ty::MethodTypeParam(ref p) => {
                 p.repr(tcx)
             }
-            &typeck::MethodTraitObject(ref p) => {
+            &ty::MethodTraitObject(ref p) => {
                 p.repr(tcx)
             }
         }
     }
 }
 
-impl<'tcx> Repr<'tcx> for typeck::MethodParam<'tcx> {
+impl<'tcx> Repr<'tcx> for ty::MethodParam<'tcx> {
     fn repr(&self, tcx: &ctxt<'tcx>) -> String {
         format!("MethodParam({},{})",
                 self.trait_ref.repr(tcx),
@@ -1054,7 +1053,7 @@ impl<'tcx> Repr<'tcx> for typeck::MethodParam<'tcx> {
     }
 }
 
-impl<'tcx> Repr<'tcx> for typeck::MethodObject<'tcx> {
+impl<'tcx> Repr<'tcx> for ty::MethodObject<'tcx> {
     fn repr(&self, tcx: &ctxt<'tcx>) -> String {
         format!("MethodObject({},{},{})",
                 self.trait_ref.repr(tcx),
@@ -1293,7 +1292,6 @@ impl<'tcx> Repr<'tcx> for ty::ExplicitSelfCategory {
     }
 }
 
-
 impl<'tcx> Repr<'tcx> for regionmanip::WfConstraint<'tcx> {
     fn repr(&self, tcx: &ctxt) -> String {
         match *self {
diff --git a/src/librustc_trans/save/mod.rs b/src/librustc_trans/save/mod.rs
index 7a41be1dbe4..481ee679dbd 100644
--- a/src/librustc_trans/save/mod.rs
+++ b/src/librustc_trans/save/mod.rs
@@ -912,10 +912,10 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
                            ex: &ast::Expr,
                            args: &Vec<P<ast::Expr>>) {
         let method_map = self.analysis.ty_cx.method_map.borrow();
-        let method_callee = &(*method_map)[typeck::MethodCall::expr(ex.id)];
+        let method_callee = &(*method_map)[ty::MethodCall::expr(ex.id)];
         let (def_id, decl_id) = match method_callee.origin {
-            typeck::MethodStatic(def_id) |
-            typeck::MethodStaticUnboxedClosure(def_id) => {
+            ty::MethodStatic(def_id) |
+            ty::MethodStaticUnboxedClosure(def_id) => {
                 // method invoked on an object with a concrete type (not a static method)
                 let decl_id =
                     match ty::trait_item_of_item(&self.analysis.ty_cx,
@@ -936,14 +936,14 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
                 };
                 (Some(def_id), decl_id)
             }
-            typeck::MethodTypeParam(ref mp) => {
+            ty::MethodTypeParam(ref mp) => {
                 // method invoked on a type parameter
                 let trait_item = ty::trait_item(&self.analysis.ty_cx,
                                                 mp.trait_ref.def_id,
                                                 mp.method_num);
                 (None, Some(trait_item.def_id()))
             }
-            typeck::MethodTraitObject(ref mo) => {
+            ty::MethodTraitObject(ref mo) => {
                 // method invoked on a trait instance
                 let trait_item = ty::trait_item(&self.analysis.ty_cx,
                                                 mo.trait_ref.def_id,
diff --git a/src/librustc_trans/trans/callee.rs b/src/librustc_trans/trans/callee.rs
index 176fe7096e7..1a273f1e2b7 100644
--- a/src/librustc_trans/trans/callee.rs
+++ b/src/librustc_trans/trans/callee.rs
@@ -49,8 +49,8 @@ use trans::monomorphize;
 use trans::type_::Type;
 use trans::type_of;
 use middle::ty::{mod, Ty};
+use middle::ty::MethodCall;
 use middle::typeck::coherence::make_substs_for_receiver_types;
-use middle::typeck::MethodCall;
 use util::ppaux::Repr;
 use util::ppaux::ty_to_string;
 
diff --git a/src/librustc_trans/trans/common.rs b/src/librustc_trans/trans/common.rs
index febb33f6c54..6bd86cf5aa4 100644
--- a/src/librustc_trans/trans/common.rs
+++ b/src/librustc_trans/trans/common.rs
@@ -36,7 +36,6 @@ use middle::traits;
 use middle::ty::{mod, Ty};
 use middle::ty_fold;
 use middle::ty_fold::TypeFoldable;
-use middle::typeck;
 use middle::typeck::infer;
 use util::ppaux::Repr;
 use util::nodemap::{DefIdMap, FnvHashMap, NodeMap};
@@ -468,7 +467,7 @@ impl<'blk, 'tcx> mc::Typer<'tcx> for BlockS<'blk, 'tcx> {
         Ok(node_id_type(self, id))
     }
 
-    fn node_method_ty(&self, method_call: typeck::MethodCall) -> Option<Ty<'tcx>> {
+    fn node_method_ty(&self, method_call: ty::MethodCall) -> Option<Ty<'tcx>> {
         self.tcx()
             .method_map
             .borrow()
@@ -481,7 +480,7 @@ impl<'blk, 'tcx> mc::Typer<'tcx> for BlockS<'blk, 'tcx> {
     }
 
     fn is_method_call(&self, id: ast::NodeId) -> bool {
-        self.tcx().method_map.borrow().contains_key(&typeck::MethodCall::expr(id))
+        self.tcx().method_map.borrow().contains_key(&ty::MethodCall::expr(id))
     }
 
     fn temporary_scope(&self, rvalue_id: ast::NodeId) -> Option<region::CodeExtent> {
@@ -870,7 +869,7 @@ pub enum ExprOrMethodCall {
     ExprId(ast::NodeId),
 
     // Type parameters for a method call like `a.foo::<int>()`
-    MethodCall(typeck::MethodCall)
+    MethodCall(ty::MethodCall)
 }
 
 pub fn node_id_substs<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
diff --git a/src/librustc_trans/trans/controlflow.rs b/src/librustc_trans/trans/controlflow.rs
index 3d32f6045a7..a1574aa2f0e 100644
--- a/src/librustc_trans/trans/controlflow.rs
+++ b/src/librustc_trans/trans/controlflow.rs
@@ -27,7 +27,7 @@ use trans::meth;
 use trans::type_::Type;
 use trans;
 use middle::ty;
-use middle::typeck::MethodCall;
+use middle::ty::MethodCall;
 use session::config::FullDebugInfo;
 use util::ppaux::Repr;
 use util::ppaux;
diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs
index 646ee601a4c..f538a73329b 100644
--- a/src/librustc_trans/trans/expr.rs
+++ b/src/librustc_trans/trans/expr.rs
@@ -47,9 +47,18 @@ use trans::build::*;
 use trans::cleanup::{mod, CleanupMethods};
 use trans::common::*;
 use trans::datum::*;
-use middle::ty::{mod, struct_fields, tup_fields};
-use middle::ty::{AdjustDerefRef, AdjustAddEnv, AutoUnsafe, AutoPtr, Ty};
-use middle::typeck::{mod, MethodCall};
+use trans::debuginfo;
+use trans::glue;
+use trans::machine;
+use trans::meth;
+use trans::inline;
+use trans::tvec;
+use trans::type_of;
+use middle::ty::{struct_fields, tup_fields};
+use middle::ty::{AdjustDerefRef, AdjustAddEnv, AutoUnsafe};
+use middle::ty::{AutoPtr};
+use middle::ty::{mod, Ty};
+use middle::ty::MethodCall;
 use util::common::indenter;
 use util::ppaux::Repr;
 use trans::machine::{llsize_of, llsize_of_alloc};
@@ -2091,7 +2100,7 @@ fn deref_once<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
             // path (below) to dereference that `&T`.
             let datum = match method_call.adjustment {
                 // Always perform an AutoPtr when applying an overloaded auto-deref
-                typeck::AutoDeref(_) => unpack_datum!(bcx, auto_ref(bcx, datum, expr)),
+                ty::AutoDeref(_) => unpack_datum!(bcx, auto_ref(bcx, datum, expr)),
                 _ => datum
             };
 
diff --git a/src/librustc_trans/trans/meth.rs b/src/librustc_trans/trans/meth.rs
index ef431243b31..94ff526debd 100644
--- a/src/librustc_trans/trans/meth.rs
+++ b/src/librustc_trans/trans/meth.rs
@@ -31,8 +31,7 @@ use trans::machine;
 use trans::type_::Type;
 use trans::type_of::*;
 use middle::ty::{mod, Ty};
-use middle::typeck;
-use middle::typeck::MethodCall;
+use middle::ty::MethodCall;
 use util::ppaux::Repr;
 
 use std::c_str::ToCStr;
@@ -119,8 +118,8 @@ pub fn trans_method_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                  .unwrap();
 
     match origin {
-        typeck::MethodStatic(did) |
-        typeck::MethodStaticUnboxedClosure(did) => {
+        ty::MethodStatic(did) |
+        ty::MethodStaticUnboxedClosure(did) => {
             Callee {
                 bcx: bcx,
                 data: Fn(callee::trans_fn_ref(bcx,
@@ -129,7 +128,7 @@ pub fn trans_method_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
             }
         }
 
-        typeck::MethodTypeParam(typeck::MethodParam {
+        ty::MethodTypeParam(ty::MethodParam {
             ref trait_ref,
             method_num
         }) => {
@@ -147,7 +146,7 @@ pub fn trans_method_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                        method_num, origin)
         }
 
-        typeck::MethodTraitObject(ref mt) => {
+        ty::MethodTraitObject(ref mt) => {
             let self_expr = match self_expr {
                 Some(self_expr) => self_expr,
                 None => {