about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2014-09-20 09:46:58 -0400
committerNiko Matsakis <niko@alum.mit.edu>2014-09-25 07:07:51 -0400
commit62e5dc929c1e8535d4185073507e681f26ab7e6a (patch)
tree16f8615a045d639c7bb77af538effa3bd3c14bd9
parent7119974f82cb239307ed9ea2e885eb66c0edba95 (diff)
downloadrust-62e5dc929c1e8535d4185073507e681f26ab7e6a.tar.gz
rust-62e5dc929c1e8535d4185073507e681f26ab7e6a.zip
Remove checks that are already being done during typeck
-rw-r--r--src/librustc/diagnostics.rs1
-rw-r--r--src/librustc/middle/kind.rs49
2 files changed, 1 insertions, 49 deletions
diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs
index a3ca3802e47..9b63a99bd2a 100644
--- a/src/librustc/diagnostics.rs
+++ b/src/librustc/diagnostics.rs
@@ -150,7 +150,6 @@ register_diagnostics!(
     E0144,
     E0145,
     E0146,
-    E0148,
     E0151,
     E0152,
     E0153,
diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs
index b065e09692c..56e65f5defe 100644
--- a/src/librustc/middle/kind.rs
+++ b/src/librustc/middle/kind.rs
@@ -15,7 +15,7 @@ use util::ppaux::UserString;
 
 use syntax::ast::*;
 use syntax::codemap::Span;
-use syntax::print::pprust::{expr_to_string, ident_to_string};
+use syntax::print::pprust::{ident_to_string};
 use syntax::visit::Visitor;
 use syntax::visit;
 
@@ -31,10 +31,6 @@ pub struct Context<'a,'tcx:'a> {
 }
 
 impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> {
-    fn visit_expr(&mut self, ex: &Expr) {
-        check_expr(self, ex);
-    }
-
     fn visit_fn(&mut self, fk: visit::FnKind, fd: &'v FnDecl,
                 b: &'v Block, s: Span, n: NodeId) {
         check_fn(self, fk, fd, b, s, n);
@@ -161,37 +157,6 @@ fn check_fn(
     }
 }
 
-pub fn check_expr(cx: &mut Context, e: &Expr) {
-    debug!("kind::check_expr({})", expr_to_string(e));
-
-    match e.node {
-        ExprRepeat(ref element, ref count_expr) => {
-            let count = ty::eval_repeat_count(cx.tcx, &**count_expr);
-            if count > 1 {
-                let element_ty = ty::expr_ty(cx.tcx, &**element);
-                check_copy(cx, element_ty, element.span,
-                           "repeated element will be copied");
-            }
-        }
-        ExprAssign(ref lhs, _) |
-        ExprAssignOp(_, ref lhs, _) => {
-            let lhs_ty = ty::expr_ty(cx.tcx, &**lhs);
-            if !ty::type_is_sized(cx.tcx, lhs_ty) {
-                cx.tcx.sess.span_err(lhs.span, "dynamically sized type on lhs of assignment");
-            }
-        }
-        ExprStruct(..) => {
-            let e_ty = ty::expr_ty(cx.tcx, e);
-            if !ty::type_is_sized(cx.tcx, e_ty) {
-                cx.tcx.sess.span_err(e.span, "trying to initialise a dynamically sized struct");
-            }
-        }
-        _ => {}
-    }
-
-    visit::walk_expr(cx, e);
-}
-
 fn check_ty(cx: &mut Context, aty: &Ty) {
     match aty.node {
         TyPath(_, _, id) => {
@@ -274,18 +239,6 @@ pub fn check_freevar_bounds(cx: &Context, fn_span: Span, sp: Span, ty: ty::t,
     });
 }
 
-fn check_copy(cx: &Context, ty: ty::t, sp: Span, reason: &str) {
-    debug!("type_contents({})={}",
-           ty_to_string(cx.tcx, ty),
-           ty::type_contents(cx.tcx, ty).to_string());
-    if ty::type_moves_by_default(cx.tcx, ty) {
-        span_err!(cx.tcx.sess, sp, E0148,
-            "copying a value of non-copyable type `{}`",
-            ty_to_string(cx.tcx, ty));
-        span_note!(cx.tcx.sess, sp, "{}", reason.as_slice());
-    }
-}
-
 // Ensure that `ty` has a statically known size (i.e., it has the `Sized` bound).
 fn check_sized(tcx: &ty::ctxt, ty: ty::t, name: String, sp: Span) {
     if !ty::type_is_sized(tcx, ty) {