remove dead assignments
This commit is contained in:
parent
f5c51b0a9c
commit
ccd8d5573e
|
@ -112,7 +112,7 @@ mod ct {
|
||||||
}
|
}
|
||||||
} else { buf += curr; i += 1u; }
|
} else { buf += curr; i += 1u; }
|
||||||
}
|
}
|
||||||
buf = flush_buf(buf, pieces);
|
flush_buf(buf, pieces);
|
||||||
ret pieces;
|
ret pieces;
|
||||||
}
|
}
|
||||||
fn peek_num(s: str, i: uint, lim: uint) ->
|
fn peek_num(s: str, i: uint, lim: uint) ->
|
||||||
|
|
|
@ -199,7 +199,7 @@ fn scan_number(c: char, rdr: reader) -> token::token {
|
||||||
}
|
}
|
||||||
num_str = scan_digits(rdr, base);
|
num_str = scan_digits(rdr, base);
|
||||||
c = rdr.curr;
|
c = rdr.curr;
|
||||||
n = rdr.next();
|
rdr.next();
|
||||||
if c == 'u' || c == 'i' {
|
if c == 'u' || c == 'i' {
|
||||||
let signed = c == 'i';
|
let signed = c == 'i';
|
||||||
let mut tp = {
|
let mut tp = {
|
||||||
|
|
|
@ -90,7 +90,7 @@ class parser {
|
||||||
self.span = span0;
|
self.span = span0;
|
||||||
self.last_span = span0;
|
self.last_span = span0;
|
||||||
self.buffer = dvec::dvec();
|
self.buffer = dvec::dvec();
|
||||||
self.restriction == UNRESTRICTED;
|
self.restriction = UNRESTRICTED;
|
||||||
self.reader = rdr;
|
self.reader = rdr;
|
||||||
self.keywords = token::keyword_table();
|
self.keywords = token::keyword_table();
|
||||||
self.restricted_keywords = token::restricted_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 {
|
fn parse_dot_or_call_expr_with(e0: pexpr) -> pexpr {
|
||||||
let mut e = e0;
|
let mut e = e0;
|
||||||
let lo = e.span.lo;
|
let lo = e.span.lo;
|
||||||
let mut hi = e.span.hi;
|
let mut hi;
|
||||||
loop {
|
loop {
|
||||||
// expr.f
|
// expr.f
|
||||||
if eat(self, token::DOT) {
|
if eat(self, token::DOT) {
|
||||||
|
@ -1025,7 +1025,7 @@ class parser {
|
||||||
|
|
||||||
fn parse_prefix_expr() -> pexpr {
|
fn parse_prefix_expr() -> pexpr {
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
let mut hi = self.span.hi;
|
let mut hi;
|
||||||
|
|
||||||
let mut ex;
|
let mut ex;
|
||||||
alt self.token {
|
alt self.token {
|
||||||
|
|
|
@ -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) {
|
alt comm::recv(setup_po) {
|
||||||
some(err_data) {
|
some(err_data) {
|
||||||
// we failed to bind/list w/ libuv
|
// 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 {
|
none {
|
||||||
on_establish_cb(kill_ch);
|
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|
|
uv::hl::interact(hl_loop) {|loop_ptr|
|
||||||
log(debug, #fmt("tcp::listen post-kill recv hl interact %?",
|
log(debug, #fmt("tcp::listen post-kill recv hl interact %?",
|
||||||
loop_ptr));
|
loop_ptr));
|
||||||
|
|
|
@ -753,7 +753,7 @@ mod node {
|
||||||
execution and should be discarded as meaningless afterwards.
|
execution and should be discarded as meaningless afterwards.
|
||||||
"]
|
"]
|
||||||
fn tree_from_forest_destructive(forest: [mut @node]) -> @node {
|
fn tree_from_forest_destructive(forest: [mut @node]) -> @node {
|
||||||
let mut i = 0u;
|
let mut i;
|
||||||
let mut len = vec::len(forest);
|
let mut len = vec::len(forest);
|
||||||
while len > 1u {
|
while len > 1u {
|
||||||
i = 0u;
|
i = 0u;
|
||||||
|
@ -1020,7 +1020,6 @@ mod node {
|
||||||
let ita = char_iterator::start(a);
|
let ita = char_iterator::start(a);
|
||||||
let itb = char_iterator::start(b);
|
let itb = char_iterator::start(b);
|
||||||
let mut result = 0;
|
let mut result = 0;
|
||||||
let mut pos = 0u;
|
|
||||||
while result == 0 {
|
while result == 0 {
|
||||||
alt((char_iterator::next(ita), char_iterator::next(itb))) {
|
alt((char_iterator::next(ita), char_iterator::next(itb))) {
|
||||||
(option::none, option::none) {
|
(option::none, option::none) {
|
||||||
|
@ -1036,7 +1035,6 @@ mod node {
|
||||||
result = -1;
|
result = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pos += 1u;
|
|
||||||
}
|
}
|
||||||
ret result;
|
ret result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> str {
|
||||||
let mut hash = "";
|
|
||||||
alt ccx.type_sha1s.find(t) {
|
alt ccx.type_sha1s.find(t) {
|
||||||
some(h) { hash = h; }
|
some(h) { ret h; }
|
||||||
none {
|
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);
|
ccx.type_sha1s.insert(t, hash);
|
||||||
|
ret hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret hash;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -587,8 +587,8 @@ fn build_output_filenames(input: input,
|
||||||
ofile: option<str>,
|
ofile: option<str>,
|
||||||
sess: session)
|
sess: session)
|
||||||
-> output_filenames {
|
-> output_filenames {
|
||||||
let mut obj_path = "";
|
let mut obj_path; // FIXME remove mut after snapshot
|
||||||
let mut out_path: str = "";
|
let mut out_path; // FIXME remove mut after snapshot
|
||||||
let sopts = sess.opts;
|
let sopts = sess.opts;
|
||||||
let stop_after_codegen =
|
let stop_after_codegen =
|
||||||
sopts.output_type != link::output_type_exe ||
|
sopts.output_type != link::output_type_exe ||
|
||||||
|
|
|
@ -3855,7 +3855,7 @@ fn trans_break_cont(bcx: block, to_end: bool)
|
||||||
let _icx = bcx.insn_ctxt("trans_break_cont");
|
let _icx = bcx.insn_ctxt("trans_break_cont");
|
||||||
// Locate closest loop block, outputting cleanup as we go.
|
// Locate closest loop block, outputting cleanup as we go.
|
||||||
let mut unwind = bcx;
|
let mut unwind = bcx;
|
||||||
let mut target = bcx;
|
let mut target = bcx; // FIXME---not necc. but tstate thinks it is
|
||||||
loop {
|
loop {
|
||||||
alt unwind.kind {
|
alt unwind.kind {
|
||||||
block_scope({loop_break: some(brk), _}) {
|
block_scope({loop_break: some(brk), _}) {
|
||||||
|
|
|
@ -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] {
|
fn norm_a_constraint(id: def_id, c: constraint) -> [norm_constraint] {
|
||||||
let mut rslt: [norm_constraint] = [];
|
let mut rslt: [norm_constraint] = [];
|
||||||
for vec::each(*c.descs) {|pd|
|
let descs = *c.descs;
|
||||||
|
for vec::each(descs) {|pd|
|
||||||
rslt +=
|
rslt +=
|
||||||
[{bit_num: pd.node.bit_num,
|
[{bit_num: pd.node.bit_num,
|
||||||
c: respan(pd.span, {path: c.path,
|
c: respan(pd.span, {path: c.path,
|
||||||
|
|
|
@ -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,
|
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) {
|
alt node_id_to_def(fcx.ccx, new_var) {
|
||||||
some(d) {
|
some(d) {
|
||||||
alt 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 {
|
alt rhs.node {
|
||||||
expr_path(p1) {
|
expr_path(p1) {
|
||||||
let d = local_node_id_to_local_def_id(fcx, lhs.id);
|
let d = local_node_id_to_local_def_id(fcx, lhs.id);
|
||||||
|
|
|
@ -197,30 +197,6 @@ fn find_pre_post_state_exprs(fcx: fn_ctxt, pres: prestate, id: node_id,
|
||||||
ret changed;
|
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,
|
fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk,
|
||||||
maybe_alt: option<@expr>, id: node_id, chk: if_ty,
|
maybe_alt: option<@expr>, id: node_id, chk: if_ty,
|
||||||
pres: prestate) -> bool {
|
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,
|
fn find_pre_post_state_fn(fcx: fn_ctxt,
|
||||||
f_decl: fn_decl,
|
f_decl: fn_decl,
|
||||||
f_body: blk) -> bool {
|
f_body: blk) -> bool {
|
||||||
let num_constrs = num_constraints(fcx.enclosing);
|
|
||||||
// All constraints are considered false until proven otherwise.
|
// All constraints are considered false until proven otherwise.
|
||||||
// This ensures that intersect works correctly.
|
// This ensures that intersect works correctly.
|
||||||
kill_all_prestate(fcx, f_body.node.id);
|
kill_all_prestate(fcx, f_body.node.id);
|
||||||
|
|
|
@ -1481,7 +1481,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
}
|
}
|
||||||
some(bexpr) {
|
some(bexpr) {
|
||||||
let bexpr_t = fcx.expr_ty(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) {
|
alt structure_of(fcx, expr.span, bexpr_t) {
|
||||||
ty::ty_rec(flds) { base_fields = flds; }
|
ty::ty_rec(flds) { base_fields = flds; }
|
||||||
_ {
|
_ {
|
||||||
|
|
|
@ -5,7 +5,7 @@ fn check_alt(fcx: @fn_ctxt,
|
||||||
discrim: @ast::expr,
|
discrim: @ast::expr,
|
||||||
arms: [ast::arm]) -> bool {
|
arms: [ast::arm]) -> bool {
|
||||||
let tcx = fcx.ccx.tcx;
|
let tcx = fcx.ccx.tcx;
|
||||||
let mut bot = false;
|
let mut bot;
|
||||||
|
|
||||||
let pattern_ty = fcx.infcx.next_ty_var();
|
let pattern_ty = fcx.infcx.next_ty_var();
|
||||||
bot = check_expr_with(fcx, discrim, pattern_ty);
|
bot = check_expr_with(fcx, discrim, pattern_ty);
|
||||||
|
|
|
@ -18,6 +18,8 @@ fn test2() {
|
||||||
|
|
||||||
pure_borrow(x, x = ~5); //! ERROR assigning to mutable local variable prohibited due to outstanding loan
|
pure_borrow(x, x = ~5); //! ERROR assigning to mutable local variable prohibited due to outstanding loan
|
||||||
//!^ NOTE loan of mutable local variable granted here
|
//!^ NOTE loan of mutable local variable granted here
|
||||||
|
|
||||||
|
copy x;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
Binary file not shown.
|
@ -1,4 +1,3 @@
|
||||||
// error-pattern: unsatisfied precondition constraint
|
|
||||||
use std;
|
use std;
|
||||||
import std::arc;
|
import std::arc;
|
||||||
import comm::*;
|
import comm::*;
|
||||||
|
@ -6,13 +5,13 @@ import comm::*;
|
||||||
fn main() {
|
fn main() {
|
||||||
let v = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
let v = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||||
let arc_v = arc::arc(v);
|
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);
|
let v = *arc::get(&arc_v);
|
||||||
assert v[3] == 4;
|
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);
|
log(info, arc_v);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue