about summary refs log tree commit diff
path: root/src/libsyntax
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/libsyntax
parent46a1f54666dbeb9a926c75b380f62571963cbacc (diff)
downloadrust-47eca2113c5c55a4ffbb8c11a38c8ca7a79a1d72.tar.gz
rust-47eca2113c5c55a4ffbb8c11a38c8ca7a79a1d72.zip
De-share ast::Ty
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs30
-rw-r--r--src/libsyntax/ext/build.rs103
-rw-r--r--src/libsyntax/ext/deriving/generic.rs6
-rw-r--r--src/libsyntax/ext/deriving/ty.rs4
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs8
-rw-r--r--src/libsyntax/ext/pipes/check.rs2
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs12
-rw-r--r--src/libsyntax/ext/pipes/proto.rs10
-rw-r--r--src/libsyntax/ext/quote.rs10
-rw-r--r--src/libsyntax/fold.rs48
-rw-r--r--src/libsyntax/parse/parser.rs34
-rw-r--r--src/libsyntax/parse/token.rs2
-rw-r--r--src/libsyntax/print/pprust.rs40
-rw-r--r--src/libsyntax/visit.rs54
14 files changed, 181 insertions, 182 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index d0c8ff03e38..8c37c1510cf 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -110,7 +110,7 @@ pub struct Path {
     global: bool,
     idents: ~[ident],
     rp: Option<Lifetime>,
-    types: ~[@Ty],
+    types: ~[Ty],
 }
 
 pub type crate_num = int;
@@ -361,7 +361,7 @@ pub enum stmt_ {
 #[deriving(Eq, Encodable, Decodable,IterBytes)]
 pub struct local_ {
     is_mutbl: bool,
-    ty: @Ty,
+    ty: Ty,
     pat: @pat,
     init: Option<@expr>,
     id: node_id,
@@ -429,12 +429,12 @@ pub enum expr_ {
     expr_vstore(@expr, expr_vstore),
     expr_vec(~[@expr], mutability),
     expr_call(@expr, ~[@expr], CallSugar),
-    expr_method_call(node_id, @expr, ident, ~[@Ty], ~[@expr], CallSugar),
+    expr_method_call(node_id, @expr, ident, ~[Ty], ~[@expr], CallSugar),
     expr_tup(~[@expr]),
     expr_binary(node_id, binop, @expr, @expr),
     expr_unary(node_id, unop, @expr),
     expr_lit(@lit),
-    expr_cast(@expr, @Ty),
+    expr_cast(@expr, Ty),
     expr_if(@expr, blk, Option<@expr>),
     expr_while(@expr, blk),
     /* Conditionless loop (can be exited with break, cont, or ret)
@@ -454,7 +454,7 @@ pub enum expr_ {
     expr_copy(@expr),
     expr_assign(@expr, @expr),
     expr_assign_op(node_id, binop, @expr, @expr),
-    expr_field(@expr, ident, ~[@Ty]),
+    expr_field(@expr, ident, ~[Ty]),
     expr_index(node_id, @expr, @expr),
     expr_path(Path),
 
@@ -604,7 +604,7 @@ pub enum lit_ {
 // type structure in middle/ty.rs as well.
 #[deriving(Eq, Encodable, Decodable,IterBytes)]
 pub struct mt {
-    ty: @Ty,
+    ty: ~Ty,
     mutbl: mutability,
 }
 
@@ -733,7 +733,7 @@ pub enum ty_ {
     ty_rptr(Option<Lifetime>, mt),
     ty_closure(@TyClosure),
     ty_bare_fn(@TyBareFn),
-    ty_tup(~[@Ty]),
+    ty_tup(~[Ty]),
     ty_path(Path, Option<OptVec<TyParamBound>>, node_id), // for #7264; see above
     ty_mac(mac),
     // ty_infer means the type should be inferred instead of it having been
@@ -762,7 +762,7 @@ pub struct inline_asm {
 #[deriving(Eq, Encodable, Decodable,IterBytes)]
 pub struct arg {
     is_mutbl: bool,
-    ty: @Ty,
+    ty: Ty,
     pat: @pat,
     id: node_id,
 }
@@ -770,7 +770,7 @@ pub struct arg {
 #[deriving(Eq, Encodable, Decodable,IterBytes)]
 pub struct fn_decl {
     inputs: ~[arg],
-    output: @Ty,
+    output: Ty,
     cf: ret_style,
 }
 
@@ -845,7 +845,7 @@ pub struct foreign_mod {
 
 #[deriving(Eq, Encodable, Decodable,IterBytes)]
 pub struct variant_arg {
-    ty: @Ty,
+    ty: Ty,
     id: node_id,
 }
 
@@ -959,7 +959,7 @@ impl visibility {
 pub struct struct_field_ {
     kind: struct_field_kind,
     id: node_id,
-    ty: @Ty,
+    ty: Ty,
     attrs: ~[attribute],
 }
 
@@ -995,17 +995,17 @@ pub struct item {
 
 #[deriving(Eq, Encodable, Decodable,IterBytes)]
 pub enum item_ {
-    item_static(@Ty, mutability, @expr),
+    item_static(Ty, mutability, @expr),
     item_fn(fn_decl, purity, AbiSet, Generics, blk),
     item_mod(_mod),
     item_foreign_mod(foreign_mod),
-    item_ty(@Ty, Generics),
+    item_ty(Ty, Generics),
     item_enum(enum_def, Generics),
     item_struct(@struct_def, Generics),
     item_trait(Generics, ~[trait_ref], ~[trait_method]),
     item_impl(Generics,
               Option<trait_ref>, // (optional) trait this impl implements
-              @Ty, // self
+              Ty, // self
               ~[@method]),
     // a macro invocation (which includes macro definition)
     item_mac(mac),
@@ -1024,7 +1024,7 @@ pub struct foreign_item {
 #[deriving(Eq, Encodable, Decodable,IterBytes)]
 pub enum foreign_item_ {
     foreign_item_fn(fn_decl, purity, Generics),
-    foreign_item_static(@Ty, /* is_mutbl */ bool),
+    foreign_item_static(Ty, /* is_mutbl */ bool),
 }
 
 // The data we save and restore about an inlined item or method.  This is not
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 0388115d7ef..73220ec2881 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -39,31 +39,30 @@ pub trait AstBuilder {
                 global: bool,
                 idents: ~[ast::ident],
                 rp: Option<ast::Lifetime>,
-                types: ~[@ast::Ty])
+                types: ~[ast::Ty])
         -> ast::Path;
 
     // types
-    fn ty_mt(&self, ty: @ast::Ty, mutbl: ast::mutability) -> ast::mt;
+    fn ty_mt(&self, ty: ast::Ty, mutbl: ast::mutability) -> ast::mt;
 
-    fn ty(&self, span: span, ty: ast::ty_) -> @ast::Ty;
-    fn ty_path(&self, ast::Path, Option<OptVec<ast::TyParamBound>>) -> @ast::Ty;
-    fn ty_ident(&self, span: span, idents: ast::ident) -> @ast::Ty;
+    fn ty(&self, span: span, ty: ast::ty_) -> ast::Ty;
+    fn ty_path(&self, ast::Path, Option<OptVec<ast::TyParamBound>>) -> ast::Ty;
+    fn ty_ident(&self, span: span, idents: ast::ident) -> ast::Ty;
 
     fn ty_rptr(&self, span: span,
-               ty: @ast::Ty,
+               ty: ast::Ty,
                lifetime: Option<ast::Lifetime>,
-               mutbl: ast::mutability)
-        -> @ast::Ty;
-    fn ty_uniq(&self, span: span, ty: @ast::Ty) -> @ast::Ty;
-    fn ty_box(&self, span: span, ty: @ast::Ty, mutbl: ast::mutability) -> @ast::Ty;
+               mutbl: ast::mutability) -> ast::Ty;
+    fn ty_uniq(&self, span: span, ty: ast::Ty) -> ast::Ty;
+    fn ty_box(&self, span: span, ty: ast::Ty, mutbl: ast::mutability) -> ast::Ty;
 
-    fn ty_option(&self, ty: @ast::Ty) -> @ast::Ty;
-    fn ty_infer(&self, sp: span) -> @ast::Ty;
-    fn ty_nil(&self) -> @ast::Ty;
+    fn ty_option(&self, ty: ast::Ty) -> ast::Ty;
+    fn ty_infer(&self, sp: span) -> ast::Ty;
+    fn ty_nil(&self) -> ast::Ty;
 
-    fn ty_vars(&self, ty_params: &OptVec<ast::TyParam>) -> ~[@ast::Ty];
-    fn ty_vars_global(&self, ty_params: &OptVec<ast::TyParam>) -> ~[@ast::Ty];
-    fn ty_field_imm(&self, span: span, name: ident, ty: @ast::Ty) -> ast::ty_field;
+    fn ty_vars(&self, ty_params: &OptVec<ast::TyParam>) -> ~[ast::Ty];
+    fn ty_vars_global(&self, ty_params: &OptVec<ast::TyParam>) -> ~[ast::Ty];
+    fn ty_field_imm(&self, span: span, name: ident, ty: ast::Ty) -> ast::ty_field;
     fn strip_bounds(&self, bounds: &Generics) -> Generics;
 
     fn typaram(&self, id: ast::ident, bounds: OptVec<ast::TyParamBound>) -> ast::TyParam;
@@ -167,25 +166,25 @@ pub trait AstBuilder {
     fn item(&self, span: span,
             name: ident, attrs: ~[ast::attribute], node: ast::item_) -> @ast::item;
 
-    fn arg(&self, span: span, name: ident, ty: @ast::Ty) -> ast::arg;
+    fn arg(&self, span: span, name: ident, ty: ast::Ty) -> ast::arg;
     // XXX unused self
-    fn fn_decl(&self, inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl;
+    fn fn_decl(&self, inputs: ~[ast::arg], output: ast::Ty) -> ast::fn_decl;
 
     fn item_fn_poly(&self,
                     span: span,
                     name: ident,
                     inputs: ~[ast::arg],
-                    output: @ast::Ty,
+                    output: ast::Ty,
                     generics: Generics,
                     body: ast::blk) -> @ast::item;
     fn item_fn(&self,
                span: span,
                name: ident,
                inputs: ~[ast::arg],
-               output: @ast::Ty,
+               output: ast::Ty,
                body: ast::blk) -> @ast::item;
 
-    fn variant(&self, span: span, name: ident, tys: ~[@ast::Ty]) -> ast::variant;
+    fn variant(&self, span: span, name: ident, tys: ~[ast::Ty]) -> ast::variant;
     fn item_enum_poly(&self,
                       span: span,
                       name: ident,
@@ -207,9 +206,9 @@ pub trait AstBuilder {
     fn item_ty_poly(&self,
                     span: span,
                     name: ident,
-                    ty: @ast::Ty,
+                    ty: ast::Ty,
                     generics: Generics) -> @ast::item;
-    fn item_ty(&self, span: span, name: ident, ty: @ast::Ty) -> @ast::item;
+    fn item_ty(&self, span: span, name: ident, ty: ast::Ty) -> @ast::item;
 
     fn attribute(&self, sp: span, mi: @ast::meta_item) -> ast::attribute;
 
@@ -239,7 +238,7 @@ impl AstBuilder for @ExtCtxt {
                 global: bool,
                 idents: ~[ast::ident],
                 rp: Option<ast::Lifetime>,
-                types: ~[@ast::Ty])
+                types: ~[ast::Ty])
         -> ast::Path {
         ast::Path {
             span: sp,
@@ -250,15 +249,15 @@ impl AstBuilder for @ExtCtxt {
         }
     }
 
-    fn ty_mt(&self, ty: @ast::Ty, mutbl: ast::mutability) -> ast::mt {
+    fn ty_mt(&self, ty: ast::Ty, mutbl: ast::mutability) -> ast::mt {
         ast::mt {
-            ty: ty,
+            ty: ~ty,
             mutbl: mutbl
         }
     }
 
-    fn ty(&self, span: span, ty: ast::ty_) -> @ast::Ty {
-        @ast::Ty {
+    fn ty(&self, span: span, ty: ast::ty_) -> ast::Ty {
+        ast::Ty {
             id: self.next_id(),
             span: span,
             node: ty
@@ -266,7 +265,7 @@ impl AstBuilder for @ExtCtxt {
     }
 
     fn ty_path(&self, path: ast::Path, bounds: Option<OptVec<ast::TyParamBound>>)
-              -> @ast::Ty {
+              -> ast::Ty {
         self.ty(path.span,
                 ast::ty_path(path, bounds, self.next_id()))
     }
@@ -274,28 +273,28 @@ impl AstBuilder for @ExtCtxt {
     // Might need to take bounds as an argument in the future, if you ever want
     // to generate a bounded existential trait type.
     fn ty_ident(&self, span: span, ident: ast::ident)
-        -> @ast::Ty {
+        -> ast::Ty {
         self.ty_path(self.path_ident(span, ident), None)
     }
 
     fn ty_rptr(&self,
                span: span,
-               ty: @ast::Ty,
+               ty: ast::Ty,
                lifetime: Option<ast::Lifetime>,
                mutbl: ast::mutability)
-        -> @ast::Ty {
+        -> ast::Ty {
         self.ty(span,
                 ast::ty_rptr(lifetime, self.ty_mt(ty, mutbl)))
     }
-    fn ty_uniq(&self, span: span, ty: @ast::Ty) -> @ast::Ty {
+    fn ty_uniq(&self, span: span, ty: ast::Ty) -> ast::Ty {
         self.ty(span, ast::ty_uniq(self.ty_mt(ty, ast::m_imm)))
     }
     fn ty_box(&self, span: span,
-                 ty: @ast::Ty, mutbl: ast::mutability) -> @ast::Ty {
+                 ty: ast::Ty, mutbl: ast::mutability) -> ast::Ty {
         self.ty(span, ast::ty_box(self.ty_mt(ty, mutbl)))
     }
 
-    fn ty_option(&self, ty: @ast::Ty) -> @ast::Ty {
+    fn ty_option(&self, ty: ast::Ty) -> ast::Ty {
         self.ty_path(
             self.path_all(dummy_sp(),
                           true,
@@ -308,20 +307,20 @@ impl AstBuilder for @ExtCtxt {
                           ~[ ty ]), None)
     }
 
-    fn ty_field_imm(&self, span: span, name: ident, ty: @ast::Ty) -> ast::ty_field {
+    fn ty_field_imm(&self, span: span, name: ident, ty: ast::Ty) -> ast::ty_field {
         respan(span,
                ast::ty_field_ {
                    ident: name,
-                   mt: ast::mt { ty: ty, mutbl: ast::m_imm },
+                   mt: ast::mt { ty: ~ty, mutbl: ast::m_imm },
                })
     }
 
-    fn ty_infer(&self, span: span) -> @ast::Ty {
+    fn ty_infer(&self, span: span) -> ast::Ty {
         self.ty(span, ast::ty_infer)
     }
 
-    fn ty_nil(&self) -> @ast::Ty {
-        @ast::Ty {
+    fn ty_nil(&self) -> ast::Ty {
+        ast::Ty {
             id: self.next_id(),
             node: ast::ty_nil,
             span: dummy_sp(),
@@ -335,12 +334,12 @@ impl AstBuilder for @ExtCtxt {
     // these are strange, and probably shouldn't be used outside of
     // pipes. Specifically, the global version possible generates
     // incorrect code.
-    fn ty_vars(&self, ty_params: &OptVec<ast::TyParam>) -> ~[@ast::Ty] {
+    fn ty_vars(&self, ty_params: &OptVec<ast::TyParam>) -> ~[ast::Ty] {
         opt_vec::take_vec(
             ty_params.map(|p| self.ty_ident(dummy_sp(), p.ident)))
     }
 
-    fn ty_vars_global(&self, ty_params: &OptVec<ast::TyParam>) -> ~[@ast::Ty] {
+    fn ty_vars_global(&self, ty_params: &OptVec<ast::TyParam>) -> ~[ast::Ty] {
         opt_vec::take_vec(
             ty_params.map(|p| self.ty_path(
                 self.path_global(dummy_sp(), ~[p.ident]), None)))
@@ -642,7 +641,7 @@ impl AstBuilder for @ExtCtxt {
         self.lambda1(span, self.blk(span, stmts, None), ident)
     }
 
-    fn arg(&self, span: span, ident: ast::ident, ty: @ast::Ty) -> ast::arg {
+    fn arg(&self, span: span, ident: ast::ident, ty: ast::Ty) -> ast::arg {
         let arg_pat = self.pat_ident(span, ident);
         ast::arg {
             is_mutbl: false,
@@ -653,7 +652,7 @@ impl AstBuilder for @ExtCtxt {
     }
 
     // XXX unused self
-    fn fn_decl(&self, inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl {
+    fn fn_decl(&self, inputs: ~[ast::arg], output: ast::Ty) -> ast::fn_decl {
         ast::fn_decl {
             inputs: inputs,
             output: output,
@@ -677,7 +676,7 @@ impl AstBuilder for @ExtCtxt {
                     span: span,
                     name: ident,
                     inputs: ~[ast::arg],
-                    output: @ast::Ty,
+                    output: ast::Ty,
                     generics: Generics,
                     body: ast::blk) -> @ast::item {
         self.item(span,
@@ -694,7 +693,7 @@ impl AstBuilder for @ExtCtxt {
                span: span,
                name: ident,
                inputs: ~[ast::arg],
-               output: @ast::Ty,
+               output: ast::Ty,
                body: ast::blk
               ) -> @ast::item {
         self.item_fn_poly(
@@ -706,10 +705,10 @@ impl AstBuilder for @ExtCtxt {
             body)
     }
 
-    fn variant(&self, span: span, name: ident, tys: ~[@ast::Ty]) -> ast::variant {
-        let args = do tys.map |ty| {
-            ast::variant_arg { ty: *ty, id: self.next_id() }
-        };
+    fn variant(&self, span: span, name: ident, tys: ~[ast::Ty]) -> ast::variant {
+        let args = tys.consume_iter().transform(|ty| {
+            ast::variant_arg { ty: ty, id: self.next_id() }
+        }).collect();
 
         respan(span,
                ast::variant_ {
@@ -773,12 +772,12 @@ impl AstBuilder for @ExtCtxt {
         )
     }
 
-    fn item_ty_poly(&self, span: span, name: ident, ty: @ast::Ty,
+    fn item_ty_poly(&self, span: span, name: ident, ty: ast::Ty,
                     generics: Generics) -> @ast::item {
         self.item(span, name, ~[], ast::item_ty(ty, generics))
     }
 
-    fn item_ty(&self, span: span, name: ident, ty: @ast::Ty) -> @ast::item {
+    fn item_ty(&self, span: span, name: ident, ty: ast::Ty) -> @ast::item {
         self.item_ty_poly(span, name, ty, ast_util::empty_generics())
     }
 
diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs
index 10282cb6f0a..01769482d08 100644
--- a/src/libsyntax/ext/deriving/generic.rs
+++ b/src/libsyntax/ext/deriving/generic.rs
@@ -456,7 +456,7 @@ impl<'self> MethodDef<'self> {
     }
 
     fn get_ret_ty(&self, cx: @ExtCtxt, span: span,
-                     generics: &Generics, type_ident: ident) -> @ast::Ty {
+                     generics: &Generics, type_ident: ident) -> ast::Ty {
         self.ret_ty.to_ty(cx, span, type_ident, generics)
     }
 
@@ -466,7 +466,7 @@ impl<'self> MethodDef<'self> {
 
     fn split_self_nonself_args(&self, cx: @ExtCtxt, span: span,
                              type_ident: ident, generics: &Generics)
-        -> (ast::explicit_self, ~[@expr], ~[@expr], ~[(ident, @ast::Ty)]) {
+        -> (ast::explicit_self, ~[@expr], ~[@expr], ~[(ident, ast::Ty)]) {
 
         let mut self_args = ~[];
         let mut nonself_args = ~[];
@@ -514,7 +514,7 @@ impl<'self> MethodDef<'self> {
                      type_ident: ident,
                      generics: &Generics,
                      explicit_self: ast::explicit_self,
-                     arg_types: ~[(ident, @ast::Ty)],
+                     arg_types: ~[(ident, ast::Ty)],
                      body: @expr) -> @ast::method {
         // create the generics that aren't for Self
         let fn_generics = self.generics.to_generics(cx, span, type_ident, generics);
diff --git a/src/libsyntax/ext/deriving/ty.rs b/src/libsyntax/ext/deriving/ty.rs
index c820371714b..255bc6c9877 100644
--- a/src/libsyntax/ext/deriving/ty.rs
+++ b/src/libsyntax/ext/deriving/ty.rs
@@ -61,7 +61,7 @@ impl<'self> Path<'self> {
                  span: span,
                  self_ty: ident,
                  self_generics: &Generics)
-                 -> @ast::Ty {
+                 -> ast::Ty {
         cx.ty_path(self.to_path(cx, span, self_ty, self_generics), None)
     }
     pub fn to_path(&self,
@@ -122,7 +122,7 @@ impl<'self> Ty<'self> {
                  span: span,
                  self_ty: ident,
                  self_generics: &Generics)
-                 -> @ast::Ty {
+                 -> ast::Ty {
         match *self {
             Ptr(ref ty, ref ptr) => {
                 let raw_ty = ty.to_ty(cx, span, self_ty, self_generics);
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs
index 58838b0c40b..a4873e6e34b 100644
--- a/src/libsyntax/ext/pipes/ast_builder.rs
+++ b/src/libsyntax/ext/pipes/ast_builder.rs
@@ -42,19 +42,19 @@ pub fn path_global(ids: ~[ident], span: span) -> ast::Path {
 }
 
 pub trait append_types {
-    fn add_ty(&self, ty: @ast::Ty) -> ast::Path;
-    fn add_tys(&self, tys: ~[@ast::Ty]) -> ast::Path;
+    fn add_ty(&self, ty: ast::Ty) -> ast::Path;
+    fn add_tys(&self, tys: ~[ast::Ty]) -> ast::Path;
 }
 
 impl append_types for ast::Path {
-    fn add_ty(&self, ty: @ast::Ty) -> ast::Path {
+    fn add_ty(&self, ty: ast::Ty) -> ast::Path {
         ast::Path {
             types: vec::append_one(copy self.types, ty),
             .. copy *self
         }
     }
 
-    fn add_tys(&self, tys: ~[@ast::Ty]) -> ast::Path {
+    fn add_tys(&self, tys: ~[ast::Ty]) -> ast::Path {
         ast::Path {
             types: vec::append(copy self.types, tys),
             .. copy *self
diff --git a/src/libsyntax/ext/pipes/check.rs b/src/libsyntax/ext/pipes/check.rs
index 8c2898737a3..adf10215cb5 100644
--- a/src/libsyntax/ext/pipes/check.rs
+++ b/src/libsyntax/ext/pipes/check.rs
@@ -49,7 +49,7 @@ impl proto::visitor<(), (), ()> for @ExtCtxt {
         }
     }
 
-    fn visit_message(&self, name: @str, _span: span, _tys: &[@ast::Ty],
+    fn visit_message(&self, name: @str, _span: span, _tys: &[ast::Ty],
                      this: state, next: Option<next_state>) {
         match next {
           Some(ref next_state) => {
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index 57174f216fe..98fc9aa6178 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -25,7 +25,7 @@ use std::vec;
 
 pub trait gen_send {
     fn gen_send(&mut self, cx: @ExtCtxt, try: bool) -> @ast::item;
-    fn to_ty(&mut self, cx: @ExtCtxt) -> @ast::Ty;
+    fn to_ty(&mut self, cx: @ExtCtxt) -> ast::Ty;
 }
 
 pub trait to_type_decls {
@@ -37,7 +37,7 @@ pub trait to_type_decls {
 pub trait gen_init {
     fn gen_init(&self, cx: @ExtCtxt) -> @ast::item;
     fn compile(&self, cx: @ExtCtxt) -> @ast::item;
-    fn buffer_ty_path(&self, cx: @ExtCtxt) -> @ast::Ty;
+    fn buffer_ty_path(&self, cx: @ExtCtxt) -> ast::Ty;
     fn gen_buffer_type(&self, cx: @ExtCtxt) -> @ast::item;
     fn gen_buffer_init(&self, ext_cx: @ExtCtxt) -> @ast::expr;
     fn gen_init_bounded(&self, ext_cx: @ExtCtxt) -> @ast::expr;
@@ -56,7 +56,7 @@ impl gen_send for message {
                 next.generics.ty_params.len());
             let arg_names = vec::from_fn(tys.len(), |i| cx.ident_of("x_"+i.to_str()));
             let args_ast: ~[ast::arg] = arg_names.iter().zip(tys.iter())
-                .transform(|(n, t)| cx.arg(span, *n, *t)).collect();
+                .transform(|(n, t)| cx.arg(span, copy *n, copy *t)).collect();
 
             let pipe_ty = cx.ty_path(
                 path(~[this.data_name()], span)
@@ -137,7 +137,7 @@ impl gen_send for message {
                 let arg_names = vec::from_fn(tys.len(), |i| "x_" + i.to_str());
 
                 let args_ast: ~[ast::arg] = arg_names.iter().zip(tys.iter())
-                    .transform(|(n, t)| cx.arg(span, cx.ident_of(*n), *t)).collect();
+                    .transform(|(&n, t)| cx.arg(span, cx.ident_of(n), copy *t)).collect();
 
                 let args_ast = vec::append(
                     ~[cx.arg(span,
@@ -189,7 +189,7 @@ impl gen_send for message {
           }
         }
 
-    fn to_ty(&mut self, cx: @ExtCtxt) -> @ast::Ty {
+    fn to_ty(&mut self, cx: @ExtCtxt) -> ast::Ty {
         cx.ty_path(path(~[cx.ident_of(self.name())], self.span())
           .add_tys(cx.ty_vars(&self.get_generics().ty_params)), None)
     }
@@ -369,7 +369,7 @@ impl gen_init for protocol {
         })
     }
 
-    fn buffer_ty_path(&self, cx: @ExtCtxt) -> @ast::Ty {
+    fn buffer_ty_path(&self, cx: @ExtCtxt) -> ast::Ty {
         let mut params: OptVec<ast::TyParam> = opt_vec::Empty;
         for self.states.iter().advance |s| {
             for s.generics.ty_params.iter().advance |tp| {
diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs
index f3d7158de52..2fe8456c274 100644
--- a/src/libsyntax/ext/pipes/proto.rs
+++ b/src/libsyntax/ext/pipes/proto.rs
@@ -37,11 +37,11 @@ impl direction {
 
 pub struct next_state {
     state: @str,
-    tys: ~[@ast::Ty],
+    tys: ~[ast::Ty],
 }
 
 // name, span, data, current state, next state
-pub struct message(@str, span, ~[@ast::Ty], state, Option<next_state>);
+pub struct message(@str, span, ~[ast::Ty], state, Option<next_state>);
 
 impl message {
     pub fn name(&mut self) -> @str {
@@ -81,7 +81,7 @@ impl state_ {
     pub fn add_message(@self,
                        name: @str,
                        span: span,
-                       data: ~[@ast::Ty],
+                       data: ~[ast::Ty],
                        next: Option<next_state>) {
         self.messages.push(message(name, span, data, self,
                                    next));
@@ -96,7 +96,7 @@ impl state_ {
     }
 
     /// Returns the type that is used for the messages.
-    pub fn to_ty(&self, cx: @ExtCtxt) -> @ast::Ty {
+    pub fn to_ty(&self, cx: @ExtCtxt) -> ast::Ty {
         cx.ty_path
             (path(~[cx.ident_of(self.name)],self.span).add_tys(
                 cx.ty_vars(&self.generics.ty_params)), None)
@@ -206,7 +206,7 @@ impl protocol_ {
 pub trait visitor<Tproto, Tstate, Tmessage> {
     fn visit_proto(&self, proto: protocol, st: &[Tstate]) -> Tproto;
     fn visit_state(&self, state: state, m: &[Tmessage]) -> Tstate;
-    fn visit_message(&self, name: @str, spane: span, tys: &[@ast::Ty],
+    fn visit_message(&self, name: @str, spane: span, tys: &[ast::Ty],
                      this: state, next: Option<next_state>) -> Tmessage;
 }
 
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index db1902753a3..c550e3382a2 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -88,13 +88,13 @@ pub mod rt {
         }
     }
 
-    impl ToSource for @ast::Ty {
+    impl ToSource for ast::Ty {
         fn to_source(&self) -> @str {
-            pprust::ty_to_str(*self, get_ident_interner()).to_managed()
+            pprust::ty_to_str(self, get_ident_interner()).to_managed()
         }
     }
 
-    impl<'self> ToSource for &'self [@ast::Ty] {
+    impl<'self> ToSource for &'self [ast::Ty] {
         fn to_source(&self) -> @str {
             self.map(|i| i.to_source()).connect(", ").to_managed()
         }
@@ -216,13 +216,13 @@ pub mod rt {
         }
     }
 
-    impl ToTokens for @ast::Ty {
+    impl ToTokens for ast::Ty {
         fn to_tokens(&self, cx: @ExtCtxt) -> ~[token_tree] {
             cx.parse_tts(self.to_source())
         }
     }
 
-    impl<'self> ToTokens for &'self [@ast::Ty] {
+    impl<'self> ToTokens for &'self [ast::Ty] {
         fn to_tokens(&self, cx: @ExtCtxt) -> ~[token_tree] {
             cx.parse_tts(self.to_source())
         }
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index c6592d36e40..e2beebcead2 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -28,7 +28,7 @@ pub trait ast_fold {
     fn fold_pat(@self, @pat) -> @pat;
     fn fold_decl(@self, @decl) -> Option<@decl>;
     fn fold_expr(@self, @expr) -> @expr;
-    fn fold_ty(@self, @Ty) -> @Ty;
+    fn fold_ty(@self, &Ty) -> Ty;
     fn fold_mod(@self, &_mod) -> _mod;
     fn fold_foreign_mod(@self, &foreign_mod) -> foreign_mod;
     fn fold_variant(@self, &variant) -> variant;
@@ -107,7 +107,7 @@ fn fold_attribute_(at: attribute, fld: @ast_fold) -> attribute {
 fn fold_arg_(a: arg, fld: @ast_fold) -> arg {
     ast::arg {
         is_mutbl: a.is_mutbl,
-        ty: fld.fold_ty(a.ty),
+        ty: fld.fold_ty(&a.ty),
         pat: fld.fold_pat(a.pat),
         id: fld.new_id(a.id),
     }
@@ -154,8 +154,8 @@ fn maybe_fold_ident(t : &token::Token, fld: @ast_fold) -> token::Token {
 
 pub fn fold_fn_decl(decl: &ast::fn_decl, fld: @ast_fold) -> ast::fn_decl {
     ast::fn_decl {
-        inputs: decl.inputs.map(|x| fold_arg_(*x, fld)),
-        output: fld.fold_ty(decl.output),
+        inputs: decl.inputs.map(|x| fold_arg_(/*bad*/ copy *x, fld)),
+        output: fld.fold_ty(&decl.output),
         cf: decl.cf,
     }
 }
@@ -226,14 +226,14 @@ fn noop_fold_foreign_item(ni: @foreign_item, fld: @ast_fold)
                 foreign_item_fn(ref fdec, purity, ref generics) => {
                     foreign_item_fn(
                         ast::fn_decl {
-                            inputs: fdec.inputs.map(|a| fold_arg(*a)),
-                            output: fld.fold_ty(fdec.output),
+                            inputs: fdec.inputs.map(|a| fold_arg(/*bad*/copy *a)),
+                            output: fld.fold_ty(&fdec.output),
                             cf: fdec.cf,
                         },
                         purity,
                         fold_generics(generics, fld))
                 }
-                foreign_item_static(t, m) => {
+                foreign_item_static(ref t, m) => {
                     foreign_item_static(fld.fold_ty(t), m)
                 }
             },
@@ -260,14 +260,14 @@ fn noop_fold_struct_field(sf: @struct_field, fld: @ast_fold)
 
     @spanned { node: ast::struct_field_ { kind: copy sf.node.kind,
                                           id: sf.node.id,
-                                          ty: fld.fold_ty(sf.node.ty),
+                                          ty: fld.fold_ty(&sf.node.ty),
                                           attrs: sf.node.attrs.map(|e| fold_attribute(*e)) },
                span: sf.span }
 }
 
 pub fn noop_fold_item_underscore(i: &item_, fld: @ast_fold) -> item_ {
     match *i {
-        item_static(t, m, e) => item_static(fld.fold_ty(t), m, fld.fold_expr(e)),
+        item_static(ref t, m, e) => item_static(fld.fold_ty(t), m, fld.fold_expr(e)),
         item_fn(ref decl, purity, abi, ref generics, ref body) => {
             item_fn(
                 fold_fn_decl(decl, fld),
@@ -281,7 +281,7 @@ pub fn noop_fold_item_underscore(i: &item_, fld: @ast_fold) -> item_ {
         item_foreign_mod(ref nm) => {
             item_foreign_mod(fld.fold_foreign_mod(nm))
         }
-        item_ty(t, ref generics) => {
+        item_ty(ref t, ref generics) => {
             item_ty(fld.fold_ty(t), fold_generics(generics, fld))
         }
         item_enum(ref enum_definition, ref generics) => {
@@ -297,7 +297,7 @@ pub fn noop_fold_item_underscore(i: &item_, fld: @ast_fold) -> item_ {
             let struct_def = fold_struct_def(*struct_def, fld);
             item_struct(struct_def, /* FIXME (#2543) */ copy *generics)
         }
-        item_impl(ref generics, ref ifce, ty, ref methods) => {
+        item_impl(ref generics, ref ifce, ref ty, ref methods) => {
             item_impl(
                 fold_generics(generics, fld),
                 ifce.map(|p| fold_trait_ref(p, fld)),
@@ -348,7 +348,7 @@ fn fold_struct_field(f: @struct_field, fld: @ast_fold) -> @struct_field {
         node: ast::struct_field_ {
             kind: copy f.node.kind,
             id: fld.new_id(f.node.id),
-            ty: fld.fold_ty(f.node.ty),
+            ty: fld.fold_ty(&f.node.ty),
             attrs: /* FIXME (#2543) */ copy f.node.attrs,
         },
         span: fld.new_span(f.span),
@@ -518,7 +518,7 @@ pub fn noop_fold_expr(e: &expr_, fld: @ast_fold) -> expr_ {
                 fld.new_id(callee_id),
                 fld.fold_expr(f),
                 fld.fold_ident(i),
-                tps.map(|x| fld.fold_ty(*x)),
+                tps.map(|x| fld.fold_ty(x)),
                 fld.map_exprs(|x| fld.fold_expr(x), *args),
                 blk
             )
@@ -541,7 +541,7 @@ pub fn noop_fold_expr(e: &expr_, fld: @ast_fold) -> expr_ {
         expr_loop_body(f) => expr_loop_body(fld.fold_expr(f)),
         expr_do_body(f) => expr_do_body(fld.fold_expr(f)),
         expr_lit(_) => copy *e,
-        expr_cast(expr, ty) => expr_cast(fld.fold_expr(expr), ty),
+        expr_cast(expr, ref ty) => expr_cast(fld.fold_expr(expr), copy *ty),
         expr_addr_of(m, ohs) => expr_addr_of(m, fld.fold_expr(ohs)),
         expr_if(cond, ref tr, fl) => {
             expr_if(
@@ -587,7 +587,7 @@ pub fn noop_fold_expr(e: &expr_, fld: @ast_fold) -> expr_ {
         expr_field(el, id, ref tys) => {
             expr_field(
                 fld.fold_expr(el), fld.fold_ident(id),
-                tys.map(|x| fld.fold_ty(*x))
+                tys.map(|x| fld.fold_ty(x))
             )
         }
         expr_index(callee_id, el, er) => {
@@ -637,7 +637,7 @@ pub fn noop_fold_ty(t: &ty_, fld: @ast_fold) -> ty_ {
     let fold_mac = |x| fold_mac_(x, fld);
     fn fold_mt(mt: &mt, fld: @ast_fold) -> mt {
         mt {
-            ty: fld.fold_ty(mt.ty),
+            ty: ~fld.fold_ty(mt.ty),
             mutbl: mt.mutbl,
         }
     }
@@ -682,7 +682,7 @@ pub fn noop_fold_ty(t: &ty_, fld: @ast_fold) -> ty_ {
                 decl: fold_fn_decl(&f.decl, fld)
             })
         }
-        ty_tup(ref tys) => ty_tup(tys.map(|ty| fld.fold_ty(*ty))),
+        ty_tup(ref tys) => ty_tup(tys.map(|ty| fld.fold_ty(ty))),
         ty_path(ref path, ref bounds, id) =>
             ty_path(fld.fold_path(path), fold_opt_bounds(bounds, fld), fld.new_id(id)),
         ty_fixed_length_vec(ref mt, e) => {
@@ -714,7 +714,7 @@ fn noop_fold_foreign_mod(nm: &foreign_mod, fld: @ast_fold) -> foreign_mod {
 
 fn noop_fold_variant(v: &variant_, fld: @ast_fold) -> variant_ {
     fn fold_variant_arg_(va: variant_arg, fld: @ast_fold) -> variant_arg {
-        ast::variant_arg { ty: fld.fold_ty(va.ty), id: fld.new_id(va.id) }
+        ast::variant_arg { ty: fld.fold_ty(&va.ty), id: fld.new_id(va.id) }
     }
     let fold_variant_arg = |x| fold_variant_arg_(x, fld);
 
@@ -722,7 +722,7 @@ fn noop_fold_variant(v: &variant_, fld: @ast_fold) -> variant_ {
     match v.kind {
         tuple_variant_kind(ref variant_args) => {
             kind = tuple_variant_kind(do variant_args.map |x| {
-                fold_variant_arg(*x)
+                fold_variant_arg(/*bad*/ copy *x)
             })
         }
         struct_variant_kind(struct_def) => {
@@ -761,14 +761,14 @@ fn noop_fold_path(p: &Path, fld: @ast_fold) -> Path {
         global: p.global,
         idents: p.idents.map(|x| fld.fold_ident(*x)),
         rp: p.rp,
-        types: p.types.map(|x| fld.fold_ty(*x)),
+        types: p.types.map(|x| fld.fold_ty(x)),
     }
 }
 
 fn noop_fold_local(l: &local_, fld: @ast_fold) -> local_ {
     local_ {
         is_mutbl: l.is_mutbl,
-        ty: fld.fold_ty(l.ty),
+        ty: fld.fold_ty(&l.ty),
         pat: fld.fold_pat(l.pat),
         init: l.init.map(|e| fld.fold_expr(*e)),
         id: fld.new_id(l.id),
@@ -838,7 +838,7 @@ impl ast_fold for AstFoldFns {
             node: ast::struct_field_ {
                 kind: copy sf.node.kind,
                 id: sf.node.id,
-                ty: (self as @ast_fold).fold_ty(sf.node.ty),
+                ty: self.fold_ty(&sf.node.ty),
                 attrs: copy sf.node.attrs,
             },
             span: (self.new_span)(sf.span),
@@ -887,9 +887,9 @@ impl ast_fold for AstFoldFns {
             span: (self.new_span)(s),
         }
     }
-    fn fold_ty(@self, x: @Ty) -> @Ty {
+    fn fold_ty(@self, x: &Ty) -> Ty {
         let (n, s) = (self.fold_ty)(&x.node, x.span, self as @ast_fold);
-        @Ty {
+        Ty {
             id: (self.new_id)(x.id),
             node: n,
             span: (self.new_span)(s),
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 4c662cc4621..d18d24c2b90 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -824,7 +824,7 @@ impl Parser {
     // parse a possibly mutable type
     pub fn parse_mt(&self) -> mt {
         let mutbl = self.parse_mutability();
-        let t = self.parse_ty(false);
+        let t = ~self.parse_ty(false);
         mt { ty: t, mutbl: mutbl }
     }
 
@@ -835,7 +835,7 @@ impl Parser {
         let mutbl = self.parse_mutability();
         let id = self.parse_ident();
         self.expect(&token::COLON);
-        let ty = self.parse_ty(false);
+        let ty = ~self.parse_ty(false);
         spanned(
             lo,
             ty.span.hi,
@@ -847,13 +847,13 @@ impl Parser {
     }
 
     // parse optional return type [ -> TY ] in function decl
-    pub fn parse_ret_ty(&self) -> (ret_style, @Ty) {
+    pub fn parse_ret_ty(&self) -> (ret_style, Ty) {
         return if self.eat(&token::RARROW) {
             let lo = self.span.lo;
             if self.eat(&token::NOT) {
                 (
                     noreturn,
-                    @Ty {
+                    Ty {
                         id: self.get_id(),
                         node: ty_bot,
                         span: mk_sp(lo, self.last_span.hi)
@@ -866,7 +866,7 @@ impl Parser {
             let pos = self.span.lo;
             (
                 return_val,
-                @Ty {
+                Ty {
                     id: self.get_id(),
                     node: ty_nil,
                     span: mk_sp(pos, pos),
@@ -878,7 +878,7 @@ impl Parser {
     // parse a type.
     // Useless second parameter for compatibility with quasiquote macros.
     // Bleh!
-    pub fn parse_ty(&self, _: bool) -> @Ty {
+    pub fn parse_ty(&self, _: bool) -> Ty {
         maybe_whole!(self, nt_ty);
 
         let lo = self.span.lo;
@@ -975,7 +975,7 @@ impl Parser {
         };
 
         let sp = mk_sp(lo, self.last_span.hi);
-        @Ty {id: self.get_id(), node: t, span: sp}
+        Ty {id: self.get_id(), node: t, span: sp}
     }
 
     // parse the type following a @ or a ~
@@ -1116,7 +1116,7 @@ impl Parser {
         let t = if self.eat(&token::COLON) {
             self.parse_ty(false)
         } else {
-            @Ty {
+            Ty {
                 id: self.get_id(),
                 node: ty_infer,
                 span: mk_sp(self.span.lo, self.span.hi),
@@ -1463,7 +1463,7 @@ impl Parser {
     pub fn mk_method_call(&self,
                       rcvr: @expr,
                       ident: ident,
-                      tps: ~[@Ty],
+                      tps: ~[Ty],
                       args: ~[@expr],
                       sugar: CallSugar) -> ast::expr_ {
         expr_method_call(self.get_id(), rcvr, ident, tps, args, sugar)
@@ -1473,7 +1473,7 @@ impl Parser {
         expr_index(self.get_id(), expr, idx)
     }
 
-    pub fn mk_field(&self, expr: @expr, ident: ident, tys: ~[@Ty]) -> ast::expr_ {
+    pub fn mk_field(&self, expr: @expr, ident: ident, tys: ~[Ty]) -> ast::expr_ {
         expr_field(expr, ident, tys)
     }
 
@@ -2215,7 +2215,7 @@ impl Parser {
                     // No argument list - `do foo {`
                       ast::fn_decl {
                           inputs: ~[],
-                          output: @Ty {
+                          output: Ty {
                               id: self.get_id(),
                               node: ty_infer,
                               span: *self.span
@@ -2826,7 +2826,7 @@ impl Parser {
             self.obsolete(*self.span, ObsoleteMutWithMultipleBindings)
         }
 
-        let mut ty = @Ty {
+        let mut ty = Ty {
             id: self.get_id(),
             node: ty_infer,
             span: mk_sp(lo, lo),
@@ -3235,7 +3235,7 @@ impl Parser {
 
     // parse a generic use site
     fn parse_generic_values(
-        &self) -> (OptVec<ast::Lifetime>, ~[@Ty])
+        &self) -> (OptVec<ast::Lifetime>, ~[Ty])
     {
         if !self.eat(&token::LT) {
             (opt_vec::Empty, ~[])
@@ -3245,7 +3245,7 @@ impl Parser {
     }
 
     fn parse_generic_values_after_lt(
-        &self) -> (OptVec<ast::Lifetime>, ~[@Ty])
+        &self) -> (OptVec<ast::Lifetime>, ~[Ty])
     {
         let lifetimes = self.parse_lifetimes();
         let result = self.parse_seq_to_gt(
@@ -3455,7 +3455,7 @@ impl Parser {
         let output = if self.eat(&token::RARROW) {
             self.parse_ty(false)
         } else {
-            @Ty { id: self.get_id(), node: ty_infer, span: *self.span }
+            Ty { id: self.get_id(), node: ty_infer, span: *self.span }
         };
 
         ast::fn_decl {
@@ -4155,9 +4155,9 @@ impl Parser {
                     seq_sep_trailing_disallowed(token::COMMA),
                     |p| p.parse_ty(false)
                 );
-                for arg_tys.iter().advance |ty| {
+                for arg_tys.consume_iter().advance |ty| {
                     args.push(ast::variant_arg {
-                        ty: *ty,
+                        ty: ty,
                         id: self.get_id(),
                     });
                 }
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 0264903076b..09d6ecb40fc 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -104,7 +104,7 @@ pub enum nonterminal {
     nt_stmt(@ast::stmt),
     nt_pat( @ast::pat),
     nt_expr(@ast::expr),
-    nt_ty(  @ast::Ty),
+    nt_ty(   ast::Ty),
     nt_ident(ast::ident, bool),
     nt_path( ast::Path),
     nt_tt(  @ast::token_tree), //needs @ed to break a circularity
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index d054f927894..517065ab1b5 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -398,7 +398,7 @@ pub fn print_type(s: @ps, ty: &ast::Ty) {
       }
       ast::ty_tup(ref elts) => {
         popen(s);
-        commasep(s, inconsistent, *elts, |p, &t| print_type(p, t));
+        commasep(s, inconsistent, *elts, print_type);
         if elts.len() == 1 {
             word(s.s, ",");
         }
@@ -454,7 +454,7 @@ pub fn print_foreign_item(s: @ps, item: &ast::foreign_item) {
         word(s.s, ";");
         end(s); // end the outer fn box
       }
-      ast::foreign_item_static(t, m) => {
+      ast::foreign_item_static(ref t, m) => {
         head(s, "static");
         if m {
             word_space(s, "mut");
@@ -476,7 +476,7 @@ pub fn print_item(s: @ps, item: &ast::item) {
     let ann_node = node_item(s, item);
     (s.ann.pre)(ann_node);
     match item.node {
-      ast::item_static(ty, m, expr) => {
+      ast::item_static(ref ty, m, expr) => {
         head(s, visibility_qualified(item.vis, "static"));
         if m == ast::m_mutbl {
             word_space(s, "mut");
@@ -530,7 +530,7 @@ pub fn print_item(s: @ps, item: &ast::item) {
         print_foreign_mod(s, nmod, item.attrs);
         bclose(s, item.span);
       }
-      ast::item_ty(ty, ref params) => {
+      ast::item_ty(ref ty, ref params) => {
         ibox(s, indent_unit);
         ibox(s, 0u);
         word_nbsp(s, visibility_qualified(item.vis, "type"));
@@ -559,7 +559,7 @@ pub fn print_item(s: @ps, item: &ast::item) {
           print_struct(s, struct_def, generics, item.ident, item.span);
       }
 
-      ast::item_impl(ref generics, ref opt_trait, ty, ref methods) => {
+      ast::item_impl(ref generics, ref opt_trait, ref ty, ref methods) => {
         head(s, visibility_qualified(item.vis, "impl"));
         if generics.is_parameterized() {
             print_generics(s, generics);
@@ -694,7 +694,7 @@ pub fn print_struct(s: @ps,
                     ast::named_field(*) => fail!("unexpected named field"),
                     ast::unnamed_field => {
                         maybe_print_comment(s, field.span.lo);
-                        print_type(s, field.node.ty);
+                        print_type(s, &field.node.ty);
                     }
                 }
             }
@@ -718,7 +718,7 @@ pub fn print_struct(s: @ps,
                     print_visibility(s, visibility);
                     print_ident(s, ident);
                     word_nbsp(s, ":");
-                    print_type(s, field.node.ty);
+                    print_type(s, &field.node.ty);
                     word(s.s, ",");
                 }
             }
@@ -777,7 +777,7 @@ pub fn print_variant(s: @ps, v: &ast::variant) {
             if !args.is_empty() {
                 popen(s);
                 fn print_variant_arg(s: @ps, arg: &ast::variant_arg) {
-                    print_type(s, arg.ty);
+                    print_type(s, &arg.ty);
                 }
                 commasep(s, consistent, *args, print_variant_arg);
                 pclose(s);
@@ -1172,7 +1172,7 @@ pub fn print_expr(s: @ps, expr: &ast::expr) {
         print_ident(s, ident);
         if tys.len() > 0u {
             word(s.s, "::<");
-            commasep(s, inconsistent, *tys, |p, &e| print_type(p, e));
+            commasep(s, inconsistent, *tys, print_type);
             word(s.s, ">");
         }
         print_call_post(s, sugar, &blk, &mut base_args);
@@ -1198,7 +1198,7 @@ pub fn print_expr(s: @ps, expr: &ast::expr) {
         print_expr(s, expr);
       }
       ast::expr_lit(lit) => print_literal(s, lit),
-      ast::expr_cast(expr, ty) => {
+      ast::expr_cast(expr, ref ty) => {
         print_expr(s, expr);
         space(s.s);
         word_space(s, "as");
@@ -1348,7 +1348,7 @@ pub fn print_expr(s: @ps, expr: &ast::expr) {
         print_ident(s, id);
         if tys.len() > 0u {
             word(s.s, "::<");
-            commasep(s, inconsistent, *tys, |p, &e| print_type(p, e));
+            commasep(s, inconsistent, *tys, print_type);
             word(s.s, ">");
         }
       }
@@ -1437,7 +1437,7 @@ pub fn print_local_decl(s: @ps, loc: &ast::local) {
     print_irrefutable_pat(s, loc.node.pat);
     match loc.node.ty.node {
       ast::ty_infer => (),
-      _ => { word_space(s, ":"); print_type(s, loc.node.ty); }
+      _ => { word_space(s, ":"); print_type(s, &loc.node.ty); }
     }
 }
 
@@ -1510,7 +1510,7 @@ fn print_path_(s: @ps, path: &ast::Path, colons_before_params: bool,
                 }
             }
 
-            commasep(s, inconsistent, path.types, |p, &e| print_type(p, e));
+            commasep(s, inconsistent, path.types, print_type);
 
             word(s.s, ">");
         }
@@ -1693,7 +1693,7 @@ pub fn print_fn_args(s: @ps, decl: &ast::fn_decl,
 
     for decl.inputs.iter().advance |arg| {
         if first { first = false; } else { word_space(s, ","); }
-        print_arg(s, *arg);
+        print_arg(s, arg);
     }
 
     end(s);
@@ -1711,7 +1711,7 @@ pub fn print_fn_args_and_ret(s: @ps, decl: &ast::fn_decl,
         _ => {
             space_if_not_bol(s);
             word_space(s, "->");
-            print_type(s, decl.output);
+            print_type(s, &decl.output);
         }
     }
 }
@@ -1726,7 +1726,7 @@ pub fn print_fn_block_args(s: @ps, decl: &ast::fn_decl) {
         _ => {
             space_if_not_bol(s);
             word_space(s, "->");
-            print_type(s, decl.output);
+            print_type(s, &decl.output);
         }
     }
 
@@ -1882,7 +1882,7 @@ pub fn print_mt(s: @ps, mt: &ast::mt) {
     print_type(s, mt.ty);
 }
 
-pub fn print_arg(s: @ps, input: ast::arg) {
+pub fn print_arg(s: @ps, input: &ast::arg) {
     ibox(s, indent_unit);
     if input.is_mutbl {
         word_space(s, "mut");
@@ -1902,7 +1902,7 @@ pub fn print_arg(s: @ps, input: ast::arg) {
                 space(s.s);
             }
         }
-        print_type(s, input.ty);
+        print_type(s, &input.ty);
       }
     }
     end(s);
@@ -1944,7 +1944,7 @@ pub fn print_ty_fn(s: @ps,
     }
     for decl.inputs.iter().advance |arg| {
         if first { first = false; } else { word_space(s, ","); }
-        print_arg(s, *arg);
+        print_arg(s, arg);
     }
     end(s);
     pclose(s);
@@ -1958,7 +1958,7 @@ pub fn print_ty_fn(s: @ps,
             ibox(s, indent_unit);
             word_space(s, "->");
             if decl.cf == ast::noreturn { word_nbsp(s, "!"); }
-            else { print_type(s, decl.output); }
+            else { print_type(s, &decl.output); }
             end(s);
         }
     }
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index b513b68b74f..b2d9d49f0ee 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -83,7 +83,7 @@ pub struct Visitor<E> {
     visit_decl: @fn(@decl, (E, vt<E>)),
     visit_expr: @fn(@expr, (E, vt<E>)),
     visit_expr_post: @fn(@expr, (E, vt<E>)),
-    visit_ty: @fn(@Ty, (E, vt<E>)),
+    visit_ty: @fn(&Ty, (E, vt<E>)),
     visit_generics: @fn(&Generics, (E, vt<E>)),
     visit_fn: @fn(&fn_kind, &fn_decl, &blk, span, node_id, (E, vt<E>)),
     visit_ty_method: @fn(&ty_method, (E, vt<E>)),
@@ -131,7 +131,7 @@ pub fn visit_view_item<E>(_vi: &view_item, (_e, _v): (E, vt<E>)) { }
 
 pub fn visit_local<E: Copy>(loc: &local, (e, v): (E, vt<E>)) {
     (v.visit_pat)(loc.node.pat, (copy e, v));
-    (v.visit_ty)(loc.node.ty, (copy e, v));
+    (v.visit_ty)(&loc.node.ty, (copy e, v));
     match loc.node.init {
       None => (),
       Some(ex) => (v.visit_expr)(ex, (e, v))
@@ -144,7 +144,7 @@ fn visit_trait_ref<E: Copy>(tref: &ast::trait_ref, (e, v): (E, vt<E>)) {
 
 pub fn visit_item<E: Copy>(i: &item, (e, v): (E, vt<E>)) {
     match i.node {
-        item_static(t, _, ex) => {
+        item_static(ref t, _, ex) => {
             (v.visit_ty)(t, (copy e, v));
             (v.visit_expr)(ex, (copy e, v));
         }
@@ -169,7 +169,7 @@ pub fn visit_item<E: Copy>(i: &item, (e, v): (E, vt<E>)) {
             for nm.view_items.iter().advance |vi| { (v.visit_view_item)(vi, (copy e, v)); }
             for nm.items.iter().advance |ni| { (v.visit_foreign_item)(*ni, (copy e, v)); }
         }
-        item_ty(t, ref tps) => {
+        item_ty(ref t, ref tps) => {
             (v.visit_ty)(t, (copy e, v));
             (v.visit_generics)(tps, (e, v));
         }
@@ -181,7 +181,7 @@ pub fn visit_item<E: Copy>(i: &item, (e, v): (E, vt<E>)) {
                 (e, v)
             );
         }
-        item_impl(ref tps, ref traits, ty, ref methods) => {
+        item_impl(ref tps, ref traits, ref ty, ref methods) => {
             (v.visit_generics)(tps, (copy e, v));
             for traits.iter().advance |p| {
                 visit_trait_ref(p, (copy e, v));
@@ -213,7 +213,7 @@ pub fn visit_enum_def<E: Copy>(enum_definition: &ast::enum_def,
         match vr.node.kind {
             tuple_variant_kind(ref variant_args) => {
                 for variant_args.iter().advance |va| {
-                    (v.visit_ty)(va.ty, (copy e, v));
+                    (v.visit_ty)(&va.ty, (copy e, v));
                 }
             }
             struct_variant_kind(struct_def) => {
@@ -232,25 +232,25 @@ pub fn skip_ty<E>(_t: &Ty, (_e,_v): (E, vt<E>)) {}
 
 pub fn visit_ty<E: Copy>(t: &Ty, (e, v): (E, vt<E>)) {
     match t.node {
-        ty_box(mt) | ty_uniq(mt) |
-        ty_vec(mt) | ty_ptr(mt) | ty_rptr(_, mt) => {
+        ty_box(ref mt) | ty_uniq(ref mt) |
+        ty_vec(ref mt) | ty_ptr(ref mt) | ty_rptr(_, ref mt) => {
             (v.visit_ty)(mt.ty, (e, v));
         },
         ty_tup(ref ts) => {
             for ts.iter().advance |tt| {
-                (v.visit_ty)(*tt, (copy e, v));
+                (v.visit_ty)(tt, (copy e, v));
             }
         },
         ty_closure(ref f) => {
-            for f.decl.inputs.iter().advance |a| { (v.visit_ty)(a.ty, (copy e, v)); }
-            (v.visit_ty)(f.decl.output, (copy e, v));
+            for f.decl.inputs.iter().advance |a| { (v.visit_ty)(&a.ty, (copy e, v)); }
+            (v.visit_ty)(&f.decl.output, (copy e, v));
             do f.bounds.map |bounds| {
                 visit_ty_param_bounds(bounds, (copy e, v));
             };
         },
         ty_bare_fn(ref f) => {
-            for f.decl.inputs.iter().advance |a| { (v.visit_ty)(a.ty, (copy e, v)); }
-            (v.visit_ty)(f.decl.output, (e, v));
+            for f.decl.inputs.iter().advance |a| { (v.visit_ty)(&a.ty, (copy e, v)); }
+            (v.visit_ty)(&f.decl.output, (e, v));
         },
         ty_path(ref p, ref bounds, _) => {
             visit_path(p, (copy e, v));
@@ -267,7 +267,7 @@ pub fn visit_ty<E: Copy>(t: &Ty, (e, v): (E, vt<E>)) {
 }
 
 pub fn visit_path<E: Copy>(p: &Path, (e, v): (E, vt<E>)) {
-    for p.types.iter().advance |tp| { (v.visit_ty)(*tp, (copy e, v)); }
+    for p.types.iter().advance |tp| { (v.visit_ty)(tp, (copy e, v)); }
 }
 
 pub fn visit_pat<E: Copy>(p: &pat, (e, v): (E, vt<E>)) {
@@ -326,7 +326,7 @@ pub fn visit_foreign_item<E: Copy>(ni: &foreign_item, (e, v): (E, vt<E>)) {
             visit_fn_decl(fd, (copy e, v));
             (v.visit_generics)(generics, (e, v));
         }
-        foreign_item_static(t, _) => {
+        foreign_item_static(ref t, _) => {
             (v.visit_ty)(t, (e, v));
         }
     }
@@ -351,9 +351,9 @@ pub fn visit_generics<E: Copy>(generics: &Generics, (e, v): (E, vt<E>)) {
 pub fn visit_fn_decl<E: Copy>(fd: &fn_decl, (e, v): (E, vt<E>)) {
     for fd.inputs.iter().advance |a| {
         (v.visit_pat)(a.pat, (copy e, v));
-        (v.visit_ty)(a.ty, (copy e, v));
+        (v.visit_ty)(&a.ty, (copy e, v));
     }
-    (v.visit_ty)(fd.output, (e, v));
+    (v.visit_ty)(&fd.output, (e, v));
 }
 
 // Note: there is no visit_method() method in the visitor, instead override
@@ -384,9 +384,9 @@ pub fn visit_fn<E: Copy>(fk: &fn_kind, decl: &fn_decl, body: &blk, _sp: span,
 }
 
 pub fn visit_ty_method<E: Copy>(m: &ty_method, (e, v): (E, vt<E>)) {
-    for m.decl.inputs.iter().advance |a| { (v.visit_ty)(a.ty, (copy e, v)); }
+    for m.decl.inputs.iter().advance |a| { (v.visit_ty)(&a.ty, (copy e, v)); }
     (v.visit_generics)(&m.generics, (copy e, v));
-    (v.visit_ty)(m.decl.output, (e, v));
+    (v.visit_ty)(&m.decl.output, (e, v));
 }
 
 pub fn visit_trait_method<E: Copy>(m: &trait_method, (e, v): (E, vt<E>)) {
@@ -409,7 +409,7 @@ pub fn visit_struct_def<E: Copy>(
 }
 
 pub fn visit_struct_field<E: Copy>(sf: &struct_field, (e, v): (E, vt<E>)) {
-    (v.visit_ty)(sf.node.ty, (e, v));
+    (v.visit_ty)(&sf.node.ty, (e, v));
 }
 
 pub fn visit_block<E: Copy>(b: &blk, (e, v): (E, vt<E>)) {
@@ -475,7 +475,7 @@ pub fn visit_expr<E: Copy>(ex: @expr, (e, v): (E, vt<E>)) {
         expr_method_call(_, callee, _, ref tys, ref args, _) => {
             visit_exprs(*args, (copy e, v));
             for tys.iter().advance |tp| {
-                (v.visit_ty)(*tp, (copy e, v));
+                (v.visit_ty)(tp, (copy e, v));
             }
             (v.visit_expr)(callee, (copy e, v));
         }
@@ -486,7 +486,7 @@ pub fn visit_expr<E: Copy>(ex: @expr, (e, v): (E, vt<E>)) {
         expr_addr_of(_, x) | expr_unary(_, _, x) |
         expr_loop_body(x) | expr_do_body(x) => (v.visit_expr)(x, (copy e, v)),
         expr_lit(_) => (),
-        expr_cast(x, t) => {
+        expr_cast(x, ref t) => {
             (v.visit_expr)(x, (copy e, v));
             (v.visit_ty)(t, (copy e, v));
         }
@@ -527,7 +527,7 @@ pub fn visit_expr<E: Copy>(ex: @expr, (e, v): (E, vt<E>)) {
         expr_field(x, _, ref tys) => {
             (v.visit_expr)(x, (copy e, v));
             for tys.iter().advance |tp| {
-                (v.visit_ty)(*tp, (copy e, v));
+                (v.visit_ty)(tp, (copy e, v));
             }
         }
         expr_index(_, a, b) => {
@@ -579,7 +579,7 @@ pub struct SimpleVisitor {
     visit_decl: @fn(@decl),
     visit_expr: @fn(@expr),
     visit_expr_post: @fn(@expr),
-    visit_ty: @fn(@Ty),
+    visit_ty: @fn(&Ty),
     visit_generics: @fn(&Generics),
     visit_fn: @fn(&fn_kind, &fn_decl, &blk, span, node_id),
     visit_ty_method: @fn(&ty_method),
@@ -591,7 +591,7 @@ pub struct SimpleVisitor {
 
 pub type simple_visitor = @SimpleVisitor;
 
-pub fn simple_ignore_ty(_t: @Ty) {}
+pub fn simple_ignore_ty(_t: &Ty) {}
 
 pub fn default_simple_visitor() -> @SimpleVisitor {
     @SimpleVisitor {
@@ -672,7 +672,7 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
     fn v_expr_post(f: @fn(@expr), ex: @expr, (_e, _v): ((), vt<()>)) {
         f(ex);
     }
-    fn v_ty(f: @fn(@Ty), ty: @Ty, (e, v): ((), vt<()>)) {
+    fn v_ty(f: @fn(&Ty), ty: &Ty, (e, v): ((), vt<()>)) {
         f(ty);
         visit_ty(ty, (e, v));
     }
@@ -717,7 +717,7 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> {
         f(fk, decl, body, sp, id);
         visit_fn(fk, decl, body, sp, id, (e, v));
     }
-    let visit_ty: @fn(@Ty, ((), vt<()>)) =
+    let visit_ty: @fn(&Ty, ((), vt<()>)) =
         |a,b| v_ty(v.visit_ty, a, b);
     fn v_struct_field(f: @fn(@struct_field), sf: @struct_field, (e, v): ((), vt<()>)) {
         f(sf);