rustc: fix the unused pattern vars warnings.
This commit is contained in:
parent
1dc92d44be
commit
5ce5ee86bc
@ -109,7 +109,7 @@ fn visit_view_item(e: env, i: @ast::view_item) {
|
||||
|
||||
fn visit_item(e: env, i: @ast::item) {
|
||||
match i.node {
|
||||
ast::item_foreign_mod(m) => {
|
||||
ast::item_foreign_mod(_) => {
|
||||
match attr::foreign_abi(i.attrs) {
|
||||
either::Right(abi) => {
|
||||
if abi != ast::foreign_abi_cdecl &&
|
||||
|
@ -519,7 +519,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
|
||||
encode_path(ecx, ebml_w, path, ast_map::path_name(item.ident));
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
item_fn(decl, purity, tps, _) => {
|
||||
item_fn(_, purity, tps, _) => {
|
||||
add_to_index();
|
||||
ebml_w.start_tag(tag_items_data_item);
|
||||
encode_def_id(ebml_w, local_def(item.id));
|
||||
@ -630,7 +630,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
|
||||
needs to know*/
|
||||
for struct_def.fields.each |f| {
|
||||
match f.node.kind {
|
||||
named_field(ident, mutability, vis) => {
|
||||
named_field(ident, _, vis) => {
|
||||
ebml_w.start_tag(tag_item_field);
|
||||
encode_visibility(ebml_w, vis);
|
||||
encode_name(ecx, ebml_w, ident);
|
||||
@ -790,7 +790,7 @@ fn encode_info_for_foreign_item(ecx: @encode_ctxt, ebml_w: ebml::writer,
|
||||
|
||||
ebml_w.start_tag(tag_items_data_item);
|
||||
match nitem.node {
|
||||
foreign_item_fn(fn_decl, purity, tps) => {
|
||||
foreign_item_fn(_, purity, tps) => {
|
||||
encode_def_id(ebml_w, local_def(nitem.id));
|
||||
encode_family(ebml_w, purity_fn_family(purity));
|
||||
encode_type_param_bounds(ebml_w, ecx, tps);
|
||||
@ -803,7 +803,7 @@ fn encode_info_for_foreign_item(ecx: @encode_ctxt, ebml_w: ebml::writer,
|
||||
}
|
||||
encode_path(ecx, ebml_w, path, ast_map::path_name(nitem.ident));
|
||||
}
|
||||
foreign_item_const(t) => {
|
||||
foreign_item_const(*) => {
|
||||
encode_def_id(ebml_w, local_def(nitem.id));
|
||||
encode_family(ebml_w, 'c');
|
||||
encode_type(ecx, ebml_w, node_id_to_type(ecx.tcx, nitem.id));
|
||||
|
@ -44,11 +44,11 @@ fn mk_filesearch(maybe_sysroot: Option<Path>,
|
||||
self.target_triple));
|
||||
match get_cargo_lib_path_nearest() {
|
||||
result::ok(p) => vec::push(paths, p),
|
||||
result::err(p) => ()
|
||||
result::err(_) => ()
|
||||
}
|
||||
match get_cargo_lib_path() {
|
||||
result::ok(p) => vec::push(paths, p),
|
||||
result::err(p) => ()
|
||||
result::err(_) => ()
|
||||
}
|
||||
paths
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ fn collect_freevars(def_map: resolve3::DefMap, blk: ast::blk)
|
||||
|
||||
let walk_expr = fn@(expr: @ast::expr, &&depth: int, v: visit::vt<int>) {
|
||||
match expr.node {
|
||||
ast::expr_fn(proto, decl, _, _) => {
|
||||
ast::expr_fn(proto, _, _, _) => {
|
||||
if proto != ast::proto_bare {
|
||||
visit::visit_expr(expr, depth + 1, v);
|
||||
}
|
||||
@ -47,7 +47,7 @@ fn collect_freevars(def_map: resolve3::DefMap, blk: ast::blk)
|
||||
ast::expr_fn_block(*) => {
|
||||
visit::visit_expr(expr, depth + 1, v);
|
||||
}
|
||||
ast::expr_path(path) => {
|
||||
ast::expr_path(*) => {
|
||||
let mut i = 0;
|
||||
match def_map.find(expr.id) {
|
||||
None => fail ~"path not found",
|
||||
|
@ -216,7 +216,7 @@ fn resolve_arm(arm: ast::arm, cx: ctxt, visitor: visit::vt<ctxt>) {
|
||||
|
||||
fn resolve_pat(pat: @ast::pat, cx: ctxt, visitor: visit::vt<ctxt>) {
|
||||
match pat.node {
|
||||
ast::pat_ident(_, path, _) => {
|
||||
ast::pat_ident(*) => {
|
||||
let defn_opt = cx.def_map.find(pat.id);
|
||||
match defn_opt {
|
||||
Some(ast::def_variant(_,_)) => {
|
||||
@ -239,8 +239,8 @@ fn resolve_stmt(stmt: @ast::stmt, cx: ctxt, visitor: visit::vt<ctxt>) {
|
||||
ast::stmt_decl(*) => {
|
||||
visit::visit_stmt(stmt, cx, visitor);
|
||||
}
|
||||
ast::stmt_expr(expr, stmt_id) |
|
||||
ast::stmt_semi(expr, stmt_id) => {
|
||||
ast::stmt_expr(_, stmt_id) |
|
||||
ast::stmt_semi(_, stmt_id) => {
|
||||
record_parent(cx, stmt_id);
|
||||
let mut expr_cx = cx;
|
||||
expr_cx.parent = Some(stmt_id);
|
||||
@ -259,7 +259,7 @@ fn resolve_expr(expr: @ast::expr, cx: ctxt, visitor: visit::vt<ctxt>) {
|
||||
cx.sess.intr()));
|
||||
new_cx.parent = Some(expr.id);
|
||||
}
|
||||
ast::expr_match(subexpr, _) => {
|
||||
ast::expr_match(*) => {
|
||||
debug!("node %d: %s", expr.id, pprust::expr_to_str(expr,
|
||||
cx.sess.intr()));
|
||||
new_cx.parent = Some(expr.id);
|
||||
|
@ -628,7 +628,7 @@ fn compile_submatch(bcx: block, m: match_, vals: ~[ValueRef],
|
||||
kind = switch;
|
||||
}
|
||||
}
|
||||
lit(l) => {
|
||||
lit(_) => {
|
||||
test_val = Load(bcx, val);
|
||||
let pty = node_id_type(bcx, pat_id);
|
||||
kind = if ty::type_is_integral(pty) { switch }
|
||||
@ -940,7 +940,7 @@ fn bind_irrefutable_pat(bcx: block, pat: @ast::pat, val: ValueRef,
|
||||
// Grab the class data that we care about.
|
||||
let class_fields, class_id;
|
||||
match ty::get(node_id_type(bcx, pat.id)).struct {
|
||||
ty::ty_class(cid, substs) => {
|
||||
ty::ty_class(cid, _) => {
|
||||
class_id = cid;
|
||||
class_fields = ty::lookup_class_fields(ccx.tcx, class_id);
|
||||
}
|
||||
|
@ -2396,7 +2396,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, _, tps, _)) => {
|
||||
csearch::found(ast::ii_ctor(ctor, _, _, _)) => {
|
||||
ccx.external.insert(fn_id, Some(ctor.node.id));
|
||||
local_def(ctor.node.id)
|
||||
}
|
||||
@ -2440,7 +2440,7 @@ fn maybe_instantiate_inline(ccx: @crate_ctxt, fn_id: ast::def_id)
|
||||
}
|
||||
local_def(mth.id)
|
||||
}
|
||||
csearch::found(ast::ii_dtor(dtor, _, tps, _)) => {
|
||||
csearch::found(ast::ii_dtor(dtor, _, _, _)) => {
|
||||
ccx.external.insert(fn_id, Some(dtor.node.id));
|
||||
local_def(dtor.node.id)
|
||||
}
|
||||
@ -5425,7 +5425,7 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
|
||||
ccx.item_symbols.insert(i.id, s);
|
||||
g
|
||||
}
|
||||
ast::item_fn(decl, purity, _, _) => {
|
||||
ast::item_fn(_, purity, _, _) => {
|
||||
let llfn = if purity != ast::extern_fn {
|
||||
register_fn(ccx, i.span, my_path, i.id)
|
||||
} else {
|
||||
@ -5671,7 +5671,7 @@ fn push_rtcall(ccx: @crate_ctxt, name: ~str, did: ast::def_id) {
|
||||
fn gather_local_rtcalls(ccx: @crate_ctxt, crate: @ast::crate) {
|
||||
visit::visit_crate(*crate, (), visit::mk_simple_visitor(@{
|
||||
visit_item: |item| match item.node {
|
||||
ast::item_fn(decl, _, _, _) => {
|
||||
ast::item_fn(*) => {
|
||||
let attr_metas = attr::attr_metas(
|
||||
attr::find_attrs_by_name(item.attrs, ~"rt"));
|
||||
do vec::iter(attr_metas) |attr_meta| {
|
||||
|
@ -100,12 +100,12 @@ enum environment_value {
|
||||
|
||||
fn ev_to_str(ccx: @crate_ctxt, ev: environment_value) -> ~str {
|
||||
match ev {
|
||||
env_copy(v, t, lk) => fmt!("copy(%s,%s)", val_str(ccx.tn, v),
|
||||
env_copy(v, t, _) => fmt!("copy(%s,%s)", val_str(ccx.tn, v),
|
||||
ty_to_str(ccx.tcx, t)),
|
||||
env_move(v, t, lk) => fmt!("move(%s,%s)", val_str(ccx.tn, v),
|
||||
env_move(v, t, _) => fmt!("move(%s,%s)", val_str(ccx.tn, v),
|
||||
ty_to_str(ccx.tcx, t)),
|
||||
env_ref(v, t, lk) => fmt!("ref(%s,%s)", val_str(ccx.tn, v),
|
||||
ty_to_str(ccx.tcx, t))
|
||||
env_ref(v, t, _) => fmt!("ref(%s,%s)", val_str(ccx.tn, v),
|
||||
ty_to_str(ccx.tcx, t))
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,13 +224,13 @@ fn store_environment(bcx: block,
|
||||
let src = {bcx:bcx, val:val, kind:kind};
|
||||
bcx = move_val(bcx, INIT, bound_data, src, ty);
|
||||
}
|
||||
env_ref(val, ty, lv_owned) => {
|
||||
env_ref(val, _, lv_owned) => {
|
||||
debug!("> storing %s into %s",
|
||||
val_str(bcx.ccx().tn, val),
|
||||
val_str(bcx.ccx().tn, bound_data));
|
||||
Store(bcx, val, bound_data);
|
||||
}
|
||||
env_ref(val, ty, lv_owned_imm) => {
|
||||
env_ref(val, _, lv_owned_imm) => {
|
||||
let addr = do_spill_noroot(bcx, val);
|
||||
Store(bcx, addr, bound_data);
|
||||
}
|
||||
|
@ -755,7 +755,7 @@ fn trans_foreign_mod(ccx: @crate_ctxt,
|
||||
|
||||
for vec::each(foreign_mod.items) |foreign_item| {
|
||||
match foreign_item.node {
|
||||
ast::foreign_item_fn(fn_decl, purity, typarams) => {
|
||||
ast::foreign_item_fn(_, _, typarams) => {
|
||||
let id = foreign_item.id;
|
||||
if abi != ast::foreign_abi_rust_intrinsic {
|
||||
let llwrapfn = get_item_val(ccx, id);
|
||||
|
@ -258,12 +258,12 @@ fn trans_monomorphized_callee(bcx: block, callee_id: ast::node_id,
|
||||
ccx, node_id_type(bcx, callee_id))))
|
||||
with lval}
|
||||
}
|
||||
typeck::vtable_trait(trait_id, tps) => {
|
||||
typeck::vtable_trait(*) => {
|
||||
let {bcx, val} = trans_temp_expr(bcx, base);
|
||||
let fty = node_id_type(bcx, callee_id);
|
||||
trans_trait_callee(bcx, val, fty, n_method)
|
||||
}
|
||||
typeck::vtable_param(n_param, n_bound) => {
|
||||
typeck::vtable_param(*) => {
|
||||
fail ~"vtable_param left in monomorphized function's vtable substs";
|
||||
}
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t) -> ~[u8] {
|
||||
add_substr(s, shape_of(ccx, mt.ty));
|
||||
s
|
||||
}
|
||||
ty::ty_evec(mt, ty::vstore_uniq) => {
|
||||
ty::ty_evec(_, ty::vstore_uniq) => {
|
||||
shape_of(ccx, tvec::expand_boxed_vec_ty(ccx.tcx, t))
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t) -> ~[u8] {
|
||||
s
|
||||
}
|
||||
|
||||
ty::ty_estr(ty::vstore_slice(r)) => {
|
||||
ty::ty_estr(ty::vstore_slice(_)) => {
|
||||
let mut s = ~[shape_slice];
|
||||
let u8_t = ty::mk_mach_uint(ccx.tcx, ast::ty_u8);
|
||||
add_bool(s, true); // is_pod
|
||||
@ -299,7 +299,7 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t) -> ~[u8] {
|
||||
s
|
||||
}
|
||||
|
||||
ty::ty_evec(mt, ty::vstore_slice(r)) => {
|
||||
ty::ty_evec(mt, ty::vstore_slice(_)) => {
|
||||
let mut s = ~[shape_slice];
|
||||
add_bool(s, ty::type_is_pod(ccx.tcx, mt.ty));
|
||||
add_bool(s, false); // is_str
|
||||
|
@ -268,10 +268,10 @@ fn trans_vstore(bcx: block, e: @ast::expr,
|
||||
ast::expr_lit(@{node: ast::lit_str(s), span: _}) => {
|
||||
return trans_estr(bcx, s, Some(v), dest);
|
||||
}
|
||||
ast::expr_vec(es, mutbl) => {
|
||||
ast::expr_vec(es, _) => {
|
||||
return trans_evec(bcx, individual_evec(es), v, e.id, dest);
|
||||
}
|
||||
ast::expr_repeat(element, count_expr, mutbl) => {
|
||||
ast::expr_repeat(element, count_expr, _) => {
|
||||
let count = ty::eval_repeat_count(bcx.tcx(), count_expr, e.span);
|
||||
return trans_evec(bcx, repeating_evec(element, count), v, e.id, dest);
|
||||
}
|
||||
|
@ -1928,7 +1928,7 @@ fn is_instantiable(cx: ctxt, r_ty: t) -> bool {
|
||||
return type_requires(cx, seen, r_ty, mt.ty);
|
||||
}
|
||||
|
||||
ty_ptr(mt) => {
|
||||
ty_ptr(*) => {
|
||||
false // unsafe ptrs can always be NULL
|
||||
}
|
||||
|
||||
@ -2137,7 +2137,7 @@ fn type_is_enum(ty: t) -> bool {
|
||||
// constructors
|
||||
fn type_is_c_like_enum(cx: ctxt, ty: t) -> bool {
|
||||
match get(ty).struct {
|
||||
ty_enum(did, ref substs) => {
|
||||
ty_enum(did, _) => {
|
||||
let variants = enum_variants(cx, did);
|
||||
let some_n_ary = vec::any(*variants, |v| vec::len(v.args) > 0u);
|
||||
return !some_n_ary;
|
||||
|
Loading…
x
Reference in New Issue
Block a user