]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/check/method/mod.rs
split ty::util and ty::adjustment
[rust.git] / src / librustc_typeck / check / method / mod.rs
index bc495219f1156b9b021cfd436ab343b717a89bf1..1cfb495b36ed75a9e6dfb1b2c5384728e870e8e7 100644 (file)
 use middle::subst;
 use middle::traits;
 use middle::ty::{self, ToPredicate, ToPolyTraitRef, TraitRef};
+use middle::ty::adjustment::{AdjustDerefRef, AutoDerefRef, AutoPtr};
 use middle::infer;
 
 use syntax::ast;
 use syntax::codemap::Span;
 
+use rustc_front::hir;
+
 pub use self::MethodError::*;
 pub use self::CandidateSource::*;
 
@@ -110,8 +113,8 @@ pub fn lookup<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                         method_name: ast::Name,
                         self_ty: ty::Ty<'tcx>,
                         supplied_method_types: Vec<ty::Ty<'tcx>>,
-                        call_expr: &'tcx ast::Expr,
-                        self_expr: &'tcx ast::Expr)
+                        call_expr: &'tcx hir::Expr,
+                        self_expr: &'tcx hir::Expr)
                         -> Result<ty::MethodCallee<'tcx>, MethodError<'tcx>>
 {
     debug!("lookup(method_name={}, self_ty={:?}, call_expr={:?}, self_expr={:?})",
@@ -128,7 +131,7 @@ pub fn lookup<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 
 pub fn lookup_in_trait<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                  span: Span,
-                                 self_expr: Option<&ast::Expr>,
+                                 self_expr: Option<&hir::Expr>,
                                  m_name: ast::Name,
                                  trait_def_id: DefId,
                                  self_ty: ty::Ty<'tcx>,
@@ -150,7 +153,7 @@ pub fn lookup_in_trait<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 /// this method is basically the same as confirmation.
 pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                           span: Span,
-                                          self_expr: Option<&ast::Expr>,
+                                          self_expr: Option<&hir::Expr>,
                                           m_name: ast::Name,
                                           trait_def_id: DefId,
                                           autoderefs: usize,
@@ -280,9 +283,9 @@ pub fn lookup_in_trait_adjusted<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                     match transformed_self_ty.sty {
                         ty::TyRef(region, ty::TypeAndMut { mutbl, ty: _ }) => {
                             fcx.write_adjustment(self_expr.id,
-                                ty::AdjustDerefRef(ty::AutoDerefRef {
+                                AdjustDerefRef(AutoDerefRef {
                                     autoderefs: autoderefs,
-                                    autoref: Some(ty::AutoPtr(region, mutbl)),
+                                    autoref: Some(AutoPtr(region, mutbl)),
                                     unsize: if unsize {
                                         Some(transformed_self_ty)
                                     } else {
@@ -335,7 +338,7 @@ pub fn resolve_ufcs<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
     let def_id = pick.item.def_id();
     let mut lp = LastMod(AllPublic);
     if let probe::InherentImplPick = pick.kind {
-        if pick.item.vis() != ast::Public {
+        if pick.item.vis() != hir::Public {
             lp = LastMod(DependsOn(def_id));
         }
     }