summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-07-02 12:47:32 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-07-17 14:57:51 -0700
commit99b33f721954bc5290f9201c8f64003c294d0571 (patch)
tree786c9bf75d54512d0a80f6975ad40516ab432c3a /src/libsyntax/ext
parentb4e674f6e662bc80f2e7a5a1a9834f2152f08d32 (diff)
downloadrust-99b33f721954bc5290f9201c8f64003c294d0571.tar.gz
rust-99b33f721954bc5290f9201c8f64003c294d0571.zip
librustc: Remove all uses of "copy".
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/base.rs4
-rw-r--r--src/libsyntax/ext/build.rs6
-rw-r--r--src/libsyntax/ext/deriving/generic.rs25
-rw-r--r--src/libsyntax/ext/deriving/iter_bytes.rs5
-rw-r--r--src/libsyntax/ext/deriving/rand.rs8
-rw-r--r--src/libsyntax/ext/deriving/zero.rs2
-rw-r--r--src/libsyntax/ext/expand.rs10
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs8
-rw-r--r--src/libsyntax/ext/pipes/mod.rs2
-rw-r--r--src/libsyntax/ext/pipes/parse_proto.rs2
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs18
-rw-r--r--src/libsyntax/ext/pipes/proto.rs6
-rw-r--r--src/libsyntax/ext/quote.rs2
-rw-r--r--src/libsyntax/ext/source_util.rs2
-rw-r--r--src/libsyntax/ext/trace_macros.rs6
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs24
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs13
-rw-r--r--src/libsyntax/ext/tt/transcribe.rs42
18 files changed, 104 insertions, 81 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 0e464208de3..e2f37bd54bd 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -238,7 +238,7 @@ impl ExtCtxt {
 
     pub fn codemap(&self) -> @CodeMap { self.parse_sess.cm }
     pub fn parse_sess(&self) -> @mut parse::ParseSess { self.parse_sess }
-    pub fn cfg(&self) -> ast::crate_cfg { copy self.cfg }
+    pub fn cfg(&self) -> ast::crate_cfg { self.cfg.clone() }
     pub fn call_site(&self) -> span {
         match *self.backtrace {
             Some(@ExpnInfo {call_site: cs, _}) => cs,
@@ -249,7 +249,7 @@ impl ExtCtxt {
     pub fn backtrace(&self) -> Option<@ExpnInfo> { *self.backtrace }
     pub fn mod_push(&self, i: ast::ident) { self.mod_path.push(i); }
     pub fn mod_pop(&self) { self.mod_path.pop(); }
-    pub fn mod_path(&self) -> ~[ast::ident] { copy *self.mod_path }
+    pub fn mod_path(&self) -> ~[ast::ident] { (*self.mod_path).clone() }
     pub fn bt_push(&self, ei: codemap::ExpnInfo) {
         match ei {
             ExpnInfo {call_site: cs, callee: ref callee} => {
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 89290b78b72..334721a38ed 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -351,7 +351,7 @@ impl AstBuilder for @ExtCtxt {
         };
         Generics {
             ty_params: new_params,
-            .. copy *generics
+            .. (*generics).clone()
         }
     }
 
@@ -611,13 +611,13 @@ impl AstBuilder for @ExtCtxt {
     }
     fn lambda0(&self, _span: span, blk: ast::blk) -> @ast::expr {
         let ext_cx = *self;
-        let blk_e = self.expr(blk.span, ast::expr_block(copy blk));
+        let blk_e = self.expr(blk.span, ast::expr_block(blk.clone()));
         quote_expr!(|| $blk_e )
     }
 
     fn lambda1(&self, _span: span, blk: ast::blk, ident: ast::ident) -> @ast::expr {
         let ext_cx = *self;
-        let blk_e = self.expr(blk.span, ast::expr_block(copy blk));
+        let blk_e = self.expr(blk.span, ast::expr_block(blk.clone()));
         quote_expr!(|$ident| $blk_e )
     }
 
diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs
index f90ee1f8d79..a50f4d70f0e 100644
--- a/src/libsyntax/ext/deriving/generic.rs
+++ b/src/libsyntax/ext/deriving/generic.rs
@@ -335,7 +335,7 @@ impl<'self> TraitDef<'self> {
                     cx.typarambound(p.to_path(cx, span, type_ident, generics))
                 });
             // require the current trait
-            bounds.push(cx.typarambound(copy trait_path));
+            bounds.push(cx.typarambound(trait_path.clone()));
 
             trait_generics.ty_params.push(cx.typaram(ty_param.ident, bounds));
         }
@@ -751,7 +751,7 @@ impl<'self> MethodDef<'self> {
                         do self_vec.iter()
                            .zip(enum_matching_fields.iter())
                            .transform |(&(id, self_f), other)| {
-                        (id, self_f, copy *other)
+                        (id, self_f, (*other).clone())
                     }.collect();
                     substructure = EnumMatching(variant_index, variant, field_tuples);
                 }
@@ -789,7 +789,9 @@ impl<'self> MethodDef<'self> {
                                                                     current_match_str,
                                                                     ast::m_imm);
 
-                matches_so_far.push((index, /*bad*/ copy *variant, idents));
+                matches_so_far.push((index,
+                                     /*bad*/ (*variant).clone(),
+                                     idents));
                 let arm_expr = self.build_enum_match(cx, span,
                                                      enum_def,
                                                      type_ident,
@@ -818,7 +820,9 @@ impl<'self> MethodDef<'self> {
                                                                        current_match_str,
                                                                        ast::m_imm);
 
-                    matches_so_far.push((index, /*bad*/ copy *variant, idents));
+                    matches_so_far.push((index,
+                                         /*bad*/ (*variant).clone(),
+                                         idents));
                     let new_matching =
                         match matching {
                             _ if match_count == 0 => Some(index),
@@ -897,7 +901,8 @@ pub fn create_subpatterns(cx: @ExtCtxt,
                           mutbl: ast::mutability)
                    -> ~[@ast::pat] {
     do field_paths.map |path| {
-        cx.pat(span, ast::pat_ident(ast::bind_by_ref(mutbl), copy *path, None))
+        cx.pat(span,
+               ast::pat_ident(ast::bind_by_ref(mutbl), (*path).clone(), None))
     }
 }
 
@@ -944,7 +949,7 @@ fn create_struct_pattern(cx: @ExtCtxt,
         };
         let path = cx.path_ident(span,
                                  cx.ident_of(fmt!("%s_%u", prefix, i)));
-        paths.push(copy path);
+        paths.push(path.clone());
         ident_expr.push((opt_id, cx.expr_path(path)));
     }
 
@@ -990,7 +995,7 @@ fn create_enum_variant_pattern(cx: @ExtCtxt,
                 let path = cx.path_ident(span,
                                          cx.ident_of(fmt!("%s_%u", prefix, i)));
 
-                paths.push(copy path);
+                paths.push(path.clone());
                 ident_expr.push((None, cx.expr_path(path)));
             }
 
@@ -1029,12 +1034,12 @@ pub fn cs_fold(use_foldl: bool,
         EnumMatching(_, _, ref all_fields) | Struct(ref all_fields) => {
             if use_foldl {
                 do all_fields.iter().fold(base) |old, triple| {
-                    let (_, self_f, other_fs) = copy *triple;
+                    let (_, self_f, other_fs) = (*triple).clone();
                     f(cx, span, old, self_f, other_fs)
                 }
             } else {
                 do all_fields.rev_iter().fold(base) |old, triple| {
-                    let (_, self_f, other_fs) = copy *triple;
+                    let (_, self_f, other_fs) = (*triple).clone();
                     f(cx, span, old, self_f, other_fs)
                 }
             }
@@ -1067,7 +1072,7 @@ pub fn cs_same_method(f: &fn(@ExtCtxt, span, ~[@expr]) -> @expr,
         EnumMatching(_, _, ref all_fields) | Struct(ref all_fields) => {
             // call self_n.method(other_1_n, other_2_n, ...)
             let called = do all_fields.map |triple| {
-                let (_, self_field, other_fields) = copy *triple;
+                let (_, self_field, other_fields) = (*triple).clone();
                 cx.expr_method_call(span,
                                     self_field,
                                     substructure.method_ident,
diff --git a/src/libsyntax/ext/deriving/iter_bytes.rs b/src/libsyntax/ext/deriving/iter_bytes.rs
index 15fb6ee9ff7..be13e103a72 100644
--- a/src/libsyntax/ext/deriving/iter_bytes.rs
+++ b/src/libsyntax/ext/deriving/iter_bytes.rs
@@ -56,8 +56,9 @@ fn iter_bytes_substructure(cx: @ExtCtxt, span: span, substr: &Substructure) -> @
     let iter_bytes_ident = substr.method_ident;
     let call_iterbytes = |thing_expr| {
         cx.expr_method_call(span,
-                              thing_expr, iter_bytes_ident,
-                              ~[lsb0, borrowed_f])
+                            thing_expr,
+                            iter_bytes_ident,
+                            ~[lsb0, borrowed_f])
     };
     let mut exprs = ~[];
     let fields;
diff --git a/src/libsyntax/ext/deriving/rand.rs b/src/libsyntax/ext/deriving/rand.rs
index cc2050d9bd7..823f21401ca 100644
--- a/src/libsyntax/ext/deriving/rand.rs
+++ b/src/libsyntax/ext/deriving/rand.rs
@@ -61,7 +61,7 @@ fn rand_substructure(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr {
     ];
     let rand_call = || {
         cx.expr_call_global(span,
-                            copy rand_ident,
+                            rand_ident.clone(),
                             ~[ rng[0].duplicate(cx) ])
     };
 
@@ -79,7 +79,11 @@ fn rand_substructure(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr {
             // need to specify the uint-ness of the random number
             let uint_ty = cx.ty_ident(span, cx.ident_of("uint"));
             let r_ty = cx.ty_ident(span, cx.ident_of("R"));
-            let rand_name = cx.path_all(span, true, copy rand_ident, None, ~[ uint_ty, r_ty ]);
+            let rand_name = cx.path_all(span,
+                                        true,
+                                        rand_ident.clone(),
+                                        None,
+                                        ~[ uint_ty, r_ty ]);
             let rand_name = cx.expr_path(rand_name);
 
             // ::std::rand::Rand::rand::<uint>(rng)
diff --git a/src/libsyntax/ext/deriving/zero.rs b/src/libsyntax/ext/deriving/zero.rs
index 471e7212352..5bee804d582 100644
--- a/src/libsyntax/ext/deriving/zero.rs
+++ b/src/libsyntax/ext/deriving/zero.rs
@@ -63,7 +63,7 @@ fn zero_substructure(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr {
         cx.ident_of("zero")
     ];
     let zero_call = || {
-        cx.expr_call_global(span, copy zero_ident, ~[])
+        cx.expr_call_global(span, zero_ident.clone(), ~[])
     };
 
     return match *substr.fields {
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 3f7579c7691..ba8e3e72933 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -83,7 +83,7 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
 
                             //keep going, outside-in
                             let fully_expanded =
-                                copy fld.fold_expr(expanded).node;
+                                fld.fold_expr(expanded).node.clone();
                             cx.bt_pop();
 
                             (fully_expanded, s)
@@ -208,7 +208,7 @@ pub fn expand_item_mac(extsbox: @mut SyntaxEnv,
                     -> Option<@ast::item> {
     let (pth, tts) = match it.node {
         item_mac(codemap::spanned { node: mac_invoc_tt(ref pth, ref tts), _}) => {
-            (pth, copy *tts)
+            (pth, (*tts).clone())
         }
         _ => cx.span_bug(it.span, "invalid item macro invocation")
     };
@@ -298,7 +298,7 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv,
         stmt_mac(ref mac, semi) => {
             match mac.node {
                 mac_invoc_tt(ref pth, ref tts) => {
-                    (copy *mac, pth, copy *tts, semi)
+                    ((*mac).clone(), pth, (*tts).clone(), semi)
                 }
             }
         }
@@ -337,7 +337,7 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv,
                 Some(stmt) => {
                     let fully_expanded = &stmt.node;
                     cx.bt_pop();
-                    copy *fully_expanded
+                    (*fully_expanded).clone()
                 }
                 None => {
                     cx.span_fatal(pth.span,
@@ -725,7 +725,7 @@ pub fn expand_crate(parse_sess: @mut parse::ParseSess,
     // every method/element of AstFoldFns in fold.rs.
     let extsbox = @mut syntax_expander_table();
     let afp = default_ast_fold();
-    let cx = ExtCtxt::new(parse_sess, copy cfg);
+    let cx = ExtCtxt::new(parse_sess, cfg.clone());
     let f_pre = @AstFoldFns {
         fold_expr: |expr,span,recur|
             expand_expr(extsbox, cx, expr, span, recur, afp.fold_expr),
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs
index a4873e6e34b..eb8b01c427d 100644
--- a/src/libsyntax/ext/pipes/ast_builder.rs
+++ b/src/libsyntax/ext/pipes/ast_builder.rs
@@ -49,15 +49,15 @@ pub trait append_types {
 impl append_types for ast::Path {
     fn add_ty(&self, ty: ast::Ty) -> ast::Path {
         ast::Path {
-            types: vec::append_one(copy self.types, ty),
-            .. copy *self
+            types: vec::append_one(self.types.clone(), ty),
+            .. (*self).clone()
         }
     }
 
     fn add_tys(&self, tys: ~[ast::Ty]) -> ast::Path {
         ast::Path {
-            types: vec::append(copy self.types, tys),
-            .. copy *self
+            types: vec::append(self.types.clone(), tys),
+            .. (*self).clone()
         }
     }
 }
diff --git a/src/libsyntax/ext/pipes/mod.rs b/src/libsyntax/ext/pipes/mod.rs
index 73c6c6d5fff..b8a0da8fe8f 100644
--- a/src/libsyntax/ext/pipes/mod.rs
+++ b/src/libsyntax/ext/pipes/mod.rs
@@ -67,7 +67,7 @@ pub fn expand_proto(cx: @ExtCtxt, _sp: span, id: ast::ident,
     let cfg = cx.cfg();
     let tt_rdr = new_tt_reader(cx.parse_sess().span_diagnostic,
                                None,
-                               copy tt);
+                               tt.clone());
     let rdr = tt_rdr as @reader;
     let rust_parser = Parser(sess, cfg, rdr.dup());
 
diff --git a/src/libsyntax/ext/pipes/parse_proto.rs b/src/libsyntax/ext/pipes/parse_proto.rs
index 21bb8266239..e5219721594 100644
--- a/src/libsyntax/ext/pipes/parse_proto.rs
+++ b/src/libsyntax/ext/pipes/parse_proto.rs
@@ -44,7 +44,7 @@ impl proto_parser for parser::Parser {
         let name = interner_get(id.name);
 
         self.expect(&token::COLON);
-        let dir = match copy *self.token {
+        let dir = match (*self.token).clone() {
             token::IDENT(n, _) => interner_get(n.name),
             _ => fail!()
         };
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index e5581cada37..b046c99d144 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -56,7 +56,8 @@ 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, copy *n, copy *t)).collect();
+                .transform(|(n, t)|
+                    cx.arg(span, (*n).clone(), (*t).clone())).collect();
 
             let pipe_ty = cx.ty_path(
                 path(~[this.data_name()], span)
@@ -117,7 +118,7 @@ impl gen_send for message {
 
             let mut rty = cx.ty_path(path(~[next.data_name()],
                                           span)
-                                     .add_tys(copy next_state.tys), None);
+                                     .add_tys(next_state.tys.clone()), None);
             if try {
                 rty = cx.ty_option(rty);
             }
@@ -137,7 +138,8 @@ 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), copy *t)).collect();
+                    .transform(|(n, t)|
+                        cx.arg(span, cx.ident_of(*n), (*t).clone())).collect();
 
                 let args_ast = vec::append(
                     ~[cx.arg(span,
@@ -152,7 +154,7 @@ impl gen_send for message {
                     ~""
                 }
                 else {
-                    ~"(" + arg_names.map(|x| copy *x).connect(", ") + ")"
+                    ~"(" + arg_names.map(|x| (*x).clone()).connect(", ") + ")"
                 };
 
                 let mut body = ~"{ ";
@@ -209,7 +211,7 @@ impl to_type_decls for state {
         let mut items_msg = ~[];
 
         for self.messages.iter().advance |m| {
-            let message(name, span, tys, this, next) = copy *m;
+            let message(name, span, tys, this, next) = (*m).clone();
 
             let tys = match next {
               Some(ref next_state) => {
@@ -225,7 +227,7 @@ impl to_type_decls for state {
                                 cx.ty_path(
                                     path(~[cx.ident_of(dir),
                                            cx.ident_of(next_name)], span)
-                                    .add_tys(copy next_state.tys), None))
+                                    .add_tys(next_state.tys.clone()), None))
               }
               None => tys
             };
@@ -374,7 +376,7 @@ impl gen_init for protocol {
         for self.states.iter().advance |s| {
             for s.generics.ty_params.iter().advance |tp| {
                 match params.iter().find_(|tpp| tp.ident == tpp.ident) {
-                  None => params.push(copy *tp),
+                  None => params.push((*tp).clone()),
                   _ => ()
                 }
             }
@@ -392,7 +394,7 @@ impl gen_init for protocol {
         let fields = do self.states.iter().transform |s| {
             for s.generics.ty_params.iter().advance |tp| {
                 match params.iter().find_(|tpp| tp.ident == tpp.ident) {
-                  None => params.push(copy *tp),
+                  None => params.push((*tp).clone()),
                   _ => ()
                 }
             }
diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs
index 92e1b2bd09f..c93b89daa40 100644
--- a/src/libsyntax/ext/pipes/proto.rs
+++ b/src/libsyntax/ext/pipes/proto.rs
@@ -35,12 +35,14 @@ impl direction {
     }
 }
 
+#[deriving(Clone)]
 pub struct next_state {
     state: @str,
     tys: ~[ast::Ty],
 }
 
 // name, span, data, current state, next state
+#[deriving(Clone)]
 pub struct message(@str, span, ~[ast::Ty], state, Option<next_state>);
 
 impl message {
@@ -59,7 +61,7 @@ impl message {
     /// Return the type parameters actually used by this message
     pub fn get_generics(&self) -> ast::Generics {
         match *self {
-          message(_, _, _, this, _) => copy this.generics
+          message(_, _, _, this, _) => this.generics.clone()
         }
     }
 }
@@ -216,7 +218,7 @@ pub fn visit<Tproto, Tstate, Tmessage, V: visitor<Tproto, Tstate, Tmessage>>(
 
     let states: ~[Tstate] = do proto.states.iter().transform |&s| {
         let messages: ~[Tmessage] = do s.messages.iter().transform |m| {
-            let message(name, span, tys, this, next) = copy *m;
+            let message(name, span, tys, this, next) = (*m).clone();
             visitor.visit_message(name, span, tys, this, next)
         }.collect();
         visitor.visit_state(s, messages)
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index 3e0e9c93fd0..80e3953da86 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -45,7 +45,7 @@ pub mod rt {
 
     impl ToTokens for ~[token_tree] {
         pub fn to_tokens(&self, _cx: @ExtCtxt) -> ~[token_tree] {
-            copy *self
+            (*self).clone()
         }
     }
 
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index b43536389e2..626a562b92c 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -148,6 +148,6 @@ fn res_rel_file(cx: @ExtCtxt, sp: codemap::span, arg: &Path) -> Path {
         let cu = Path(cx.codemap().span_to_filename(sp));
         cu.dir_path().push_many(arg.components)
     } else {
-        copy *arg
+        (*arg).clone()
     }
 }
diff --git a/src/libsyntax/ext/trace_macros.rs b/src/libsyntax/ext/trace_macros.rs
index 5c6032785e3..f7f17d3ba64 100644
--- a/src/libsyntax/ext/trace_macros.rs
+++ b/src/libsyntax/ext/trace_macros.rs
@@ -26,11 +26,7 @@ pub fn expand_trace_macros(cx: @ExtCtxt,
                                None,
                                tt.to_owned());
     let rdr = tt_rdr as @reader;
-    let rust_parser = Parser(
-        sess,
-        copy cfg,
-        rdr.dup()
-    );
+    let rust_parser = Parser(sess, cfg.clone(), rdr.dup());
 
     if rust_parser.is_keyword(keywords::True) {
         cx.set_trace_macros(true);
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index cddba358373..54ccd489171 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -96,6 +96,7 @@ eof: [a $( a )* a b ยท]
 /* to avoid costly uniqueness checks, we require that `match_seq` always has a
 nonempty body. */
 
+#[deriving(Clone)]
 pub enum matcher_pos_up { /* to break a circularity */
     matcher_pos_up(Option<~MatcherPos>)
 }
@@ -107,6 +108,7 @@ pub fn is_some(mpu: &matcher_pos_up) -> bool {
     }
 }
 
+#[deriving(Clone)]
 pub struct MatcherPos {
     elts: ~[ast::matcher], // maybe should be <'>? Need to understand regions.
     sep: Option<Token>,
@@ -119,7 +121,7 @@ pub struct MatcherPos {
 
 pub fn copy_up(mpu: &matcher_pos_up) -> ~MatcherPos {
     match *mpu {
-      matcher_pos_up(Some(ref mp)) => copy (*mp),
+      matcher_pos_up(Some(ref mp)) => (*mp).clone(),
       _ => fail!()
     }
 }
@@ -279,7 +281,7 @@ pub fn parse(
 
                         // Only touch the binders we have actually bound
                         for uint::range(ei.match_lo, ei.match_hi) |idx| {
-                            let sub = copy ei.matches[idx];
+                            let sub = ei.matches[idx].clone();
                             new_pos.matches[idx]
                                 .push(@matched_seq(sub,
                                                    mk_sp(ei.sp_lo,
@@ -293,10 +295,10 @@ pub fn parse(
                     // can we go around again?
 
                     // the *_t vars are workarounds for the lack of unary move
-                    match copy ei.sep {
+                    match ei.sep {
                       Some(ref t) if idx == len => { // we need a separator
                         if tok == (*t) { //pass the separator
-                            let mut ei_t = ei;
+                            let mut ei_t = ei.clone();
                             ei_t.idx += 1;
                             next_eis.push(ei_t);
                         }
@@ -311,12 +313,12 @@ pub fn parse(
                     eof_eis.push(ei);
                 }
             } else {
-                match copy ei.elts[idx].node {
+                match ei.elts[idx].node.clone() {
                   /* need to descend into sequence */
                   match_seq(ref matchers, ref sep, zero_ok,
                             match_idx_lo, match_idx_hi) => {
                     if zero_ok {
-                        let mut new_ei = copy ei;
+                        let mut new_ei = ei.clone();
                         new_ei.idx += 1u;
                         //we specifically matched zero repeats.
                         for uint::range(match_idx_lo, match_idx_hi) |idx| {
@@ -329,8 +331,8 @@ pub fn parse(
                     let matches = vec::from_elem(ei.matches.len(), ~[]);
                     let ei_t = ei;
                     cur_eis.push(~MatcherPos {
-                        elts: copy *matchers,
-                        sep: copy *sep,
+                        elts: (*matchers).clone(),
+                        sep: (*sep).clone(),
                         idx: 0u,
                         up: matcher_pos_up(Some(ei_t)),
                         matches: matches,
@@ -340,7 +342,7 @@ pub fn parse(
                   }
                   match_nonterminal(_,_,_) => { bb_eis.push(ei) }
                   match_tok(ref t) => {
-                    let mut ei_t = ei;
+                    let mut ei_t = ei.clone();
                     if (*t) == tok {
                         ei_t.idx += 1;
                         next_eis.push(ei_t);
@@ -388,7 +390,7 @@ pub fn parse(
                 }
                 rdr.next_token();
             } else /* bb_eis.len() == 1 */ {
-                let rust_parser = Parser(sess, copy cfg, rdr.dup());
+                let rust_parser = Parser(sess, cfg.clone(), rdr.dup());
 
                 let mut ei = bb_eis.pop();
                 match ei.elts[ei.idx].node {
@@ -426,7 +428,7 @@ pub fn parse_nt(p: &Parser, name: &str) -> nonterminal {
       "ident" => match *p.token {
         token::IDENT(sn,b) => { p.bump(); token::nt_ident(sn,b) }
         _ => p.fatal(~"expected ident, found "
-                     + token::to_str(get_ident_interner(), &copy *p.token))
+                     + token::to_str(get_ident_interner(), p.token))
       },
       "path" => token::nt_path(p.parse_path_with_tps(false)),
       "tt" => {
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index 6b3ce1c9a2f..399a1827c68 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -32,7 +32,10 @@ pub fn add_new_extension(cx: @ExtCtxt,
                       -> base::MacResult {
     // these spans won't matter, anyways
     fn ms(m: matcher_) -> matcher {
-        spanned { node: copy m, span: dummy_sp() }
+        spanned {
+            node: m.clone(),
+            span: dummy_sp()
+        }
     }
 
     let lhs_nm =  gensym_ident("lhs");
@@ -55,7 +58,7 @@ pub fn add_new_extension(cx: @ExtCtxt,
     // Parse the macro_rules! invocation (`none` is for no interpolations):
     let arg_reader = new_tt_reader(cx.parse_sess().span_diagnostic,
                                    None,
-                                   copy arg);
+                                   arg.clone());
     let argument_map = parse_or_else(cx.parse_sess(),
                                      cx.cfg(),
                                      arg_reader as @reader,
@@ -63,12 +66,12 @@ pub fn add_new_extension(cx: @ExtCtxt,
 
     // Extract the arguments:
     let lhses = match *argument_map.get(&lhs_nm) {
-        @matched_seq(ref s, _) => /* FIXME (#2543) */ @copy *s,
+        @matched_seq(ref s, _) => /* FIXME (#2543) */ @(*s).clone(),
         _ => cx.span_bug(sp, "wrong-structured lhs")
     };
 
     let rhses = match *argument_map.get(&rhs_nm) {
-      @matched_seq(ref s, _) => /* FIXME (#2543) */ @copy *s,
+      @matched_seq(ref s, _) => /* FIXME (#2543) */ @(*s).clone(),
       _ => cx.span_bug(sp, "wrong-structured rhs")
     };
 
@@ -132,7 +135,7 @@ pub fn add_new_extension(cx: @ExtCtxt,
                   }
                   failure(sp, ref msg) => if sp.lo >= best_fail_spot.lo {
                     best_fail_spot = sp;
-                    best_fail_msg = copy *msg;
+                    best_fail_msg = (*msg).clone();
                   },
                   error(sp, ref msg) => cx.span_fatal(sp, (*msg))
                 }
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs
index 94ecff178ea..67318c60db9 100644
--- a/src/libsyntax/ext/tt/transcribe.rs
+++ b/src/libsyntax/ext/tt/transcribe.rs
@@ -74,10 +74,10 @@ pub fn new_tt_reader(sp_diag: @span_handler,
 
 fn dup_tt_frame(f: @mut TtFrame) -> @mut TtFrame {
     @mut TtFrame {
-        forest: @mut (copy *f.forest),
+        forest: @mut (*f.forest).clone(),
         idx: f.idx,
         dotdotdoted: f.dotdotdoted,
-        sep: copy f.sep,
+        sep: f.sep.clone(),
         up: match f.up {
             Some(up_frame) => Some(dup_tt_frame(up_frame)),
             None => None
@@ -89,11 +89,11 @@ pub fn dup_tt_reader(r: @mut TtReader) -> @mut TtReader {
     @mut TtReader {
         sp_diag: r.sp_diag,
         stack: dup_tt_frame(r.stack),
-        repeat_idx: copy r.repeat_idx,
-        repeat_len: copy r.repeat_len,
-        cur_tok: copy r.cur_tok,
+        repeat_idx: r.repeat_idx.clone(),
+        repeat_len: r.repeat_len.clone(),
+        cur_tok: r.cur_tok.clone(),
         cur_span: r.cur_span,
-        interpolations: copy r.interpolations,
+        interpolations: r.interpolations.clone(),
     }
 }
 
@@ -122,19 +122,23 @@ fn lookup_cur_matched(r: &mut TtReader, name: ident) -> @named_match {
         }
     }
 }
+
+#[deriving(Clone)]
 enum lis {
-    lis_unconstrained, lis_constraint(uint, ident), lis_contradiction(~str)
+    lis_unconstrained,
+    lis_constraint(uint, ident),
+    lis_contradiction(~str),
 }
 
 fn lockstep_iter_size(t: &token_tree, r: &mut TtReader) -> lis {
     fn lis_merge(lhs: lis, rhs: lis) -> lis {
         match lhs {
-          lis_unconstrained => copy rhs,
-          lis_contradiction(_) => copy lhs,
+          lis_unconstrained => rhs.clone(),
+          lis_contradiction(_) => lhs.clone(),
           lis_constraint(l_len, ref l_id) => match rhs {
-            lis_unconstrained => copy lhs,
-            lis_contradiction(_) => copy rhs,
-            lis_constraint(r_len, _) if l_len == r_len => copy lhs,
+            lis_unconstrained => lhs.clone(),
+            lis_contradiction(_) => rhs.clone(),
+            lis_constraint(r_len, _) if l_len == r_len => lhs.clone(),
             lis_constraint(r_len, ref r_id) => {
                 let l_n = ident_to_str(l_id);
                 let r_n = ident_to_str(r_id);
@@ -163,8 +167,9 @@ fn lockstep_iter_size(t: &token_tree, r: &mut TtReader) -> lis {
 // return the next token from the TtReader.
 // EFFECT: advances the reader's token field
 pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
+    // XXX(pcwalton): Bad copy?
     let ret_val = TokenAndSpan {
-        tok: copy r.cur_tok,
+        tok: r.cur_tok.clone(),
         sp: r.cur_span,
     };
     loop {
@@ -199,7 +204,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
         } else { /* repeat */
             r.stack.idx = 0u;
             r.repeat_idx[r.repeat_idx.len() - 1u] += 1u;
-            match copy r.stack.sep {
+            match r.stack.sep.clone() {
               Some(tk) => {
                 r.cur_tok = tk; /* repeat same span, I guess */
                 return ret_val;
@@ -210,7 +215,8 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
     }
     loop { /* because it's easiest, this handles `tt_delim` not starting
     with a `tt_tok`, even though it won't happen */
-        match copy r.stack.forest[r.stack.idx] {
+        // XXX(pcwalton): Bad copy.
+        match r.stack.forest[r.stack.idx].clone() {
           tt_delim(tts) => {
             r.stack = @mut TtFrame {
                 forest: @mut tts,
@@ -228,7 +234,8 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
             return ret_val;
           }
           tt_seq(sp, tts, sep, zerok) => {
-            let t = tt_seq(sp, copy tts, copy sep, zerok);
+            // XXX(pcwalton): Bad copy.
+            let t = tt_seq(sp, tts.clone(), sep.clone(), zerok);
             match lockstep_iter_size(&t, r) {
               lis_unconstrained => {
                 r.sp_diag.span_fatal(
@@ -278,8 +285,9 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
                 return ret_val;
               }
               matched_nonterminal(ref other_whole_nt) => {
+                // XXX(pcwalton): Bad copy.
                 r.cur_span = sp;
-                r.cur_tok = INTERPOLATED(copy *other_whole_nt);
+                r.cur_tok = INTERPOLATED((*other_whole_nt).clone());
                 r.stack.idx += 1u;
                 return ret_val;
               }