about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/middle/cfg/construct.rs3
-rw-r--r--src/librustc/middle/const_eval.rs1
-rw-r--r--src/librustc/middle/dataflow.rs1
-rw-r--r--src/librustc/middle/kind.rs11
-rw-r--r--src/librustc/middle/lint.rs30
-rw-r--r--src/librustc/middle/liveness.rs5
-rw-r--r--src/librustc/middle/mem_categorization.rs14
-rw-r--r--src/librustc/middle/moves.rs4
-rw-r--r--src/librustc/middle/trans/expr.rs11
-rw-r--r--src/librustc/middle/trans/type_use.rs2
-rw-r--r--src/librustc/middle/ty.rs1
-rw-r--r--src/librustc/middle/typeck/check/mod.rs4
-rw-r--r--src/librustc/middle/typeck/check/regionck.rs1
-rw-r--r--src/libsyntax/ast.rs1
-rw-r--r--src/libsyntax/ext/build.rs4
-rw-r--r--src/libsyntax/fold.rs1
-rw-r--r--src/libsyntax/parse/obsolete.rs5
-rw-r--r--src/libsyntax/parse/parser.rs13
-rw-r--r--src/libsyntax/parse/token.rs2
-rw-r--r--src/libsyntax/print/pprust.rs1
-rw-r--r--src/libsyntax/visit.rs1
21 files changed, 13 insertions, 103 deletions
diff --git a/src/librustc/middle/cfg/construct.rs b/src/librustc/middle/cfg/construct.rs
index 19debc9c123..eb03d154632 100644
--- a/src/librustc/middle/cfg/construct.rs
+++ b/src/librustc/middle/cfg/construct.rs
@@ -394,7 +394,6 @@ impl CFGBuilder {
             }
 
             ast::expr_addr_of(_, e) |
-            ast::expr_copy(e) |
             ast::expr_loop_body(e) |
             ast::expr_do_body(e) |
             ast::expr_cast(e, _) |
@@ -520,4 +519,4 @@ impl CFGBuilder {
     fn is_method_call(&self, expr: &ast::expr) -> bool {
         self.method_map.contains_key(&expr.id)
     }
-}
\ No newline at end of file
+}
diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs
index 15e61145262..ffec833c2a5 100644
--- a/src/librustc/middle/const_eval.rs
+++ b/src/librustc/middle/const_eval.rs
@@ -90,7 +90,6 @@ pub fn classify(e: &expr,
                 }
               }
 
-              ast::expr_copy(inner) |
               ast::expr_unary(_, _, inner) |
               ast::expr_paren(inner) => {
                 classify(inner, tcx)
diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs
index 62d1b552691..89cf0916a18 100644
--- a/src/librustc/middle/dataflow.rs
+++ b/src/librustc/middle/dataflow.rs
@@ -754,7 +754,6 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
             }
 
             ast::expr_addr_of(_, e) |
-            ast::expr_copy(e) |
             ast::expr_loop_body(e) |
             ast::expr_do_body(e) |
             ast::expr_cast(e, _) |
diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs
index 6d9a15a3c34..95733678021 100644
--- a/src/librustc/middle/kind.rs
+++ b/src/librustc/middle/kind.rs
@@ -298,17 +298,6 @@ pub fn check_expr(e: @expr, (cx, v): (Context, visit::vt<Context>)) {
                 _ => { }
             }
         }
-        expr_copy(expr) => {
-            // Note: This is the only place where we must check whether the
-            // argument is copyable.  This is not because this is the only
-            // kind of expression that may copy things, but rather because all
-            // other copies will have been converted to moves by by the
-            // `moves` pass if the value is not copyable.
-            check_copy(cx,
-                       ty::expr_ty(cx.tcx, expr),
-                       expr.span,
-                       "explicit copy requires a copyable argument");
-        }
         expr_repeat(element, count_expr, _) => {
             let count = ty::eval_repeat_count(&cx.tcx, count_expr);
             if count > 1 {
diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs
index 0e4b2805cce..6d3f50073f2 100644
--- a/src/librustc/middle/lint.rs
+++ b/src/librustc/middle/lint.rs
@@ -83,7 +83,6 @@ pub enum lint {
     type_limits,
     default_methods,
     unused_unsafe,
-    copy_implicitly_copyable,
 
     managed_heap_memory,
     owned_heap_memory,
@@ -260,14 +259,6 @@ static lint_table: &'static [(&'static str, LintSpec)] = &[
         default: warn
     }),
 
-    ("copy_implicitly_copyable",
-     LintSpec {
-        lint: copy_implicitly_copyable,
-        desc: "detect unnecessary uses of `copy` on implicitly copyable \
-               values",
-        default: warn
-    }),
-
     ("unused_variable",
      LintSpec {
         lint: unused_variable,
@@ -947,26 +938,6 @@ fn lint_unused_unsafe() -> visit::vt<@mut Context> {
     })
 }
 
-fn lint_copy_implicitly_copyable() -> visit::vt<@mut Context> {
-    visit::mk_vt(@visit::Visitor {
-        visit_expr: |e, (cx, vt): (@mut Context, visit::vt<@mut Context>)| {
-            match e.node {
-                ast::expr_copy(subexpr) => {
-                    let ty = ty::expr_ty(cx.tcx, subexpr);
-                    if !ty::type_moves_by_default(cx.tcx, ty) {
-                        cx.span_lint(copy_implicitly_copyable,
-                                     e.span,
-                                     "unnecessary `copy`; this value is implicitly copyable");
-                    }
-                }
-                _ => ()
-            }
-            visit::visit_expr(e, (cx, vt));
-        },
-        .. *visit::default_visitor()
-    })
-}
-
 fn lint_unused_mut() -> visit::vt<@mut Context> {
     fn check_pat(cx: &Context, p: @ast::pat) {
         let mut used = false;
@@ -1179,7 +1150,6 @@ pub fn check_crate(tcx: ty::ctxt, crate: @ast::crate) {
     cx.add_lint(lint_heap());
     cx.add_lint(lint_type_limits());
     cx.add_lint(lint_unused_unsafe());
-    cx.add_lint(lint_copy_implicitly_copyable());
     cx.add_lint(lint_unused_mut());
     cx.add_lint(lint_session());
     cx.add_lint(lint_unnecessary_allocations());
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index 689a4931b37..1116ae0fd25 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -511,7 +511,7 @@ fn visit_expr(expr: @expr, (this, vt): (@mut IrMaps, vt<@mut IrMaps>)) {
       // otherwise, live nodes are not required:
       expr_index(*) | expr_field(*) | expr_vstore(*) | expr_vec(*) |
       expr_call(*) | expr_method_call(*) | expr_tup(*) | expr_log(*) |
-      expr_binary(*) | expr_addr_of(*) | expr_copy(*) | expr_loop_body(*) |
+      expr_binary(*) | expr_addr_of(*) | expr_loop_body(*) |
       expr_do_body(*) | expr_cast(*) | expr_unary(*) | expr_break(_) |
       expr_again(_) | expr_lit(_) | expr_ret(*) | expr_block(*) |
       expr_assign(*) | expr_assign_op(*) | expr_mac(*) |
@@ -1206,7 +1206,6 @@ impl Liveness {
           }
 
           expr_addr_of(_, e) |
-          expr_copy(e) |
           expr_loop_body(e) |
           expr_do_body(e) |
           expr_cast(e, _) |
@@ -1481,7 +1480,7 @@ fn check_expr(expr: @expr, (this, vt): (@Liveness, vt<@Liveness>)) {
       expr_call(*) | expr_method_call(*) | expr_if(*) | expr_match(*) |
       expr_while(*) | expr_loop(*) | expr_index(*) | expr_field(*) |
       expr_vstore(*) | expr_vec(*) | expr_tup(*) | expr_log(*) |
-      expr_binary(*) | expr_copy(*) | expr_loop_body(*) | expr_do_body(*) |
+      expr_binary(*) | expr_loop_body(*) | expr_do_body(*) |
       expr_cast(*) | expr_unary(*) | expr_ret(*) | expr_break(*) |
       expr_again(*) | expr_lit(_) | expr_block(*) |
       expr_mac(*) | expr_addr_of(*) | expr_struct(*) | expr_repeat(*) |
diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs
index f5024f7973c..8416e0212d8 100644
--- a/src/librustc/middle/mem_categorization.rs
+++ b/src/librustc/middle/mem_categorization.rs
@@ -426,13 +426,13 @@ impl mem_categorization_ctxt {
           ast::expr_assign(*) | ast::expr_assign_op(*) |
           ast::expr_fn_block(*) | ast::expr_ret(*) | ast::expr_loop_body(*) |
           ast::expr_do_body(*) | ast::expr_unary(*) |
-          ast::expr_method_call(*) | ast::expr_copy(*) | ast::expr_cast(*) |
-          ast::expr_vstore(*) | ast::expr_vec(*) | ast::expr_tup(*) |
-          ast::expr_if(*) | ast::expr_log(*) | ast::expr_binary(*) |
-          ast::expr_while(*) | ast::expr_block(*) | ast::expr_loop(*) |
-          ast::expr_match(*) | ast::expr_lit(*) | ast::expr_break(*) |
-          ast::expr_mac(*) | ast::expr_again(*) | ast::expr_struct(*) |
-          ast::expr_repeat(*) | ast::expr_inline_asm(*) => {
+          ast::expr_method_call(*) | ast::expr_cast(*) | ast::expr_vstore(*) |
+          ast::expr_vec(*) | ast::expr_tup(*) | ast::expr_if(*) |
+          ast::expr_log(*) | ast::expr_binary(*) | ast::expr_while(*) |
+          ast::expr_block(*) | ast::expr_loop(*) | ast::expr_match(*) |
+          ast::expr_lit(*) | ast::expr_break(*) | ast::expr_mac(*) |
+          ast::expr_again(*) | ast::expr_struct(*) | ast::expr_repeat(*) |
+          ast::expr_inline_asm(*) => {
             return self.cat_rvalue_node(expr, expr_ty);
           }
         }
diff --git a/src/librustc/middle/moves.rs b/src/librustc/middle/moves.rs
index 79d7f397bb2..6070e7bd3a5 100644
--- a/src/librustc/middle/moves.rs
+++ b/src/librustc/middle/moves.rs
@@ -454,10 +454,6 @@ impl VisitContext {
                 self.use_expr(discr, Read, visitor);
             }
 
-            expr_copy(base) => {
-                self.use_expr(base, Read, visitor);
-            }
-
             expr_paren(base) => {
                 // Note: base is not considered a *component* here, so
                 // use `expr_mode` not `comp_mode`.
diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs
index b92f43b1c8d..adfc0b58485 100644
--- a/src/librustc/middle/trans/expr.rs
+++ b/src/librustc/middle/trans/expr.rs
@@ -631,17 +631,6 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
         ast::expr_do_body(blk) => {
             return trans_into(bcx, blk, dest);
         }
-        ast::expr_copy(a) => {
-            // If we just called `trans_into(bcx, a, dest)`, then this
-            // might *move* the value into `dest` if the value is
-            // non-copyable. So first get a datum and then do an
-            // explicit copy.
-            let datumblk = trans_to_datum(bcx, a);
-            return match dest {
-                Ignore => datumblk.bcx,
-                SaveIn(llval) => datumblk.copy_to(INIT, llval)
-            };
-        }
         ast::expr_call(f, ref args, _) => {
             return callee::trans_call(
                 bcx, expr, f, callee::ArgExprs(*args), expr.id, dest);
diff --git a/src/librustc/middle/trans/type_use.rs b/src/librustc/middle/trans/type_use.rs
index 814ba16fd74..c708331e1c4 100644
--- a/src/librustc/middle/trans/type_use.rs
+++ b/src/librustc/middle/trans/type_use.rs
@@ -306,7 +306,7 @@ pub fn mark_for_expr(cx: &Context, e: &expr) {
     match e.node {
       expr_vstore(_, _) | expr_vec(_, _) | expr_struct(*) | expr_tup(_) |
       expr_unary(_, box(_), _) | expr_unary(_, uniq, _) |
-      expr_binary(_, add, _, _) | expr_copy(_) | expr_repeat(*) => {
+      expr_binary(_, add, _, _) | expr_repeat(*) => {
         node_type_needs(cx, use_repr, e.id);
       }
       expr_cast(base, _) => {
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index c02eb271e29..5910eaacc5d 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -3181,7 +3181,6 @@ pub fn expr_kind(tcx: ctxt,
         ast::expr_loop_body(*) |
         ast::expr_do_body(*) |
         ast::expr_block(*) |
-        ast::expr_copy(*) |
         ast::expr_repeat(*) |
         ast::expr_lit(@codemap::spanned {node: lit_str(_), _}) |
         ast::expr_vstore(_, ast::expr_vstore_slice) |
diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs
index deec93140b4..42b861b7330 100644
--- a/src/librustc/middle/typeck/check/mod.rs
+++ b/src/librustc/middle/typeck/check/mod.rs
@@ -2518,10 +2518,6 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
             fcx.write_nil(id);
         }
       }
-      ast::expr_copy(a) => {
-        check_expr_with_opt_hint(fcx, a, expected);
-        fcx.write_ty(id, fcx.expr_ty(a));
-      }
       ast::expr_paren(a) => {
         check_expr_with_opt_hint(fcx, a, expected);
         fcx.write_ty(id, fcx.expr_ty(a));
diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs
index e46cc31a79a..36f2eba430c 100644
--- a/src/librustc/middle/typeck/check/regionck.rs
+++ b/src/librustc/middle/typeck/check/regionck.rs
@@ -1035,7 +1035,6 @@ pub mod guarantor {
             ast::expr_loop_body(*) |
             ast::expr_do_body(*) |
             ast::expr_block(*) |
-            ast::expr_copy(*) |
             ast::expr_repeat(*) |
             ast::expr_vec(*) => {
                 assert!(!ty::expr_is_lval(
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 38f0b2496cb..7dafa5c7dad 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -455,7 +455,6 @@ pub enum expr_ {
     expr_do_body(@expr),
     expr_block(blk),
 
-    expr_copy(@expr),
     expr_assign(@expr, @expr),
     expr_assign_op(node_id, binop, @expr, @expr),
     expr_field(@expr, ident, ~[Ty]),
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 334721a38ed..59754f5519e 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -94,7 +94,6 @@ pub trait AstBuilder {
     fn expr_deref(&self, sp: span, e: @ast::expr) -> @ast::expr;
     fn expr_unary(&self, sp: span, op: ast::unop, e: @ast::expr) -> @ast::expr;
 
-    fn expr_copy(&self, sp: span, e: @ast::expr) -> @ast::expr;
     fn expr_managed(&self, sp: span, e: @ast::expr) -> @ast::expr;
     fn expr_addr_of(&self, sp: span, e: @ast::expr) -> @ast::expr;
     fn expr_mut_addr_of(&self, sp: span, e: @ast::expr) -> @ast::expr;
@@ -442,9 +441,6 @@ impl AstBuilder for @ExtCtxt {
         self.expr(sp, ast::expr_unary(self.next_id(), op, e))
     }
 
-    fn expr_copy(&self, sp: span, e: @ast::expr) -> @ast::expr {
-        self.expr(sp, ast::expr_copy(e))
-    }
     fn expr_managed(&self, sp: span, e: @ast::expr) -> @ast::expr {
         self.expr_unary(sp, ast::box(ast::m_imm), e)
     }
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index b831bb18643..a9e8fa10c64 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -580,7 +580,6 @@ pub fn noop_fold_expr(e: &expr_, fld: @ast_fold) -> expr_ {
             )
         }
         expr_block(ref blk) => expr_block(fld.fold_block(blk)),
-        expr_copy(e) => expr_copy(fld.fold_expr(e)),
         expr_assign(el, er) => {
             expr_assign(fld.fold_expr(el), fld.fold_expr(er))
         }
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index 148fca36ed2..b014c5668b6 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -63,7 +63,6 @@ pub enum ObsoleteSyntax {
     ObsoleteNamedExternModule,
     ObsoleteMultipleLocalDecl,
     ObsoleteMutWithMultipleBindings,
-    ObsoletePatternCopyKeyword,
 }
 
 impl to_bytes::IterBytes for ObsoleteSyntax {
@@ -249,10 +248,6 @@ impl ParserObsoleteMethods for Parser {
                 "use multiple local declarations instead of e.g. `let mut \
                  (x, y) = ...`."
             ),
-            ObsoletePatternCopyKeyword => (
-                "`copy` in patterns",
-                "`copy` in patterns no longer has any effect"
-            ),
         };
 
         self.report(sp, kind, kind_str, desc);
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index c67b2aefb63..f0b9258eaeb 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -22,7 +22,7 @@ use ast::{crate, crate_cfg, decl, decl_item};
 use ast::{decl_local, default_blk, deref, div, enum_def, explicit_self};
 use ast::{expr, expr_, expr_addr_of, expr_match, expr_again};
 use ast::{expr_assign, expr_assign_op, expr_binary, expr_block};
-use ast::{expr_break, expr_call, expr_cast, expr_copy, expr_do_body};
+use ast::{expr_break, expr_call, expr_cast, expr_do_body};
 use ast::{expr_field, expr_fn_block, expr_if, expr_index};
 use ast::{expr_lit, expr_log, expr_loop, expr_loop_body, expr_mac};
 use ast::{expr_method_call, expr_paren, expr_path, expr_repeat};
@@ -84,7 +84,7 @@ use parse::obsolete::{ObsoletePurity, ObsoleteStaticMethod};
 use parse::obsolete::{ObsoleteConstItem, ObsoleteFixedLengthVectorType};
 use parse::obsolete::{ObsoleteNamedExternModule, ObsoleteMultipleLocalDecl};
 use parse::obsolete::{ObsoleteMutWithMultipleBindings};
-use parse::obsolete::{ObsoletePatternCopyKeyword, ParserObsoleteMethods};
+use parse::obsolete::{ParserObsoleteMethods};
 use parse::token::{can_begin_expr, get_ident_interner, ident_to_str, is_ident};
 use parse::token::{is_ident_or_path};
 use parse::token::{is_plain_ident, INTERPOLATED, keywords, special_idents};
@@ -1704,11 +1704,6 @@ impl Parser {
                 ex = expr_break(None);
             }
             hi = self.span.hi;
-        } else if self.eat_keyword(keywords::Copy) {
-            // COPY expression
-            let e = self.parse_expr();
-            ex = expr_copy(e);
-            hi = e.span.hi;
         } else if *self.token == token::MOD_SEP ||
                 is_ident(&*self.token) && !self.is_keyword(keywords::True) &&
                 !self.is_keyword(keywords::False) {
@@ -2799,10 +2794,6 @@ impl Parser {
             // parse ref pat
             let mutbl = self.parse_mutability();
             pat = self.parse_pat_ident(bind_by_ref(mutbl));
-        } else if self.eat_keyword(keywords::Copy) {
-            // parse copy pat
-            self.obsolete(*self.span, ObsoletePatternCopyKeyword);
-            pat = self.parse_pat_ident(bind_infer);
         } else {
             let can_be_enum_or_struct = do self.look_ahead(1) |t| {
                 match *t {
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 8e14e56439e..754b7268a4a 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -566,7 +566,6 @@ pub mod keywords {
         As,
         Break,
         Const,
-        Copy,
         Do,
         Else,
         Enum,
@@ -609,7 +608,6 @@ pub mod keywords {
                 As => ident { name: 32, ctxt: 0 },
                 Break => ident { name: 33, ctxt: 0 },
                 Const => ident { name: 34, ctxt: 0 },
-                Copy => ident { name: 35, ctxt: 0 },
                 Do => ident { name: 36, ctxt: 0 },
                 Else => ident { name: 37, ctxt: 0 },
                 Enum => ident { name: 38, ctxt: 0 },
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 2f0241967d9..f1412994865 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -1344,7 +1344,6 @@ pub fn print_expr(s: @ps, expr: &ast::expr) {
         ibox(s, 0u);
         print_block(s, blk);
       }
-      ast::expr_copy(e) => { word_space(s, "copy"); print_expr(s, e); }
       ast::expr_assign(lhs, rhs) => {
         print_expr(s, lhs);
         space(s.s);
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index d68958ffa77..f57dcb1588e 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -532,7 +532,6 @@ pub fn visit_expr<E:Clone>(ex: @expr, (e, v): (E, vt<E>)) {
             (v.visit_expr)(b, (e.clone(), v));
             (v.visit_expr)(a, (e.clone(), v));
         }
-        expr_copy(a) => (v.visit_expr)(a, (e.clone(), v)),
         expr_assign_op(_, _, a, b) => {
             (v.visit_expr)(b, (e.clone(), v));
             (v.visit_expr)(a, (e.clone(), v));