fix some unused pattern binding warnings

This commit is contained in:
Niko Matsakis 2012-08-24 14:04:38 -07:00
parent 5ba7434cb1
commit a8f1bee457
17 changed files with 43 additions and 42 deletions

View File

@ -231,7 +231,7 @@ union => s.union(s1, self.nbits),
assign => s.become(s1, self.nbits),
difference => s.difference(s1, self.nbits)
},
big(s1) => self.die()
big(_) => self.die()
},
big(s) => match other.rep {
small(_) => self.die(),

View File

@ -193,7 +193,7 @@ fn map_item(i: @item, cx: ctx, v: vt) {
let item_path = @/* FIXME (#2543) */ copy cx.path;
cx.map.insert(i.id, node_item(i, item_path));
match i.node {
item_impl(_, opt_ir, _, ms) => {
item_impl(_, _, _, ms) => {
let impl_did = ast_util::local_def(i.id);
for ms.each |m| {
map_method(impl_did, extend(cx, i.ident), m,

View File

@ -372,7 +372,7 @@ fn accept<E>(e: E, v: visit::vt<E>) {
ii_ctor(ctor, nm, tps, parent_id) => {
visit::visit_class_ctor_helper(ctor, nm, tps, parent_id, e, v);
}
ii_dtor(dtor, nm, tps, parent_id) => {
ii_dtor(dtor, _, tps, parent_id) => {
visit::visit_class_dtor_helper(dtor, tps, parent_id, e, v);
}
}
@ -504,7 +504,7 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
vfn(id);
match fk {
visit::fk_ctor(nm, _, tps, self_id, parent_id) => {
visit::fk_ctor(_, _, tps, self_id, parent_id) => {
vec::iter(tps, |tp| vfn(tp.id));
vfn(id);
vfn(self_id);
@ -583,7 +583,7 @@ fn compute_id_range_for_inlined_item(item: inlined_item) -> id_range {
fn walk_pat(pat: @pat, it: fn(@pat)) {
it(pat);
match pat.node {
pat_ident(_, pth, some(p)) => walk_pat(p, it),
pat_ident(_, _, some(p)) => walk_pat(p, it),
pat_rec(fields, _) | pat_struct(_, fields, _) =>
for fields.each |f| { walk_pat(f.pat, it) },
pat_enum(_, some(s)) | pat_tup(s) => for s.each |p| {

View File

@ -204,7 +204,7 @@ fn eq(a: @ast::meta_item, b: @ast::meta_item) -> bool {
ast::meta_name_value(nb, vb) => na == nb && va.node == vb.node,
_ => false
},
ast::meta_list(na, la) => {
ast::meta_list(*) => {
// ~[Fixme-sorting]
// FIXME (#607): Needs implementing

View File

@ -211,7 +211,7 @@ fn expand_item_mac(exts: hashmap<~str, syntax_extension>,
span: expand.span}}));
let maybe_it = match expanded {
mr_item(it) => fld.fold_item(it),
mr_expr(e) => cx.span_fatal(pth.span,
mr_expr(_) => cx.span_fatal(pth.span,
~"expr macro in item position: " +
*extname),
mr_def(mdef) => {

View File

@ -41,7 +41,7 @@ impl message: gen_send {
fn gen_send(cx: ext_ctxt, try: bool) -> @ast::item {
debug!("pipec: gen_send");
match self {
message(id, span, tys, this,
message(_id, span, tys, this,
some({state: next, tys: next_tys})) => {
debug!("pipec: next state exists");
let next = this.proto.get_state(next);
@ -126,7 +126,7 @@ fn gen_send(cx: ext_ctxt, try: bool) -> @ast::item {
cx.expr_block(body))
}
message(id, span, tys, this, none) => {
message(_id, span, tys, this, none) => {
debug!("pipec: no next state");
let arg_names = tys.mapi(|i, _ty| (~"x_" + i.to_str()));

View File

@ -635,7 +635,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
let mut clauses: ~[@clause] = ~[];
for args.each |arg| {
match arg.node {
expr_vec(elts, mutbl) => {
expr_vec(elts, _) => {
if vec::len(elts) != 2u {
cx.span_fatal((*arg).span,
~"extension clause must consist of ~[" +

View File

@ -42,11 +42,11 @@ fn ms(m: matcher_) -> matcher {
// Extract the arguments:
let lhses:~[@named_match] = match argument_map.get(lhs_nm) {
@matched_seq(s, sp) => s,
@matched_seq(s, _) => s,
_ => cx.span_bug(sp, ~"wrong-structured lhs")
};
let rhses:~[@named_match] = match argument_map.get(rhs_nm) {
@matched_seq(s, sp) => s,
@matched_seq(s, _) => s,
_ => cx.span_bug(sp, ~"wrong-structured rhs")
};

View File

@ -116,7 +116,7 @@ fn fold_mac_(m: mac, fld: ast_fold) -> mac {
mac_invoc(fld.fold_path(pth),
option::map(arg, |x| fld.fold_expr(x)), body)
}
mac_invoc_tt(pth, tt) => m.node,
mac_invoc_tt(*) => m.node,
mac_ellipsis => mac_ellipsis,
mac_aq(_,_) => /* FIXME (#2543) */ copy m.node,
mac_var(_) => /* FIXME (#2543) */ copy m.node,

View File

@ -31,7 +31,7 @@ fn stmt_ends_with_semi(stmt: ast::stmt) -> bool {
ast::stmt_expr(e, _) => {
return expr_requires_semi_to_be_stmt(e);
}
ast::stmt_semi(e, _) => {
ast::stmt_semi(*) => {
return false;
}
}

View File

@ -130,7 +130,7 @@ fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: ~str,
vec::push(items, i);
}
ast::cdir_view_item(vi) => vec::push(view_items, vi),
ast::cdir_syntax(pth) => ()
ast::cdir_syntax(*) => ()
}
}
//

View File

@ -313,7 +313,7 @@ fn scan_digits(rdr: string_reader, radix: uint) -> ~str {
let c = rdr.curr;
if c == '_' { bump(rdr); again; }
match char::to_digit(c, radix) {
some(d) => {
some(_) => {
str::push_char(rslt, c);
bump(rdr);
}

View File

@ -923,7 +923,7 @@ fn do_else(s: ps, els: option<@ast::expr>) {
fn print_mac(s: ps, m: ast::mac) {
match m.node {
ast::mac_invoc(path, arg, body) => {
ast::mac_invoc(path, arg, _body) => {
word(s.s, ~"#");
print_path(s, path, false);
match arg {

View File

@ -384,11 +384,11 @@ fn visit_exprs<E>(exprs: ~[@expr], e: E, v: vt<E>) {
fn visit_mac<E>(m: mac, e: E, v: vt<E>) {
match m.node {
ast::mac_invoc(pth, arg, body) => {
ast::mac_invoc(_, arg, _) => {
option::map(arg, |arg| v.visit_expr(arg, e, v)); }
ast::mac_invoc_tt(pth, tt) => { /* no user-serviceable parts inside */ }
ast::mac_invoc_tt(*) => { /* no user-serviceable parts inside */ }
ast::mac_ellipsis => (),
ast::mac_aq(_, e) => { /* FIXME: maybe visit (Issue #2340) */ }
ast::mac_aq(*) => { /* FIXME: maybe visit (Issue #2340) */ }
ast::mac_var(_) => ()
}
}

View File

@ -759,7 +759,7 @@ fn make_free_glue(bcx: block, v: ValueRef, t: ty::t) {
none);
trans_free(bcx, v)
}
ty::ty_uniq(content_mt) => {
ty::ty_uniq(*) => {
uniq::make_free_glue(bcx, v, t)
}
ty::ty_evec(_, ty::vstore_uniq) | ty::ty_estr(ty::vstore_uniq) |
@ -1062,8 +1062,8 @@ fn iter_variant(cx: block, a_tup: ValueRef,
cx = f(cx, llfld_a, fld.mt.ty);
}
}
ty::ty_estr(ty::vstore_fixed(n)) |
ty::ty_evec(_, ty::vstore_fixed(n)) => {
ty::ty_estr(ty::vstore_fixed(_)) |
ty::ty_evec(_, ty::vstore_fixed(_)) => {
let (base, len) = tvec::get_base_and_len(cx, av, t);
cx = tvec::iter_vec_raw(cx, base, t, len, f);
}
@ -2071,7 +2071,7 @@ fn trans_external_path(ccx: @crate_ctxt, did: ast::def_id, t: ty::t)
fn normalize_for_monomorphization(tcx: ty::ctxt, ty: ty::t) -> option<ty::t> {
// FIXME[mono] could do this recursively. is that worthwhile? (#2529)
match ty::get(ty).struct {
ty::ty_box(mt) => {
ty::ty_box(*) => {
some(ty::mk_opaque_box(tcx))
}
ty::ty_fn(ref fty) => {
@ -2199,10 +2199,10 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id,
ast_map::node_method(m, _, pt) => (pt, m.ident, m.span),
ast_map::node_foreign_item(i, ast::foreign_abi_rust_intrinsic, pt)
=> (pt, i.ident, i.span),
ast_map::node_foreign_item(_, abi, _) => {
ast_map::node_foreign_item(*) => {
// Foreign externs don't have to be monomorphized.
return {val: get_item_val(ccx, fn_id.node),
must_cast: true};
must_cast: true};
}
ast_map::node_ctor(nm, _, ct, _, pt) => (pt, nm, ct.span),
ast_map::node_dtor(_, dtor, _, pt) =>
@ -2286,13 +2286,13 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id,
}
d
}
ast_map::node_method(mth, impl_def_id, _) => {
ast_map::node_method(mth, _, _) => {
let d = mk_lldecl();
set_inline_hint_if_appr(mth.attrs, d);
impl::trans_method(ccx, pt, mth, psubsts, d);
d
}
ast_map::node_ctor(nm, tps, ctor, parent_id, _) => {
ast_map::node_ctor(_, tps, ctor, parent_id, _) => {
// ctors don't have attrs, at least not right now
let d = mk_lldecl();
let tp_tys = ty::ty_params_to_tys(ccx.tcx, tps);
@ -2356,7 +2356,7 @@ fn maybe_instantiate_inline(ccx: @crate_ctxt, fn_id: ast::def_id)
trans_item(ccx, *item);
local_def(item.id)
}
csearch::found(ast::ii_ctor(ctor, nm, tps, parent_id)) => {
csearch::found(ast::ii_ctor(ctor, _, tps, _)) => {
ccx.external.insert(fn_id, some(ctor.node.id));
local_def(ctor.node.id)
}
@ -2398,7 +2398,7 @@ fn maybe_instantiate_inline(ccx: @crate_ctxt, fn_id: ast::def_id)
}
local_def(mth.id)
}
csearch::found(ast::ii_dtor(dtor, nm, tps, parent_id)) => {
csearch::found(ast::ii_dtor(dtor, _, tps, _)) => {
ccx.external.insert(fn_id, some(dtor.node.id));
local_def(dtor.node.id)
}
@ -2500,7 +2500,8 @@ fn take_local(table: hashmap<ast::node_id, local_val>,
match table.find(id) {
some(local_mem(v)) => {val: v, kind: lv_owned},
some(local_imm(v)) => {val: v, kind: lv_owned_imm},
r => fail(~"take_local: internal error")
none => fail(fmt!("take_local: internal error, \
found no entry for %?", id))
}
}
match def {
@ -2516,7 +2517,7 @@ fn take_local(table: hashmap<ast::node_id, local_val>,
assert (cx.fcx.lllocals.contains_key(nid));
return take_local(cx.fcx.lllocals, nid);
}
ast::def_self(sid) => {
ast::def_self(_) => {
let slf = match copy cx.fcx.llself {
some(s) => cast_self(cx, s),
none => cx.sess().bug(~"trans_local_var: reference to self \
@ -2690,7 +2691,7 @@ fn expr_is_lval(bcx: block, e: @ast::expr) -> bool {
fn trans_callee(bcx: block, e: @ast::expr) -> lval_maybe_callee {
let _icx = bcx.insn_ctxt("trans_callee");
match e.node {
ast::expr_path(path) => return trans_path(bcx, e.id),
ast::expr_path(_) => return trans_path(bcx, e.id),
ast::expr_field(base, _, _) => {
// Lval means this is a record field, so not a method
if !expr_is_lval(bcx, e) {
@ -2949,7 +2950,7 @@ fn trans_arg_expr(cx: block, arg: ty::arg, lldestty: TypeRef, e: @ast::expr,
// translate the arg expr as an lvalue
let lv = match ret_flag {
// If there is a ret_flag, this *must* be a loop body
some(ptr) => match check e.node {
some(_) => match check e.node {
ast::expr_loop_body(blk) => {
let scratch = alloc_ty(cx, expr_ty(cx, blk));
let bcx = trans_loop_body(cx, e, ret_flag, save_in(scratch));
@ -3858,7 +3859,7 @@ fn ast_proto_to_proto_simple(ast_proto: ast::proto)
}
}
}
ast::expr_loop_body(blk) => {
ast::expr_loop_body(_) => {
return trans_loop_body(bcx, e, none, dest);
}
ast::expr_do_body(blk) => {
@ -5383,11 +5384,11 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
vec::append(*pth, ~[path_name(ni.ident)]),
ni.id)
}
ast_map::node_ctor(nm, tps, ctor, _, pt) => {
ast_map::node_ctor(nm, _, ctor, _, pt) => {
let my_path = vec::append(*pt, ~[path_name(nm)]);
register_fn(ccx, ctor.span, my_path, ctor.node.id)
}
ast_map::node_dtor(tps, dt, parent_id, pt) => {
ast_map::node_dtor(_, dt, parent_id, pt) => {
/*
Don't just call register_fn, since we don't want to add
the implicit self argument automatically (we want to make sure

View File

@ -242,7 +242,7 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
}
const_get_elt(arr, iv as uint)
}
ast::expr_cast(base, tp) => {
ast::expr_cast(base, _) => {
let ety = ty::expr_ty(cx.tcx, e), llty = type_of::type_of(cx, ety);
let basety = ty::expr_ty(cx.tcx, base);
let v = const_expr(cx, base);
@ -311,7 +311,7 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
ast::expr_rec(fs, none) => {
C_struct(fs.map(|f| const_expr(cx, f.node.expr)))
}
ast::expr_vec(es, m_imm) => {
ast::expr_vec(es, ast::m_imm) => {
let (v, _, _) = const_vec(cx, e, es);
v
}
@ -327,7 +327,7 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
~"bad const-slice lit") }
}
}
ast::expr_vec(es, m_imm) => {
ast::expr_vec(es, ast::m_imm) => {
let (cv, sz, llunitty) = const_vec(cx, e, es);
let llty = val_ty(cv);
let gv = do str::as_c_str("const") |name| {
@ -342,7 +342,7 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
~"bad const-slice expr")
}
}
ast::expr_path(path) => {
ast::expr_path(_) => {
match cx.tcx.def_map.find(e.id) {
some(ast::def_const(def_id)) => {
// Don't know how to handle external consts

View File

@ -95,7 +95,7 @@ fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
ty::ty_estr(ty::vstore_uniq) => {
T_unique_ptr(T_unique(cx, T_vec(cx, T_i8())))
}
ty::ty_enum(did, _) => {
ty::ty_enum(*) => {
// Only create the named struct, but don't fill it in. We
// fill it in *after* placing it into the type cache. This
// avoids creating more than one copy of the enum when one