about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs6
-rw-r--r--src/libsyntax/ast_util.rs2
-rw-r--r--src/libsyntax/ext/build.rs6
-rw-r--r--src/libsyntax/ext/log_syntax.rs2
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs2
-rw-r--r--src/libsyntax/fold.rs12
-rw-r--r--src/libsyntax/parse/parser.rs8
-rw-r--r--src/libsyntax/print/pprust.rs151
-rw-r--r--src/libsyntax/visit.rs4
9 files changed, 96 insertions, 97 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 9c3111a6918..a222f03820f 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -132,7 +132,7 @@ pub static crate_node_id: node_id = 0;
 // the "special" built-in traits (see middle::lang_items) and
 // detects Copy, Send, Send, and Freeze.
 pub enum TyParamBound {
-    TraitTyParamBound(@trait_ref),
+    TraitTyParamBound(trait_ref),
     RegionTyParamBound
 }
 
@@ -1002,9 +1002,9 @@ pub enum item_ {
     item_ty(@Ty, Generics),
     item_enum(enum_def, Generics),
     item_struct(@struct_def, Generics),
-    item_trait(Generics, ~[@trait_ref], ~[trait_method]),
+    item_trait(Generics, ~[trait_ref], ~[trait_method]),
     item_impl(Generics,
-              Option<@trait_ref>, // (optional) trait this impl implements
+              Option<trait_ref>, // (optional) trait this impl implements
               @Ty, // self
               ~[@method]),
     // a macro invocation (which includes macro definition)
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index 35f9782f694..565f181ab85 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -580,7 +580,7 @@ pub fn view_path_id(p: &view_path) -> node_id {
 
 /// Returns true if the given struct def is tuple-like; i.e. that its fields
 /// are unnamed.
-pub fn struct_def_is_tuple_like(struct_def: @ast::struct_def) -> bool {
+pub fn struct_def_is_tuple_like(struct_def: &ast::struct_def) -> bool {
     struct_def.ctor_id.is_some()
 }
 
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 14ecc26a1c2..68b011e4fd7 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -68,7 +68,7 @@ pub trait AstBuilder {
 
     fn typaram(&self, id: ast::ident, bounds: @OptVec<ast::TyParamBound>) -> ast::TyParam;
 
-    fn trait_ref(&self, path: ast::Path) -> @ast::trait_ref;
+    fn trait_ref(&self, path: ast::Path) -> ast::trait_ref;
     fn typarambound(&self, path: ast::Path) -> ast::TyParamBound;
     fn lifetime(&self, span: span, ident: ast::ident) -> ast::Lifetime;
 
@@ -358,8 +358,8 @@ impl AstBuilder for @ExtCtxt {
         }
     }
 
-    fn trait_ref(&self, path: ast::Path) -> @ast::trait_ref {
-        @ast::trait_ref {
+    fn trait_ref(&self, path: ast::Path) -> ast::trait_ref {
+        ast::trait_ref {
             path: path,
             ref_id: self.next_id()
         }
diff --git a/src/libsyntax/ext/log_syntax.rs b/src/libsyntax/ext/log_syntax.rs
index 5b789cbc26c..9e6776363a8 100644
--- a/src/libsyntax/ext/log_syntax.rs
+++ b/src/libsyntax/ext/log_syntax.rs
@@ -26,7 +26,7 @@ pub fn expand_syntax_ext(cx: @ExtCtxt,
     cx.print_backtrace();
     io::stdout().write_line(
         print::pprust::tt_to_str(
-            ast::tt_delim(vec::to_owned(tt)),
+            &ast::tt_delim(vec::to_owned(tt)),
             get_ident_interner()));
 
     //trivial expression
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index 80dd0c7247b..6de504c66fd 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -82,7 +82,7 @@ pub fn add_new_extension(cx: @ExtCtxt,
             io::println(fmt!("%s! { %s }",
                              cx.str_of(name),
                              print::pprust::tt_to_str(
-                                 ast::tt_delim(vec::to_owned(arg)),
+                                 &ast::tt_delim(vec::to_owned(arg)),
                                  get_ident_interner())));
         }
 
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index e9710c9e114..85eb499069b 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -162,7 +162,7 @@ pub fn fold_fn_decl(decl: &ast::fn_decl, fld: @ast_fold) -> ast::fn_decl {
 
 fn fold_ty_param_bound(tpb: &TyParamBound, fld: @ast_fold) -> TyParamBound {
     match *tpb {
-        TraitTyParamBound(ty) => TraitTyParamBound(fold_trait_ref(ty, fld)),
+        TraitTyParamBound(ref ty) => TraitTyParamBound(fold_trait_ref(ty, fld)),
         RegionTyParamBound => RegionTyParamBound
     }
 }
@@ -296,10 +296,10 @@ 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, ifce, ty, ref methods) => {
+        item_impl(ref generics, ref ifce, ty, ref methods) => {
             item_impl(
                 fold_generics(generics, fld),
-                ifce.map(|p| fold_trait_ref(*p, fld)),
+                ifce.map(|p| fold_trait_ref(p, fld)),
                 fld.fold_ty(ty),
                 methods.map(|x| fld.fold_method(*x))
             )
@@ -313,7 +313,7 @@ pub fn noop_fold_item_underscore(i: &item_, fld: @ast_fold) -> item_ {
             };
             item_trait(
                 fold_generics(generics, fld),
-                traits.map(|p| fold_trait_ref(*p, fld)),
+                traits.map(|p| fold_trait_ref(p, fld)),
                 methods
             )
         }
@@ -335,8 +335,8 @@ fn fold_struct_def(struct_def: @ast::struct_def, fld: @ast_fold)
     }
 }
 
-fn fold_trait_ref(p: @trait_ref, fld: @ast_fold) -> @trait_ref {
-    @ast::trait_ref {
+fn fold_trait_ref(p: &trait_ref, fld: @ast_fold) -> trait_ref {
+    ast::trait_ref {
         path: fld.fold_path(&p.path),
         ref_id: fld.new_id(p.ref_id),
     }
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 1959649a865..8f1bffdaa78 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3566,7 +3566,7 @@ impl Parser {
             // New-style trait. Reinterpret the type as a trait.
             let opt_trait_ref = match ty.node {
                 ty_path(ref path, @None, node_id) => {
-                    Some(@trait_ref {
+                    Some(trait_ref {
                         path: /* bad */ copy *path,
                         ref_id: node_id
                     })
@@ -3608,15 +3608,15 @@ impl Parser {
     }
 
     // parse a::B<~str,int>
-    fn parse_trait_ref(&self) -> @trait_ref {
-        @ast::trait_ref {
+    fn parse_trait_ref(&self) -> trait_ref {
+        ast::trait_ref {
             path: self.parse_path_with_tps(false),
             ref_id: self.get_id(),
         }
     }
 
     // parse B + C<~str,int> + D
-    fn parse_trait_ref_list(&self, ket: &token::Token) -> ~[@trait_ref] {
+    fn parse_trait_ref_list(&self, ket: &token::Token) -> ~[trait_ref] {
         self.parse_seq_to_before_end(
             ket,
             seq_sep_trailing_disallowed(token::BINOP(token::PLUS)),
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index d50eb8453d2..d90055caffb 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -34,9 +34,9 @@ use std::uint;
 // The @ps is stored here to prevent recursive type.
 pub enum ann_node<'self> {
     node_block(@ps, &'self ast::blk),
-    node_item(@ps, @ast::item),
-    node_expr(@ps, @ast::expr),
-    node_pat(@ps, @ast::pat),
+    node_item(@ps, &'self ast::item),
+    node_expr(@ps, &'self ast::expr),
+    node_pat(@ps, &'self ast::pat),
 }
 pub struct pp_ann {
     pre: @fn(ann_node),
@@ -106,7 +106,7 @@ pub static default_columns: uint = 78u;
 pub fn print_crate(cm: @CodeMap,
                    intr: @ident_interner,
                    span_diagnostic: @diagnostic::span_handler,
-                   crate: @ast::crate,
+                   crate: &ast::crate,
                    filename: @str,
                    in: @io::Reader,
                    out: @io::Writer,
@@ -136,21 +136,21 @@ pub fn print_crate(cm: @CodeMap,
     print_crate_(s, crate);
 }
 
-pub fn print_crate_(s: @ps, crate: @ast::crate) {
+pub fn print_crate_(s: @ps, crate: &ast::crate) {
     print_mod(s, &crate.node.module, crate.node.attrs);
     print_remaining_comments(s);
     eof(s.s);
 }
 
-pub fn ty_to_str(ty: @ast::Ty, intr: @ident_interner) -> ~str {
+pub fn ty_to_str(ty: &ast::Ty, intr: @ident_interner) -> ~str {
     to_str(ty, print_type, intr)
 }
 
-pub fn pat_to_str(pat: @ast::pat, intr: @ident_interner) -> ~str {
+pub fn pat_to_str(pat: &ast::pat, intr: @ident_interner) -> ~str {
     to_str(pat, print_irrefutable_pat, intr)
 }
 
-pub fn expr_to_str(e: @ast::expr, intr: @ident_interner) -> ~str {
+pub fn expr_to_str(e: &ast::expr, intr: @ident_interner) -> ~str {
     to_str(e, print_expr, intr)
 }
 
@@ -158,19 +158,19 @@ pub fn lifetime_to_str(e: &ast::Lifetime, intr: @ident_interner) -> ~str {
     to_str(e, print_lifetime, intr)
 }
 
-pub fn tt_to_str(tt: ast::token_tree, intr: @ident_interner) -> ~str {
-    to_str(&tt, print_tt, intr)
+pub fn tt_to_str(tt: &ast::token_tree, intr: @ident_interner) -> ~str {
+    to_str(tt, print_tt, intr)
 }
 
 pub fn tts_to_str(tts: &[ast::token_tree], intr: @ident_interner) -> ~str {
-    to_str(tts, print_tts, intr)
+    to_str(&tts, print_tts, intr)
 }
 
 pub fn stmt_to_str(s: &ast::stmt, intr: @ident_interner) -> ~str {
     to_str(s, print_stmt, intr)
 }
 
-pub fn item_to_str(i: @ast::item, intr: @ident_interner) -> ~str {
+pub fn item_to_str(i: &ast::item, intr: @ident_interner) -> ~str {
     to_str(i, print_item, intr)
 }
 
@@ -208,11 +208,11 @@ pub fn block_to_str(blk: &ast::blk, intr: @ident_interner) -> ~str {
     }
 }
 
-pub fn meta_item_to_str(mi: @ast::meta_item, intr: @ident_interner) -> ~str {
+pub fn meta_item_to_str(mi: &ast::meta_item, intr: @ident_interner) -> ~str {
     to_str(mi, print_meta_item, intr)
 }
 
-pub fn attribute_to_str(attr: ast::attribute, intr: @ident_interner) -> ~str {
+pub fn attribute_to_str(attr: &ast::attribute, intr: @ident_interner) -> ~str {
     to_str(attr, print_attribute, intr)
 }
 
@@ -314,30 +314,30 @@ pub fn synth_comment(s: @ps, text: ~str) {
     word(s.s, "*/");
 }
 
-pub fn commasep<IN: Copy>(s: @ps, b: breaks, elts: &[IN], op: &fn(@ps, IN)) {
+pub fn commasep<T>(s: @ps, b: breaks, elts: &[T], op: &fn(@ps, &T)) {
     box(s, 0u, b);
     let mut first = true;
     for elts.iter().advance |elt| {
         if first { first = false; } else { word_space(s, ","); }
-        op(s, copy *elt);
+        op(s, elt);
     }
     end(s);
 }
 
 
-pub fn commasep_cmnt<IN: Copy>(s: @ps, b: breaks, elts: &[IN], op: &fn(@ps, IN),
-                               get_span: &fn(IN) -> codemap::span) {
+pub fn commasep_cmnt<T>(s: @ps, b: breaks, elts: &[T], op: &fn(@ps, &T),
+                               get_span: &fn(&T) -> codemap::span) {
     box(s, 0u, b);
     let len = elts.len();
     let mut i = 0u;
     for elts.iter().advance |elt| {
-        maybe_print_comment(s, get_span(copy *elt).hi);
-        op(s, copy *elt);
+        maybe_print_comment(s, get_span(elt).hi);
+        op(s, elt);
         i += 1u;
         if i < len {
             word(s.s, ",");
-            maybe_print_trailing_comment(s, get_span(copy *elt),
-                                         Some(get_span(copy elts[i]).hi));
+            maybe_print_trailing_comment(s, get_span(elt),
+                                         Some(get_span(&elts[i]).hi));
             space_if_not_bol(s);
         }
     }
@@ -345,8 +345,7 @@ pub fn commasep_cmnt<IN: Copy>(s: @ps, b: breaks, elts: &[IN], op: &fn(@ps, IN),
 }
 
 pub fn commasep_exprs(s: @ps, b: breaks, exprs: &[@ast::expr]) {
-    fn expr_span(expr: @ast::expr) -> codemap::span { return expr.span; }
-    commasep_cmnt(s, b, exprs, print_expr, expr_span);
+    commasep_cmnt(s, b, exprs, |p, &e| print_expr(p, e), |e| e.span);
 }
 
 pub fn print_mod(s: @ps, _mod: &ast::_mod, attrs: &[ast::attribute]) {
@@ -373,7 +372,7 @@ pub fn print_opt_lifetime(s: @ps, lifetime: &Option<ast::Lifetime>) {
     }
 }
 
-pub fn print_type(s: @ps, ty: @ast::Ty) {
+pub fn print_type(s: @ps, ty: &ast::Ty) {
     maybe_print_comment(s, ty.span.lo);
     ibox(s, 0u);
     match ty.node {
@@ -399,7 +398,7 @@ pub fn print_type(s: @ps, ty: @ast::Ty) {
       }
       ast::ty_tup(ref elts) => {
         popen(s);
-        commasep(s, inconsistent, *elts, print_type);
+        commasep(s, inconsistent, *elts, |p, &t| print_type(p, t));
         if elts.len() == 1 {
             word(s.s, ",");
         }
@@ -443,7 +442,7 @@ pub fn print_type(s: @ps, ty: @ast::Ty) {
     end(s);
 }
 
-pub fn print_foreign_item(s: @ps, item: @ast::foreign_item) {
+pub fn print_foreign_item(s: @ps, item: &ast::foreign_item) {
     hardbreak_if_not_bol(s);
     maybe_print_comment(s, item.span.lo);
     print_outer_attributes(s, item.attrs);
@@ -470,7 +469,7 @@ pub fn print_foreign_item(s: @ps, item: @ast::foreign_item) {
     }
 }
 
-pub fn print_item(s: @ps, item: @ast::item) {
+pub fn print_item(s: @ps, item: &ast::item) {
     hardbreak_if_not_bol(s);
     maybe_print_comment(s, item.span.lo);
     print_outer_attributes(s, item.attrs);
@@ -560,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, opt_trait, ty, ref methods) => {
+      ast::item_impl(ref generics, ref opt_trait, ty, ref methods) => {
         head(s, visibility_qualified(item.vis, "impl"));
         if generics.is_parameterized() {
             print_generics(s, generics);
@@ -568,12 +567,12 @@ pub fn print_item(s: @ps, item: @ast::item) {
         }
 
         match opt_trait {
-            Some(t) => {
+            &Some(ref t) => {
                 print_trait_ref(s, t);
                 space(s.s);
                 word_space(s, "for");
             }
-            None => ()
+            &None => ()
         };
 
         print_type(s, ty);
@@ -618,7 +617,7 @@ pub fn print_item(s: @ps, item: @ast::item) {
         print_ident(s, item.ident);
         cbox(s, indent_unit);
         popen(s);
-        print_tts(s, *tts);
+        print_tts(s, &(tts.as_slice()));
         pclose(s);
         end(s);
       }
@@ -681,7 +680,7 @@ pub fn print_visibility(s: @ps, vis: ast::visibility) {
 }
 
 pub fn print_struct(s: @ps,
-                    struct_def: @ast::struct_def,
+                    struct_def: &ast::struct_def,
                     generics: &ast::Generics,
                     ident: ast::ident,
                     span: codemap::span) {
@@ -738,7 +737,7 @@ pub fn print_struct(s: @ps,
 /// expression arguments as expressions). It can be done! I think.
 pub fn print_tt(s: @ps, tt: &ast::token_tree) {
     match *tt {
-      ast::tt_delim(ref tts) => print_tts(s, *tts),
+      ast::tt_delim(ref tts) => print_tts(s, &(tts.as_slice())),
       ast::tt_tok(_, ref tk) => {
           word(s.s, parse::token::to_str(s.intr, tk));
       }
@@ -759,7 +758,7 @@ pub fn print_tt(s: @ps, tt: &ast::token_tree) {
     }
 }
 
-pub fn print_tts(s: @ps, tts: &[ast::token_tree]) {
+pub fn print_tts(s: @ps, tts: & &[ast::token_tree]) {
     ibox(s, 0);
     for tts.iter().enumerate().advance |(i, tt)| {
         if i != 0 {
@@ -777,7 +776,7 @@ pub fn print_variant(s: @ps, v: &ast::variant) {
             print_ident(s, v.node.name);
             if !args.is_empty() {
                 popen(s);
-                fn print_variant_arg(s: @ps, arg: ast::variant_arg) {
+                fn print_variant_arg(s: @ps, arg: &ast::variant_arg) {
                     print_type(s, arg.ty);
                 }
                 commasep(s, consistent, *args, print_variant_arg);
@@ -817,7 +816,7 @@ pub fn print_trait_method(s: @ps, m: &ast::trait_method) {
     }
 }
 
-pub fn print_method(s: @ps, meth: @ast::method) {
+pub fn print_method(s: @ps, meth: &ast::method) {
     hardbreak_if_not_bol(s);
     maybe_print_comment(s, meth.span.lo);
     print_outer_attributes(s, meth.attrs);
@@ -832,7 +831,7 @@ pub fn print_outer_attributes(s: @ps, attrs: &[ast::attribute]) {
     let mut count = 0;
     for attrs.iter().advance |attr| {
         match attr.node.style {
-          ast::attr_outer => { print_attribute(s, *attr); count += 1; }
+          ast::attr_outer => { print_attribute(s, attr); count += 1; }
           _ => {/* fallthrough */ }
         }
     }
@@ -844,7 +843,7 @@ pub fn print_inner_attributes(s: @ps, attrs: &[ast::attribute]) {
     for attrs.iter().advance |attr| {
         match attr.node.style {
           ast::attr_inner => {
-            print_attribute(s, *attr);
+            print_attribute(s, attr);
             if !attr.node.is_sugared_doc {
                 word(s.s, ";");
             }
@@ -856,11 +855,11 @@ pub fn print_inner_attributes(s: @ps, attrs: &[ast::attribute]) {
     if count > 0 { hardbreak_if_not_bol(s); }
 }
 
-pub fn print_attribute(s: @ps, attr: ast::attribute) {
+pub fn print_attribute(s: @ps, attr: &ast::attribute) {
     hardbreak_if_not_bol(s);
     maybe_print_comment(s, attr.span.lo);
     if attr.node.is_sugared_doc {
-        let meta = attr::attr_meta(attr);
+        let meta = attr::attr_meta(*attr);
         let comment = attr::get_meta_item_value_str(meta).get();
         word(s.s, comment);
     } else {
@@ -963,7 +962,7 @@ pub fn print_possibly_embedded_block_(s: @ps,
     (s.ann.post)(ann_node);
 }
 
-pub fn print_if(s: @ps, test: @ast::expr, blk: &ast::blk,
+pub fn print_if(s: @ps, test: &ast::expr, blk: &ast::blk,
                 elseopt: Option<@ast::expr>, chk: bool) {
     head(s, "if");
     if chk { word_nbsp(s, "check"); }
@@ -1009,7 +1008,7 @@ pub fn print_mac(s: @ps, m: &ast::mac) {
         print_path(s, pth, false);
         word(s.s, "!");
         popen(s);
-        print_tts(s, *tts);
+        print_tts(s, &tts.as_slice());
         pclose(s);
       }
     }
@@ -1088,15 +1087,15 @@ pub fn print_call_post(s: @ps,
     }
 }
 
-pub fn print_expr(s: @ps, expr: @ast::expr) {
-    fn print_field(s: @ps, field: ast::field) {
+pub fn print_expr(s: @ps, expr: &ast::expr) {
+    fn print_field(s: @ps, field: &ast::field) {
         ibox(s, indent_unit);
         print_ident(s, field.node.ident);
         word_space(s, ":");
         print_expr(s, field.node.expr);
         end(s);
     }
-    fn get_span(field: ast::field) -> codemap::span { return field.span; }
+    fn get_span(field: &ast::field) -> codemap::span { return field.span; }
 
     maybe_print_comment(s, expr.span.lo);
     ibox(s, indent_unit);
@@ -1173,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, print_type);
+            commasep(s, inconsistent, *tys, |p, &e| print_type(p, e));
             word(s.s, ">");
         }
         print_call_post(s, sugar, &blk, &mut base_args);
@@ -1349,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, print_type);
+            commasep(s, inconsistent, *tys, |p, &e| print_type(p, e));
             word(s.s, ">");
         }
       }
@@ -1434,7 +1433,7 @@ pub fn print_expr(s: @ps, expr: @ast::expr) {
     end(s);
 }
 
-pub fn print_local_decl(s: @ps, loc: @ast::local) {
+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 => (),
@@ -1442,7 +1441,7 @@ pub fn print_local_decl(s: @ps, loc: @ast::local) {
     }
 }
 
-pub fn print_decl(s: @ps, decl: @ast::decl) {
+pub fn print_decl(s: @ps, decl: &ast::decl) {
     maybe_print_comment(s, decl.span.lo);
     match decl.node {
       ast::decl_local(ref loc) => {
@@ -1454,7 +1453,7 @@ pub fn print_decl(s: @ps, decl: @ast::decl) {
             word_nbsp(s, "mut");
         }
 
-        fn print_local(s: @ps, loc: @ast::local) {
+        fn print_local(s: @ps, loc: &ast::local) {
             ibox(s, indent_unit);
             print_local_decl(s, loc);
             end(s);
@@ -1479,7 +1478,7 @@ pub fn print_ident(s: @ps, ident: ast::ident) {
     word(s.s, ident_to_str(&ident));
 }
 
-pub fn print_for_decl(s: @ps, loc: @ast::local, coll: @ast::expr) {
+pub fn print_for_decl(s: @ps, loc: &ast::local, coll: &ast::expr) {
     print_local_decl(s, loc);
     space(s.s);
     word_space(s, "in");
@@ -1511,7 +1510,7 @@ fn print_path_(s: @ps, path: &ast::Path, colons_before_params: bool,
                 }
             }
 
-            commasep(s, inconsistent, path.types, print_type);
+            commasep(s, inconsistent, path.types, |p, &e| print_type(p, e));
 
             word(s.s, ">");
         }
@@ -1527,15 +1526,15 @@ pub fn print_bounded_path(s: @ps, path: &ast::Path,
     print_path_(s, path, false, bounds)
 }
 
-pub fn print_irrefutable_pat(s: @ps, pat: @ast::pat) {
+pub fn print_irrefutable_pat(s: @ps, pat: &ast::pat) {
     print_pat(s, pat, false)
 }
 
-pub fn print_refutable_pat(s: @ps, pat: @ast::pat) {
+pub fn print_refutable_pat(s: @ps, pat: &ast::pat) {
     print_pat(s, pat, true)
 }
 
-pub fn print_pat(s: @ps, pat: @ast::pat, refutable: bool) {
+pub fn print_pat(s: @ps, pat: &ast::pat, refutable: bool) {
     maybe_print_comment(s, pat.span.lo);
     let ann_node = node_pat(s, pat);
     (s.ann.pre)(ann_node);
@@ -1570,7 +1569,7 @@ pub fn print_pat(s: @ps, pat: @ast::pat, refutable: bool) {
             if !args.is_empty() {
               popen(s);
               commasep(s, inconsistent, *args,
-                       |s, p| print_pat(s, p, refutable));
+                       |s, &p| print_pat(s, p, refutable));
               pclose(s);
             } else { }
           }
@@ -1579,14 +1578,14 @@ pub fn print_pat(s: @ps, pat: @ast::pat, refutable: bool) {
       ast::pat_struct(ref path, ref fields, etc) => {
         print_path(s, path, true);
         word(s.s, "{");
-        fn print_field(s: @ps, f: ast::field_pat, refutable: bool) {
+        fn print_field(s: @ps, f: &ast::field_pat, refutable: bool) {
             cbox(s, indent_unit);
             print_ident(s, f.ident);
             word_space(s, ":");
             print_pat(s, f.pat, refutable);
             end(s);
         }
-        fn get_span(f: ast::field_pat) -> codemap::span { return f.pat.span; }
+        fn get_span(f: &ast::field_pat) -> codemap::span { return f.pat.span; }
         commasep_cmnt(s, consistent, *fields,
                       |s, f| print_field(s,f,refutable),
                       get_span);
@@ -1598,7 +1597,7 @@ pub fn print_pat(s: @ps, pat: @ast::pat, refutable: bool) {
       }
       ast::pat_tup(ref elts) => {
         popen(s);
-        commasep(s, inconsistent, *elts, |s, p| print_pat(s, p, refutable));
+        commasep(s, inconsistent, *elts, |s, &p| print_pat(s, p, refutable));
         if elts.len() == 1 {
             word(s.s, ",");
         }
@@ -1625,7 +1624,7 @@ pub fn print_pat(s: @ps, pat: @ast::pat, refutable: bool) {
       }
       ast::pat_vec(ref before, slice, ref after) => {
         word(s.s, "[");
-        do commasep(s, inconsistent, *before) |s, p| {
+        do commasep(s, inconsistent, *before) |s, &p| {
             print_pat(s, p, refutable);
         }
         for slice.iter().advance |&p| {
@@ -1634,7 +1633,7 @@ pub fn print_pat(s: @ps, pat: @ast::pat, refutable: bool) {
             print_pat(s, p, refutable);
             if !after.is_empty() { word_space(s, ","); }
         }
-        do commasep(s, inconsistent, *after) |s, p| {
+        do commasep(s, inconsistent, *after) |s, &p| {
             print_pat(s, p, refutable);
         }
         word(s.s, "]");
@@ -1643,8 +1642,8 @@ pub fn print_pat(s: @ps, pat: @ast::pat, refutable: bool) {
     (s.ann.post)(ann_node);
 }
 
-pub fn explicit_self_to_str(explicit_self: ast::explicit_self_, intr: @ident_interner) -> ~str {
-    to_str(explicit_self, |a, b| { print_explicit_self(a, b); () }, intr)
+pub fn explicit_self_to_str(explicit_self: &ast::explicit_self_, intr: @ident_interner) -> ~str {
+    to_str(explicit_self, |a, &b| { print_explicit_self(a, b); () }, intr)
 }
 
 // Returns whether it printed anything
@@ -1748,7 +1747,7 @@ pub fn print_bounds(s: @ps, bounds: &OptVec<ast::TyParamBound>,
             }
 
             match *bound {
-                TraitTyParamBound(tref) => print_trait_ref(s, tref),
+                TraitTyParamBound(ref tref) => print_trait_ref(s, tref),
                 RegionTyParamBound => word(s.s, "'static"),
             }
         }
@@ -1784,12 +1783,12 @@ pub fn print_generics(s: @ps, generics: &ast::Generics) {
         }
 
         commasep(s, inconsistent, ints,
-                 |s, i| print_item(s, generics, i));
+                 |s, &i| print_item(s, generics, i));
         word(s.s, ">");
     }
 }
 
-pub fn print_meta_item(s: @ps, item: @ast::meta_item) {
+pub fn print_meta_item(s: @ps, item: &ast::meta_item) {
     ibox(s, indent_unit);
     match item.node {
       ast::meta_word(name) => word(s.s, name),
@@ -1804,8 +1803,8 @@ pub fn print_meta_item(s: @ps, item: @ast::meta_item) {
         commasep(
             s,
             consistent,
-            /* FIXME (#2543) */ copy *items,
-            print_meta_item
+            items.as_slice(),
+            |p, &i| print_meta_item(p, i)
         );
         pclose(s);
       }
@@ -1813,7 +1812,7 @@ pub fn print_meta_item(s: @ps, item: @ast::meta_item) {
     end(s);
 }
 
-pub fn print_view_path(s: @ps, vp: @ast::view_path) {
+pub fn print_view_path(s: @ps, vp: &ast::view_path) {
     match vp.node {
       ast::view_path_simple(ident, ref path, _) => {
         if path.idents[path.idents.len()-1u] != ident {
@@ -1841,7 +1840,7 @@ pub fn print_view_path(s: @ps, vp: @ast::view_path) {
 }
 
 pub fn print_view_paths(s: @ps, vps: &[@ast::view_path]) {
-    commasep(s, inconsistent, vps, print_view_path);
+    commasep(s, inconsistent, vps, |p, &vp| print_view_path(p, vp));
 }
 
 pub fn print_view_item(s: @ps, item: &ast::view_item) {
@@ -1855,7 +1854,7 @@ pub fn print_view_item(s: @ps, item: &ast::view_item) {
             print_ident(s, id);
             if !mta.is_empty() {
                 popen(s);
-                commasep(s, consistent, *mta, print_meta_item);
+                commasep(s, consistent, *mta, |p, &i| print_meta_item(p, i));
                 pclose(s);
             }
         }
@@ -2003,7 +2002,7 @@ pub fn print_remaining_comments(s: @ps) {
     }
 }
 
-pub fn print_literal(s: @ps, lit: @ast::lit) {
+pub fn print_literal(s: @ps, lit: &ast::lit) {
     maybe_print_comment(s, lit.span.lo);
     match next_lit(s, lit.span.lo) {
       Some(ref ltrl) => {
@@ -2056,7 +2055,7 @@ pub fn print_literal(s: @ps, lit: @ast::lit) {
     }
 }
 
-pub fn lit_to_str(l: @ast::lit) -> ~str {
+pub fn lit_to_str(l: &ast::lit) -> ~str {
     return to_str(l, print_literal, parse::token::mk_fake_ident_interner());
 }
 
@@ -2139,10 +2138,10 @@ pub fn print_string(s: @ps, st: &str) {
     word(s.s, "\"");
 }
 
-pub fn to_str<T: Copy>(t: T, f: @fn(@ps, T), intr: @ident_interner) -> ~str {
+pub fn to_str<T>(t: &T, f: &fn(@ps, &T), intr: @ident_interner) -> ~str {
     do io::with_str_writer |wr| {
         let s = rust_printer(wr, intr);
-        f(s, copy t);
+        f(s, t);
         eof(s.s);
     }
 }
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index 1e615ccb777..4be9ef13db2 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -183,7 +183,7 @@ pub fn visit_item<E: Copy>(i: &item, (e, v): (E, vt<E>)) {
         }
         item_impl(ref tps, ref traits, ty, ref methods) => {
             (v.visit_generics)(tps, (copy e, v));
-            for traits.iter().advance |&p| {
+            for traits.iter().advance |p| {
                 visit_trait_ref(p, (copy e, v));
             }
             (v.visit_ty)(ty, (copy e, v));
@@ -336,7 +336,7 @@ pub fn visit_ty_param_bounds<E: Copy>(bounds: &OptVec<TyParamBound>,
                                       (e, v): (E, vt<E>)) {
     for bounds.iter().advance |bound| {
         match *bound {
-            TraitTyParamBound(ty) => visit_trait_ref(ty, (copy e, v)),
+            TraitTyParamBound(ref ty) => visit_trait_ref(ty, (copy e, v)),
             RegionTyParamBound => {}
         }
     }