about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2014-09-22 10:05:49 -0400
committerNiko Matsakis <niko@alum.mit.edu>2014-09-25 07:08:36 -0400
commit034f69ec4bd4ee59843ead5f40c5b3936a8eab4f (patch)
treec0a15f9e096ebf0e6a7fce0c3f499626ceda6208
parent62e5dc929c1e8535d4185073507e681f26ab7e6a (diff)
downloadrust-034f69ec4bd4ee59843ead5f40c5b3936a8eab4f.tar.gz
rust-034f69ec4bd4ee59843ead5f40c5b3936a8eab4f.zip
Remove redundant local variable checks.
-rw-r--r--src/librustc/diagnostics.rs1
-rw-r--r--src/librustc/middle/kind.rs40
2 files changed, 0 insertions, 41 deletions
diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs
index 9b63a99bd2a..68027812070 100644
--- a/src/librustc/diagnostics.rs
+++ b/src/librustc/diagnostics.rs
@@ -150,7 +150,6 @@ register_diagnostics!(
     E0144,
     E0145,
     E0146,
-    E0151,
     E0152,
     E0153,
     E0154,
diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs
index 56e65f5defe..08e640f597a 100644
--- a/src/librustc/middle/kind.rs
+++ b/src/librustc/middle/kind.rs
@@ -15,7 +15,6 @@ use util::ppaux::UserString;
 
 use syntax::ast::*;
 use syntax::codemap::Span;
-use syntax::print::pprust::{ident_to_string};
 use syntax::visit::Visitor;
 use syntax::visit;
 
@@ -39,10 +38,6 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> {
     fn visit_ty(&mut self, t: &Ty) {
         check_ty(self, t);
     }
-
-    fn visit_pat(&mut self, p: &Pat) {
-        check_pat(self, p);
-    }
 }
 
 pub fn check_crate(tcx: &ty::ctxt) {
@@ -239,38 +234,3 @@ pub fn check_freevar_bounds(cx: &Context, fn_span: Span, sp: Span, ty: ty::t,
     });
 }
 
-// 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) {
-        span_err!(tcx.sess, sp, E0151,
-            "variable `{}` has dynamically sized type `{}`",
-            name, ty_to_string(tcx, ty));
-    }
-}
-
-// Check that any variables in a pattern have types with statically known size.
-fn check_pat(cx: &mut Context, pat: &Pat) {
-    let var_name = match pat.node {
-        PatWild(PatWildSingle) => Some("_".to_string()),
-        PatIdent(_, ref path1, _) => Some(ident_to_string(&path1.node).to_string()),
-        _ => None
-    };
-
-    match var_name {
-        Some(name) => {
-            let types = cx.tcx.node_types.borrow();
-            let ty = types.find(&(pat.id as uint));
-            match ty {
-                Some(ty) => {
-                    debug!("kind: checking sized-ness of variable {}: {}",
-                           name, ty_to_string(cx.tcx, *ty));
-                    check_sized(cx.tcx, *ty, name, pat.span);
-                }
-                None => {} // extern fn args
-            }
-        }
-        None => {}
-    }
-
-    visit::walk_pat(cx, pat);
-}