about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorJames Miller <bladeon@gmail.com>2013-07-06 16:57:11 +1200
committerJames Miller <bladeon@gmail.com>2013-07-07 22:51:10 +1200
commit47eca2113c5c55a4ffbb8c11a38c8ca7a79a1d72 (patch)
tree264e2191016cfc1b83d7a79169a3f6bc19706c1e /src/librustc
parent46a1f54666dbeb9a926c75b380f62571963cbacc (diff)
downloadrust-47eca2113c5c55a4ffbb8c11a38c8ca7a79a1d72.tar.gz
rust-47eca2113c5c55a4ffbb8c11a38c8ca7a79a1d72.zip
De-share ast::Ty
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/front/config.rs4
-rw-r--r--src/librustc/metadata/encoder.rs2
-rw-r--r--src/librustc/middle/kind.rs4
-rw-r--r--src/librustc/middle/lint.rs6
-rw-r--r--src/librustc/middle/region.rs18
-rw-r--r--src/librustc/middle/resolve.rs34
-rw-r--r--src/librustc/middle/trans/base.rs6
-rw-r--r--src/librustc/middle/trans/debuginfo.rs20
-rw-r--r--src/librustc/middle/typeck/astconv.rs16
-rw-r--r--src/librustc/middle/typeck/check/mod.rs18
-rw-r--r--src/librustc/middle/typeck/coherence.rs4
-rw-r--r--src/librustc/middle/typeck/collect.rs16
12 files changed, 75 insertions, 73 deletions
diff --git a/src/librustc/front/config.rs b/src/librustc/front/config.rs
index 0f71eeff5a2..df829d5e209 100644
--- a/src/librustc/front/config.rs
+++ b/src/librustc/front/config.rs
@@ -98,10 +98,10 @@ fn fold_foreign_mod(
 fn fold_item_underscore(cx: @Context, item: &ast::item_,
                         fld: @fold::ast_fold) -> ast::item_ {
     let item = match *item {
-        ast::item_impl(ref a, ref b, c, ref methods) => {
+        ast::item_impl(ref a, ref b, ref c, ref methods) => {
             let methods = methods.iter().filter(|m| method_in_cfg(cx, **m))
                 .transform(|x| *x).collect();
-            ast::item_impl(/*bad*/ copy *a, /*bad*/ copy *b, c, methods)
+            ast::item_impl(/*bad*/ copy *a, /*bad*/ copy *b, /*bad*/ copy *c, methods)
         }
         ast::item_trait(ref a, ref b, ref methods) => {
             let methods = methods.iter().filter(|m| trait_method_in_cfg(cx, *m) )
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index 8273b3e663a..a9f3200af12 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -1003,7 +1003,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
                                         index);
         }
       }
-      item_impl(ref generics, ref opt_trait, ty, ref methods) => {
+      item_impl(ref generics, ref opt_trait, ref ty, ref methods) => {
         add_to_index();
         ebml_w.start_tag(tag_items_data_item);
         encode_def_id(ebml_w, local_def(item.id));
diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs
index 0bc7a4a0114..335a54a9753 100644
--- a/src/librustc/middle/kind.rs
+++ b/src/librustc/middle/kind.rs
@@ -117,7 +117,7 @@ fn check_item(item: @item, (cx, visitor): (Context, visit::vt<Context>)) {
     // If this is a destructor, check kinds.
     if !attrs_contains_name(item.attrs, "unsafe_destructor") {
         match item.node {
-            item_impl(_, Some(ref trait_ref), self_type, _) => {
+            item_impl(_, Some(ref trait_ref), ref self_type, _) => {
                 match cx.tcx.def_map.find(&trait_ref.ref_id) {
                     None => cx.tcx.sess.bug("trait ref not in def map!"),
                     Some(&trait_def) => {
@@ -321,7 +321,7 @@ pub fn check_expr(e: @expr, (cx, v): (Context, visit::vt<Context>)) {
     visit::visit_expr(e, (cx, v));
 }
 
-fn check_ty(aty: @Ty, (cx, v): (Context, visit::vt<Context>)) {
+fn check_ty(aty: &Ty, (cx, v): (Context, visit::vt<Context>)) {
     match aty.node {
       ty_path(_, _, id) => {
           let r = cx.tcx.node_type_substs.find(&id);
diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs
index c39b676b97f..0dce9c69bfd 100644
--- a/src/librustc/middle/lint.rs
+++ b/src/librustc/middle/lint.rs
@@ -747,9 +747,9 @@ fn check_item_ctypes(cx: &Context, it: &ast::item) {
 
     fn check_foreign_fn(cx: &Context, decl: &ast::fn_decl) {
         for decl.inputs.iter().advance |in| {
-            check_ty(cx, in.ty);
+            check_ty(cx, &in.ty);
         }
-        check_ty(cx, decl.output)
+        check_ty(cx, &decl.output)
     }
 
     match it.node {
@@ -759,7 +759,7 @@ fn check_item_ctypes(cx: &Context, it: &ast::item) {
                 ast::foreign_item_fn(ref decl, _, _) => {
                     check_foreign_fn(cx, decl);
                 }
-                ast::foreign_item_static(t, _) => { check_ty(cx, t); }
+                ast::foreign_item_static(ref t, _) => { check_ty(cx, t); }
             }
         }
       }
diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs
index f76d9541baa..b1b2a0083ac 100644
--- a/src/librustc/middle/region.rs
+++ b/src/librustc/middle/region.rs
@@ -713,10 +713,10 @@ fn determine_rp_in_fn(fk: &visit::fn_kind,
     do cx.with(cx.item_id, false) {
         do cx.with_ambient_variance(rv_contravariant) {
             for decl.inputs.iter().advance |a| {
-                (visitor.visit_ty)(a.ty, (cx, visitor));
+                (visitor.visit_ty)(&a.ty, (cx, visitor));
             }
         }
-        (visitor.visit_ty)(decl.output, (cx, visitor));
+        (visitor.visit_ty)(&decl.output, (cx, visitor));
         let generics = visit::generics_of_fn(fk);
         (visitor.visit_generics)(&generics, (cx, visitor));
         (visitor.visit_block)(body, (cx, visitor));
@@ -731,7 +731,7 @@ fn determine_rp_in_ty_method(ty_m: &ast::ty_method,
     }
 }
 
-fn determine_rp_in_ty(ty: @ast::Ty,
+fn determine_rp_in_ty(ty: &ast::Ty,
                       (cx, visitor): (@mut DetermineRpCtxt,
                                       visit::vt<@mut DetermineRpCtxt>)) {
     // we are only interested in types that will require an item to
@@ -815,8 +815,8 @@ fn determine_rp_in_ty(ty: @ast::Ty,
     }
 
     match ty.node {
-      ast::ty_box(mt) | ast::ty_uniq(mt) | ast::ty_vec(mt) |
-      ast::ty_rptr(_, mt) | ast::ty_ptr(mt) => {
+      ast::ty_box(ref mt) | ast::ty_uniq(ref mt) | ast::ty_vec(ref mt) |
+      ast::ty_rptr(_, ref mt) | ast::ty_ptr(ref mt) => {
         visit_mt(mt, (cx, visitor));
       }
 
@@ -824,7 +824,7 @@ fn determine_rp_in_ty(ty: @ast::Ty,
         // type parameters are---for now, anyway---always invariant
         do cx.with_ambient_variance(rv_invariant) {
             for path.types.iter().advance |tp| {
-                (visitor.visit_ty)(*tp, (cx, visitor));
+                (visitor.visit_ty)(tp, (cx, visitor));
             }
         }
       }
@@ -837,10 +837,10 @@ fn determine_rp_in_ty(ty: @ast::Ty,
             // parameters are contravariant
             do cx.with_ambient_variance(rv_contravariant) {
                 for decl.inputs.iter().advance |a| {
-                    (visitor.visit_ty)(a.ty, (cx, visitor));
+                    (visitor.visit_ty)(&a.ty, (cx, visitor));
                 }
             }
-            (visitor.visit_ty)(decl.output, (cx, visitor));
+            (visitor.visit_ty)(&decl.output, (cx, visitor));
         }
       }
 
@@ -849,7 +849,7 @@ fn determine_rp_in_ty(ty: @ast::Ty,
       }
     }
 
-    fn visit_mt(mt: ast::mt,
+    fn visit_mt(mt: &ast::mt,
                 (cx, visitor): (@mut DetermineRpCtxt,
                                 visit::vt<@mut DetermineRpCtxt>)) {
         // mutability is invariant
diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs
index 99ec1ccb1f1..861c61e497a 100644
--- a/src/librustc/middle/resolve.rs
+++ b/src/librustc/middle/resolve.rs
@@ -1233,7 +1233,7 @@ impl Resolver {
                 visit_item(item, (new_parent, visitor));
             }
 
-            item_impl(_, None, ty, ref methods) => {
+            item_impl(_, None, ref ty, ref methods) => {
                 // If this implements an anonymous trait, then add all the
                 // methods within to a new module, if the type was defined
                 // within this module.
@@ -1243,8 +1243,8 @@ impl Resolver {
                 // the same module that declared the type.
 
                 // Create the module and add all methods.
-                match *ty {
-                    Ty {
+                match ty {
+                    &Ty {
                         node: ty_path(ref path, _, _),
                         _
                     } if path.idents.len() == 1 => {
@@ -1313,7 +1313,7 @@ impl Resolver {
                 visit_item(item, (parent, visitor));
             }
 
-            item_impl(_, Some(_), _ty, ref _methods) => {
+            item_impl(_, Some(_), _, _) => {
                 visit_item(item, (parent, visitor));
             }
 
@@ -3534,7 +3534,7 @@ impl Resolver {
 
             item_impl(ref generics,
                       ref implemented_traits,
-                      self_type,
+                      ref self_type,
                       ref methods) => {
                 self.resolve_implementation(item.id,
                                             generics,
@@ -3585,10 +3585,10 @@ impl Resolver {
                                     visitor);
 
                                 for ty_m.decl.inputs.iter().advance |argument| {
-                                    self.resolve_type(argument.ty, visitor);
+                                    self.resolve_type(&argument.ty, visitor);
                                 }
 
-                                self.resolve_type(ty_m.decl.output, visitor);
+                                self.resolve_type(&ty_m.decl.output, visitor);
                             }
                           }
                           provided(m) => {
@@ -3778,12 +3778,12 @@ impl Resolver {
                                              None,
                                              visitor);
 
-                        self.resolve_type(argument.ty, visitor);
+                        self.resolve_type(&argument.ty, visitor);
 
                         debug!("(resolving function) recorded argument");
                     }
 
-                    self.resolve_type(declaration.output, visitor);
+                    self.resolve_type(&declaration.output, visitor);
                 }
             }
 
@@ -3878,7 +3878,7 @@ impl Resolver {
 
             // Resolve fields.
             for fields.iter().advance |field| {
-                self.resolve_type(field.node.ty, visitor);
+                self.resolve_type(&field.node.ty, visitor);
             }
         }
     }
@@ -3914,7 +3914,7 @@ impl Resolver {
                                   id: node_id,
                                   generics: &Generics,
                                   opt_trait_reference: &Option<trait_ref>,
-                                  self_type: @Ty,
+                                  self_type: &Ty,
                                   methods: &[@method],
                                   visitor: ResolveVisitor) {
         // If applicable, create a rib for the type parameters.
@@ -4001,7 +4001,7 @@ impl Resolver {
         let mutability = if local.node.is_mutbl {Mutable} else {Immutable};
 
         // Resolve the type.
-        self.resolve_type(local.node.ty, visitor);
+        self.resolve_type(&local.node.ty, visitor);
 
         // Resolve the initializer, if necessary.
         match local.node.init {
@@ -4112,7 +4112,7 @@ impl Resolver {
         debug!("(resolving block) leaving block");
     }
 
-    pub fn resolve_type(@mut self, ty: @Ty, visitor: ResolveVisitor) {
+    pub fn resolve_type(@mut self, ty: &Ty, visitor: ResolveVisitor) {
         match ty.node {
             // Like path expressions, the interpretation of path types depends
             // on whether the path has multiple elements in it or not.
@@ -4334,7 +4334,7 @@ impl Resolver {
 
                     // Check the types in the path pattern.
                     for path.types.iter().advance |ty| {
-                        self.resolve_type(*ty, visitor);
+                        self.resolve_type(ty, visitor);
                     }
                 }
 
@@ -4367,7 +4367,7 @@ impl Resolver {
 
                     // Check the types in the path pattern.
                     for path.types.iter().advance |ty| {
-                        self.resolve_type(*ty, visitor);
+                        self.resolve_type(ty, visitor);
                     }
                 }
 
@@ -4396,7 +4396,7 @@ impl Resolver {
 
                     // Check the types in the path pattern.
                     for path.types.iter().advance |ty| {
-                        self.resolve_type(*ty, visitor);
+                        self.resolve_type(ty, visitor);
                     }
                 }
 
@@ -4491,7 +4491,7 @@ impl Resolver {
                         -> Option<def> {
         // First, resolve the types.
         for path.types.iter().advance |ty| {
-            self.resolve_type(*ty, visitor);
+            self.resolve_type(ty, visitor);
         }
 
         if path.global {
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index e5edd43cf05..e6384ae4d0d 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -1737,7 +1737,7 @@ pub fn copy_args_to_allocas(fcx: fn_ctxt,
         fcx.llargs.insert(arg_id, llarg);
 
         if fcx.ccx.sess.opts.extra_debuginfo && fcx_has_nonzero_span(fcx) {
-            debuginfo::create_arg(bcx, args[arg_n], args[arg_n].ty.span);
+            debuginfo::create_arg(bcx, &args[arg_n], args[arg_n].ty.span);
         }
     }
 
@@ -1911,7 +1911,7 @@ pub fn trans_enum_variant(ccx: @mut CrateContext,
     let fn_args = do args.map |varg| {
         ast::arg {
             is_mutbl: false,
-            ty: varg.ty,
+            ty: copy varg.ty,
             pat: ast_util::ident_to_pat(
                 ccx.tcx.sess.next_node_id(),
                 codemap::dummy_sp(),
@@ -1985,7 +1985,7 @@ pub fn trans_tuple_struct(ccx: @mut CrateContext,
     let fn_args = do fields.map |field| {
         ast::arg {
             is_mutbl: false,
-            ty: field.node.ty,
+            ty: copy field.node.ty,
             pat: ast_util::ident_to_pat(ccx.tcx.sess.next_node_id(),
                                         codemap::dummy_sp(),
                                         special_idents::arg),
diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs
index 32a71ea7019..fc73d805379 100644
--- a/src/librustc/middle/trans/debuginfo.rs
+++ b/src/librustc/middle/trans/debuginfo.rs
@@ -182,7 +182,7 @@ pub fn create_local_var(bcx: block, local: @ast::local) -> DIVariable {
 ///
 /// Adds the created metadata nodes directly to the crate's IR.
 /// The return value should be ignored if called from outside of the debuginfo module.
-pub fn create_arg(bcx: block, arg: ast::arg, span: span) -> Option<DIVariable> {
+pub fn create_arg(bcx: block, arg: &ast::arg, span: span) -> Option<DIVariable> {
     debug!("create_arg");
     if true {
         // XXX create_arg disabled for now because "node_id_type(bcx, arg.id)" below blows
@@ -259,23 +259,25 @@ pub fn create_function(fcx: fn_ctxt) -> DISubprogram {
     let fcx = &mut *fcx;
     let span = fcx.span.get();
 
-    let (ident, ret_ty, id) = match cx.tcx.items.get_copy(&fcx.id) {
-      ast_map::node_item(item, _) => {
+    let fnitem = cx.tcx.items.get_copy(&fcx.id);
+    let (ident, ret_ty, id) = match fnitem {
+      ast_map::node_item(ref item, _) => {
         match item.node {
-          ast::item_fn(ref decl, _, _, _, _) => {
-            (item.ident, decl.output, item.id)
+          ast::item_fn(ast::fn_decl { output: ref ty, _}, _, _, _, _) => {
+            (item.ident, ty, item.id)
           }
           _ => fcx.ccx.sess.span_bug(item.span, "create_function: item bound to non-function")
         }
       }
-      ast_map::node_method(method, _, _) => {
-          (method.ident, method.decl.output, method.id)
+      ast_map::node_method(@ast::method { decl: ast::fn_decl { output: ref ty, _ },
+                           id: id, ident: ident, _}, _, _) => {
+          (ident, ty, id)
       }
-      ast_map::node_expr(expr) => {
+      ast_map::node_expr(ref expr) => {
         match expr.node {
           ast::expr_fn_block(ref decl, _) => {
             let name = gensym_name("fn");
-            (name, decl.output, expr.id)
+            (name, &decl.output, expr.id)
           }
           _ => fcx.ccx.sess.span_bug(expr.span,
                   "create_function: expected an expr_fn_block here")
diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs
index 6aac077bbd9..9442eb0b838 100644
--- a/src/librustc/middle/typeck/astconv.rs
+++ b/src/librustc/middle/typeck/astconv.rs
@@ -179,7 +179,7 @@ fn ast_path_substs<AC:AstConv,RS:region_scope + Copy + 'static>(
             fmt!("wrong number of type arguments: expected %u but found %u",
                  decl_generics.type_param_defs.len(), path.types.len()));
     }
-    let tps = path.types.map(|a_t| ast_ty_to_ty(this, rscope, *a_t));
+    let tps = path.types.map(|a_t| ast_ty_to_ty(this, rscope, a_t));
 
     substs {self_r:self_r, self_ty:self_ty, tps:tps}
 }
@@ -377,7 +377,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + 'static>(
                    |tmt| ty::mk_rptr(tcx, r, tmt))
       }
       ast::ty_tup(ref fields) => {
-        let flds = fields.map(|t| ast_ty_to_ty(this, rscope, *t));
+        let flds = fields.map(|t| ast_ty_to_ty(this, rscope, t));
         ty::mk_tup(tcx, flds)
       }
       ast::ty_bare_fn(ref bf) => {
@@ -525,13 +525,13 @@ pub fn ty_of_arg<AC:AstConv,
                  RS:region_scope + Copy + 'static>(
                  this: &AC,
                  rscope: &RS,
-                 a: ast::arg,
+                 a: &ast::arg,
                  expected_ty: Option<ty::t>)
                  -> ty::t {
     match a.ty.node {
         ast::ty_infer if expected_ty.is_some() => expected_ty.get(),
         ast::ty_infer => this.ty_infer(a.ty.span),
-        _ => ast_ty_to_ty(this, rscope, a.ty),
+        _ => ast_ty_to_ty(this, rscope, &a.ty),
     }
 }
 
@@ -621,11 +621,11 @@ fn ty_of_method_or_bare_fn<AC:AstConv,RS:region_scope + Copy + 'static>(
         transform_self_ty(this, &rb, self_info)
     });
 
-    let input_tys = decl.inputs.map(|a| ty_of_arg(this, &rb, *a, None));
+    let input_tys = decl.inputs.map(|a| ty_of_arg(this, &rb, a, None));
 
     let output_ty = match decl.output.node {
         ast::ty_infer => this.ty_infer(decl.output.span),
-        _ => ast_ty_to_ty(this, &rb, decl.output)
+        _ => ast_ty_to_ty(this, &rb, &decl.output)
     };
 
     return (opt_transformed_self_ty,
@@ -724,14 +724,14 @@ pub fn ty_of_closure<AC:AstConv,RS:region_scope + Copy + 'static>(
             // were supplied
             if i < e.inputs.len() {Some(e.inputs[i])} else {None}
         };
-        ty_of_arg(this, &rb, *a, expected_arg_ty)
+        ty_of_arg(this, &rb, a, expected_arg_ty)
     }.collect();
 
     let expected_ret_ty = expected_sig.map(|e| e.output);
     let output_ty = match decl.output.node {
         ast::ty_infer if expected_ret_ty.is_some() => expected_ret_ty.get(),
         ast::ty_infer => this.ty_infer(decl.output.span),
-        _ => ast_ty_to_ty(this, &rb, decl.output)
+        _ => ast_ty_to_ty(this, &rb, &decl.output)
     };
 
     ty::ClosureTy {
diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs
index cd66c765a2d..51159c0391a 100644
--- a/src/librustc/middle/typeck/check/mod.rs
+++ b/src/librustc/middle/typeck/check/mod.rs
@@ -476,7 +476,7 @@ pub fn check_fn(ccx: @mut CrateCtxt,
                 |local, (e, v)| {
             let o_ty = match local.node.ty.node {
               ast::ty_infer => None,
-              _ => Some(fcx.to_ty(local.node.ty))
+              _ => Some(fcx.to_ty(&local.node.ty))
             };
             assign(local.node.id, o_ty);
             debug!("Local variable %s is assigned type %s",
@@ -624,7 +624,7 @@ pub fn check_item(ccx: @mut CrateCtxt, it: @ast::item) {
       ast::item_struct(*) => {
         check_struct(ccx, it.id, it.span);
       }
-      ast::item_ty(t, ref generics) => {
+      ast::item_ty(ref t, ref generics) => {
         let tpt_ty = ty::node_id_to_type(ccx.tcx, it.id);
         check_bounds_are_used(ccx, t.span, &generics.ty_params, tpt_ty);
       }
@@ -790,7 +790,7 @@ impl FnCtxt {
         self.write_ty(node_id, ty::mk_err());
     }
 
-    pub fn to_ty(&self, ast_t: @ast::Ty) -> ty::t {
+    pub fn to_ty(&self, ast_t: &ast::Ty) -> ty::t {
         ast_ty_to_ty(self, self, ast_t)
     }
 
@@ -1381,7 +1381,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
                          rcvr: @ast::expr,
                          method_name: ast::ident,
                          args: &[@ast::expr],
-                         tps: &[@ast::Ty],
+                         tps: &[ast::Ty],
                          sugar: ast::CallSugar) {
         check_expr(fcx, rcvr);
 
@@ -1390,7 +1390,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
                                                 expr.span,
                                                 fcx.expr_ty(rcvr));
 
-        let tps = tps.map(|ast_ty| fcx.to_ty(*ast_ty));
+        let tps = tps.map(|ast_ty| fcx.to_ty(ast_ty));
         match method::lookup(fcx,
                              expr,
                              rcvr,
@@ -1779,7 +1779,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
                    expr: @ast::expr,
                    base: @ast::expr,
                    field: ast::ident,
-                   tys: &[@ast::Ty]) {
+                   tys: &[ast::Ty]) {
         let tcx = fcx.ccx.tcx;
         let bot = check_expr(fcx, base);
         let expr_t = structurally_resolved_type(fcx, expr.span,
@@ -1809,7 +1809,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
             _ => ()
         }
 
-        let tps = tys.iter().transform(|ty| fcx.to_ty(*ty)).collect::<~[ty::t]>();
+        let tps : ~[ty::t] = tys.iter().transform(|ty| fcx.to_ty(ty)).collect();
         match method::lookup(fcx,
                              expr,
                              base,
@@ -2622,7 +2622,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
             fcx.write_bot(id);
         }
       }
-      ast::expr_cast(e, t) => {
+      ast::expr_cast(e, ref t) => {
         check_expr(fcx, e);
         let t_1 = fcx.to_ty(t);
         let t_e = fcx.expr_ty(e);
@@ -3336,7 +3336,7 @@ pub fn instantiate_path(fcx: @mut FnCtxt,
             (span, "not enough type parameters provided for this item");
         fcx.infcx().next_ty_vars(ty_param_count)
     } else {
-        pth.types.map(|aty| fcx.to_ty(*aty))
+        pth.types.map(|aty| fcx.to_ty(aty))
     };
 
     let substs = substs { self_r: self_r, self_ty: None, tps: tps };
diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs
index aef0e4b200b..473d5b8e6e8 100644
--- a/src/librustc/middle/typeck/coherence.rs
+++ b/src/librustc/middle/typeck/coherence.rs
@@ -638,7 +638,7 @@ impl CoherenceChecker {
                         // Then visit the module items.
                         visit_mod(module_, item.span, item.id, ((), visitor));
                     }
-                    item_impl(_, None, ast_ty, _) => {
+                    item_impl(_, None, ref ast_ty, _) => {
                         if !self.ast_type_is_defined_in_local_crate(ast_ty) {
                             // This is an error.
                             let session = self.crate_context.tcx.sess;
@@ -725,7 +725,7 @@ impl CoherenceChecker {
     /// For coherence, when we have `impl Type`, we need to guarantee that
     /// `Type` is "local" to the crate. For our purposes, this means that it
     /// must precisely name some nominal type defined in this crate.
-    pub fn ast_type_is_defined_in_local_crate(&self, original_type: @ast::Ty)
+    pub fn ast_type_is_defined_in_local_crate(&self, original_type: &ast::Ty)
                                               -> bool {
         match original_type.node {
             ty_path(_, _, path_id) => {
diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs
index edd90be2647..fb88f198231 100644
--- a/src/librustc/middle/typeck/collect.rs
+++ b/src/librustc/middle/typeck/collect.rs
@@ -148,7 +148,7 @@ pub fn get_enum_variant_types(ccx: &CrateCtxt,
         match variant.node.kind {
             ast::tuple_variant_kind(ref args) if args.len() > 0 => {
                 let rs = type_rscope(region_parameterization);
-                let input_tys = args.map(|va| ccx.to_ty(&rs, va.ty));
+                let input_tys = args.map(|va| ccx.to_ty(&rs, &va.ty));
                 result_ty = Some(ty::mk_ctor_fn(tcx, input_tys, enum_ty));
             }
 
@@ -684,7 +684,7 @@ pub fn convert_field(ccx: &CrateCtxt,
                      generics: &ast::Generics) {
     let region_parameterization =
         RegionParameterization::from_variance_and_generics(rp, generics);
-    let tt = ccx.to_ty(&type_rscope(region_parameterization), v.node.ty);
+    let tt = ccx.to_ty(&type_rscope(region_parameterization), &v.node.ty);
     write_ty_to_tcx(ccx.tcx, v.node.id, tt);
     /* add the field to the tcache */
     ccx.tcx.tcache.insert(local_def(v.node.id),
@@ -813,7 +813,7 @@ pub fn convert(ccx: &CrateCtxt, it: &ast::item) {
                                generics,
                                rp);
       }
-      ast::item_impl(ref generics, ref opt_trait_ref, selfty, ref ms) => {
+      ast::item_impl(ref generics, ref opt_trait_ref, ref selfty, ref ms) => {
         let i_ty_generics = ty_generics(ccx, rp, generics, 0);
         let region_parameterization =
             RegionParameterization::from_variance_and_generics(rp, generics);
@@ -1031,7 +1031,7 @@ pub fn ty_of_item(ccx: &CrateCtxt, it: &ast::item)
     }
     let rp = tcx.region_paramd_items.find(&it.id).map_consume(|x| *x);
     match it.node {
-      ast::item_static(t, _, _) => {
+      ast::item_static(ref t, _, _) => {
         let typ = ccx.to_ty(&empty_rscope, t);
         let tpt = no_params(typ);
         tcx.tcache.insert(local_def(it.id), tpt);
@@ -1060,7 +1060,7 @@ pub fn ty_of_item(ccx: &CrateCtxt, it: &ast::item)
         ccx.tcx.tcache.insert(local_def(it.id), tpt);
         return tpt;
       }
-      ast::item_ty(t, ref generics) => {
+      ast::item_ty(ref t, ref generics) => {
         match tcx.tcache.find(&local_def(it.id)) {
           Some(&tpt) => return tpt,
           None => { }
@@ -1124,7 +1124,7 @@ pub fn ty_of_foreign_item(ccx: &CrateCtxt,
                                   generics,
                                   abis)
         }
-        ast::foreign_item_static(t, _) => {
+        ast::foreign_item_static(ref t, _) => {
             ty::ty_param_bounds_and_ty {
                 generics: ty::Generics {
                     type_param_defs: @~[],
@@ -1215,8 +1215,8 @@ pub fn ty_of_foreign_fn_decl(ccx: &CrateCtxt,
     let ty_generics = ty_generics(ccx, None, ast_generics, 0);
     let region_param_names = RegionParamNames::from_generics(ast_generics);
     let rb = in_binding_rscope(&empty_rscope, region_param_names);
-    let input_tys = decl.inputs.map(|a| ty_of_arg(ccx, &rb, *a, None) );
-    let output_ty = ast_ty_to_ty(ccx, &rb, decl.output);
+    let input_tys = decl.inputs.map(|a| ty_of_arg(ccx, &rb, a, None) );
+    let output_ty = ast_ty_to_ty(ccx, &rb, &decl.output);
 
     let t_fn = ty::mk_bare_fn(
         ccx.tcx,