Skip to content

Commit 034f69e

Browse files
committed
Remove redundant local variable checks.
1 parent 62e5dc9 commit 034f69e

File tree

2 files changed

+0
-41
lines changed

2 files changed

+0
-41
lines changed

src/librustc/diagnostics.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ register_diagnostics!(
150150
E0144,
151151
E0145,
152152
E0146,
153-
E0151,
154153
E0152,
155154
E0153,
156155
E0154,

src/librustc/middle/kind.rs

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use util::ppaux::UserString;
1515

1616
use syntax::ast::*;
1717
use syntax::codemap::Span;
18-
use syntax::print::pprust::{ident_to_string};
1918
use syntax::visit::Visitor;
2019
use syntax::visit;
2120

@@ -39,10 +38,6 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> {
3938
fn visit_ty(&mut self, t: &Ty) {
4039
check_ty(self, t);
4140
}
42-
43-
fn visit_pat(&mut self, p: &Pat) {
44-
check_pat(self, p);
45-
}
4641
}
4742

4843
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,
239234
});
240235
}
241236

242-
// Ensure that `ty` has a statically known size (i.e., it has the `Sized` bound).
243-
fn check_sized(tcx: &ty::ctxt, ty: ty::t, name: String, sp: Span) {
244-
if !ty::type_is_sized(tcx, ty) {
245-
span_err!(tcx.sess, sp, E0151,
246-
"variable `{}` has dynamically sized type `{}`",
247-
name, ty_to_string(tcx, ty));
248-
}
249-
}
250-
251-
// Check that any variables in a pattern have types with statically known size.
252-
fn check_pat(cx: &mut Context, pat: &Pat) {
253-
let var_name = match pat.node {
254-
PatWild(PatWildSingle) => Some("_".to_string()),
255-
PatIdent(_, ref path1, _) => Some(ident_to_string(&path1.node).to_string()),
256-
_ => None
257-
};
258-
259-
match var_name {
260-
Some(name) => {
261-
let types = cx.tcx.node_types.borrow();
262-
let ty = types.find(&(pat.id as uint));
263-
match ty {
264-
Some(ty) => {
265-
debug!("kind: checking sized-ness of variable {}: {}",
266-
name, ty_to_string(cx.tcx, *ty));
267-
check_sized(cx.tcx, *ty, name, pat.span);
268-
}
269-
None => {} // extern fn args
270-
}
271-
}
272-
None => {}
273-
}
274-
275-
visit::walk_pat(cx, pat);
276-
}

0 commit comments

Comments
 (0)