]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/middle/mem_categorization.rs
split ty::util and ty::adjustment
[rust.git] / src / librustc / middle / mem_categorization.rs
index a8c80d52209e463277f2aa5beb588f3d00f4e0a4..dd2f48d25b4b0c6cc00c69dbd56b508fa824e141 100644 (file)
@@ -77,6 +77,7 @@
 use middle::infer;
 use middle::check_const;
 use middle::def;
+use middle::ty::adjustment;
 use middle::ty::{self, Ty};
 
 use rustc_front::hir::{MutImmutable, MutMutable};
@@ -400,7 +401,7 @@ fn pat_ty(&self, pat: &hir::Pat) -> McResult<Ty<'tcx>> {
                 // a bind-by-ref means that the base_ty will be the type of the ident itself,
                 // but what we want here is the type of the underlying value being borrowed.
                 // So peel off one-level, turning the &T into T.
-                match base_ty.builtin_deref(false) {
+                match base_ty.builtin_deref(false, ty::NoPreference) {
                     Some(t) => t.ty,
                     None => { return Err(()); }
                 }
@@ -421,16 +422,16 @@ pub fn cat_expr(&self, expr: &hir::Expr) -> McResult<cmt<'tcx>> {
 
             Some(adjustment) => {
                 match *adjustment {
-                    ty::AdjustDerefRef(
-                        ty::AutoDerefRef {
+                    adjustment::AdjustDerefRef(
+                        adjustment::AutoDerefRef {
                             autoref: None, unsize: None, autoderefs, ..}) => {
                         // Equivalent to *expr or something similar.
                         self.cat_expr_autoderefd(expr, autoderefs)
                     }
 
-                    ty::AdjustReifyFnPointer |
-                    ty::AdjustUnsafeFnPointer |
-                    ty::AdjustDerefRef(_) => {
+                    adjustment::AdjustReifyFnPointer |
+                    adjustment::AdjustUnsafeFnPointer |
+                    adjustment::AdjustDerefRef(_) => {
                         debug!("cat_expr({:?}): {:?}",
                                adjustment,
                                expr);
@@ -578,7 +579,7 @@ pub fn cat_def(&self,
               }))
           }
 
-          def::DefUpvar(var_id, fn_node_id) => {
+          def::DefUpvar(var_id, _, fn_node_id) => {
               let ty = try!(self.node_ty(fn_node_id));
               match ty.sty {
                   ty::TyClosure(closure_id, _) => {
@@ -897,7 +898,7 @@ fn cat_deref<N:ast_node>(&self,
             None => base_cmt
         };
         let base_cmt_ty = base_cmt.ty;
-        match base_cmt_ty.builtin_deref(true) {
+        match base_cmt_ty.builtin_deref(true, ty::NoPreference) {
             Some(mt) => {
                 let ret = self.cat_deref_common(node, base_cmt, deref_cnt,
                                               mt.ty,
@@ -1044,7 +1045,7 @@ fn deref_vec<N:ast_node>(&self,
                     span:elt.span(),
                     cat:cat_deref(base_cmt.clone(), 0, ptr),
                     mutbl:m,
-                    ty: match base_cmt.ty.builtin_deref(false) {
+                    ty: match base_cmt.ty.builtin_deref(false, ty::NoPreference) {
                         Some(mt) => mt.ty,
                         None => self.tcx().sess.bug("Found non-derefable type")
                     },