remove dead assignments

This commit is contained in:
Niko Matsakis 2012-05-24 13:35:57 -07:00
parent f5c51b0a9c
commit ccd8d5573e
16 changed files with 24 additions and 51 deletions

View file

@ -112,7 +112,7 @@ mod ct {
}
} else { buf += curr; i += 1u; }
}
buf = flush_buf(buf, pieces);
flush_buf(buf, pieces);
ret pieces;
}
fn peek_num(s: str, i: uint, lim: uint) ->

View file

@ -199,7 +199,7 @@ fn scan_number(c: char, rdr: reader) -> token::token {
}
num_str = scan_digits(rdr, base);
c = rdr.curr;
n = rdr.next();
rdr.next();
if c == 'u' || c == 'i' {
let signed = c == 'i';
let mut tp = {

View file

@ -90,7 +90,7 @@ class parser {
self.span = span0;
self.last_span = span0;
self.buffer = dvec::dvec();
self.restriction == UNRESTRICTED;
self.restriction = UNRESTRICTED;
self.reader = rdr;
self.keywords = token::keyword_table();
self.restricted_keywords = token::restricted_keyword_table();
@ -949,7 +949,7 @@ class parser {
fn parse_dot_or_call_expr_with(e0: pexpr) -> pexpr {
let mut e = e0;
let lo = e.span.lo;
let mut hi = e.span.hi;
let mut hi;
loop {
// expr.f
if eat(self, token::DOT) {
@ -1025,7 +1025,7 @@ class parser {
fn parse_prefix_expr() -> pexpr {
let lo = self.span.lo;
let mut hi = self.span.hi;
let mut hi;
let mut ex;
alt self.token {

View file

@ -734,7 +734,6 @@ fn listen_for_conn(host_ip: ip::ip_addr, port: uint, backlog: uint,
}
}
};
let mut kill_result: option<tcp_err_data> = none;
alt comm::recv(setup_po) {
some(err_data) {
// we failed to bind/list w/ libuv
@ -742,7 +741,7 @@ fn listen_for_conn(host_ip: ip::ip_addr, port: uint, backlog: uint,
}
none {
on_establish_cb(kill_ch);
kill_result = comm::recv(kill_po);
let kill_result = comm::recv(kill_po);
uv::hl::interact(hl_loop) {|loop_ptr|
log(debug, #fmt("tcp::listen post-kill recv hl interact %?",
loop_ptr));

View file

@ -753,7 +753,7 @@ mod node {
execution and should be discarded as meaningless afterwards.
"]
fn tree_from_forest_destructive(forest: [mut @node]) -> @node {
let mut i = 0u;
let mut i;
let mut len = vec::len(forest);
while len > 1u {
i = 0u;
@ -1020,7 +1020,6 @@ mod node {
let ita = char_iterator::start(a);
let itb = char_iterator::start(b);
let mut result = 0;
let mut pos = 0u;
while result == 0 {
alt((char_iterator::next(ita), char_iterator::next(itb))) {
(option::none, option::none) {
@ -1036,7 +1035,6 @@ mod node {
result = -1;
}
}
pos += 1u;
}
ret result;
}

View file

@ -429,15 +429,14 @@ fn symbol_hash(tcx: ty::ctxt, sha: sha1, t: ty::t,
}
fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> str {
let mut hash = "";
alt ccx.type_sha1s.find(t) {
some(h) { hash = h; }
some(h) { ret h; }
none {
hash = symbol_hash(ccx.tcx, ccx.sha, t, ccx.link_meta);
let hash = symbol_hash(ccx.tcx, ccx.sha, t, ccx.link_meta);
ccx.type_sha1s.insert(t, hash);
ret hash;
}
}
ret hash;
}

View file

@ -587,8 +587,8 @@ fn build_output_filenames(input: input,
ofile: option<str>,
sess: session)
-> output_filenames {
let mut obj_path = "";
let mut out_path: str = "";
let mut obj_path; // FIXME remove mut after snapshot
let mut out_path; // FIXME remove mut after snapshot
let sopts = sess.opts;
let stop_after_codegen =
sopts.output_type != link::output_type_exe ||

View file

@ -3855,7 +3855,7 @@ fn trans_break_cont(bcx: block, to_end: bool)
let _icx = bcx.insn_ctxt("trans_break_cont");
// Locate closest loop block, outputting cleanup as we go.
let mut unwind = bcx;
let mut target = bcx;
let mut target = bcx; // FIXME---not necc. but tstate thinks it is
loop {
alt unwind.kind {
block_scope({loop_break: some(brk), _}) {

View file

@ -472,7 +472,8 @@ fn node_id_to_def(ccx: crate_ctxt, id: node_id) -> option<def> {
fn norm_a_constraint(id: def_id, c: constraint) -> [norm_constraint] {
let mut rslt: [norm_constraint] = [];
for vec::each(*c.descs) {|pd|
let descs = *c.descs;
for vec::each(descs) {|pd|
rslt +=
[{bit_num: pd.node.bit_num,
c: respan(pd.span, {path: c.path,

View file

@ -167,7 +167,7 @@ fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk,
}
fn gen_if_local(fcx: fn_ctxt, lhs: @expr, rhs: @expr, larger_id: node_id,
new_var: node_id, pth: @path) {
new_var: node_id) {
alt node_id_to_def(fcx.ccx, new_var) {
some(d) {
alt d {
@ -206,7 +206,7 @@ fn handle_update(fcx: fn_ctxt, parent: @expr, lhs: @expr, rhs: @expr,
_ { }
}
gen_if_local(fcx, lhs, rhs, parent.id, lhs.id, p);
gen_if_local(fcx, lhs, rhs, parent.id, lhs.id);
alt rhs.node {
expr_path(p1) {
let d = local_node_id_to_local_def_id(fcx, lhs.id);

View file

@ -197,30 +197,6 @@ fn find_pre_post_state_exprs(fcx: fn_ctxt, pres: prestate, id: node_id,
ret changed;
}
fn find_pre_post_state_loop(fcx: fn_ctxt, pres: prestate, l: @local,
index: @expr, body: blk, id: node_id) -> bool {
// I'm confused about this -- how does the poststate for the body
// ever grow larger? It seems like it can't?
let loop_pres = intersect_states(pres, block_poststate(fcx.ccx, body));
let mut changed =
set_prestate_ann(fcx.ccx, id, loop_pres) |
find_pre_post_state_expr(fcx, pres, index);
let index_post = tritv_clone(expr_poststate(fcx.ccx, index));
changed |= find_pre_post_state_block(fcx, index_post, body);
if has_nonlocal_exits(body) {
// See [Break-unsound]
ret changed | set_poststate_ann(fcx.ccx, id, pres);
} else {
let res_p =
intersect_states(expr_poststate(fcx.ccx, index),
block_poststate(fcx.ccx, body));
ret changed | set_poststate_ann(fcx.ccx, id, res_p);
}
}
fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk,
maybe_alt: option<@expr>, id: node_id, chk: if_ty,
pres: prestate) -> bool {
@ -664,7 +640,6 @@ fn find_pre_post_state_block(fcx: fn_ctxt, pres0: prestate, b: blk) -> bool {
fn find_pre_post_state_fn(fcx: fn_ctxt,
f_decl: fn_decl,
f_body: blk) -> bool {
let num_constrs = num_constraints(fcx.enclosing);
// All constraints are considered false until proven otherwise.
// This ensures that intersect works correctly.
kill_all_prestate(fcx, f_body.node.id);

View file

@ -1481,7 +1481,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
}
some(bexpr) {
let bexpr_t = fcx.expr_ty(bexpr);
let mut base_fields: [field] = [];
let mut base_fields; // FIXME remove mut after snapshot
alt structure_of(fcx, expr.span, bexpr_t) {
ty::ty_rec(flds) { base_fields = flds; }
_ {

View file

@ -5,7 +5,7 @@ fn check_alt(fcx: @fn_ctxt,
discrim: @ast::expr,
arms: [ast::arm]) -> bool {
let tcx = fcx.ccx.tcx;
let mut bot = false;
let mut bot;
let pattern_ty = fcx.infcx.next_ty_var();
bot = check_expr_with(fcx, discrim, pattern_ty);

View file

@ -18,6 +18,8 @@ fn test2() {
pure_borrow(x, x = ~5); //! ERROR assigning to mutable local variable prohibited due to outstanding loan
//!^ NOTE loan of mutable local variable granted here
copy x;
}
fn main() {

Binary file not shown.

View file

@ -1,4 +1,3 @@
// error-pattern: unsatisfied precondition constraint
use std;
import std::arc;
import comm::*;
@ -6,13 +5,13 @@ import comm::*;
fn main() {
let v = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let arc_v = arc::arc(v);
task::spawn() {|move arc_v|
task::spawn() {|move arc_v| //! NOTE move of variable occurred here
let v = *arc::get(&arc_v);
assert v[3] == 4;
};
assert (*arc::get(&arc_v))[2] == 3;
assert (*arc::get(&arc_v))[2] == 3; //! ERROR use of moved variable: `arc_v`
log(info, arc_v);
}