From cd440d338efa935713c92a56dc8eec67a703e521 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke <marijnh@gmail.com> Date: Thu, 18 Aug 2011 10:01:39 +0200 Subject: [PATCH] Remove or _-prefix all unused function arguments This should make the compilation process a bit less noisy. --- src/comp/back/link.rs | 10 +-- src/comp/back/upcall.rs | 14 ++--- src/comp/front/test.rs | 3 +- src/comp/lib/llvm.rs | 2 +- src/comp/metadata/decoder.rs | 2 +- src/comp/metadata/tydecode.rs | 4 +- src/comp/middle/alias.rs | 4 +- src/comp/middle/ast_map.rs | 2 +- src/comp/middle/freevars.rs | 4 +- src/comp/middle/resolve.rs | 22 ++++--- src/comp/middle/shape.rs | 6 +- src/comp/middle/trans.rs | 61 +++++++++---------- src/comp/middle/trans_alt.rs | 2 +- src/comp/middle/trans_common.rs | 4 +- src/comp/middle/trans_objects.rs | 4 +- src/comp/middle/tstate/auxiliary.rs | 10 +-- src/comp/middle/tstate/bitvectors.rs | 4 +- src/comp/middle/tstate/pre_post_conditions.rs | 4 +- src/comp/middle/ty.rs | 34 +++++------ src/comp/middle/typeck.rs | 24 ++++---- src/comp/syntax/ext/concat_idents.rs | 2 +- src/comp/syntax/ext/env.rs | 2 +- src/comp/syntax/ext/fmt.rs | 2 +- src/comp/syntax/ext/ident_to_str.rs | 2 +- src/comp/syntax/ext/log_syntax.rs | 2 +- src/comp/syntax/ext/simplext.rs | 18 +++--- src/comp/syntax/fold.rs | 52 ++++++++-------- src/comp/syntax/parse/parser.rs | 19 +++--- src/comp/syntax/print/pprust.rs | 2 +- src/comp/syntax/visit.rs | 42 ++++++------- src/lib/bitv.rs | 2 +- src/lib/getopts.rs | 2 +- src/lib/io.rs | 4 +- src/lib/list.rs | 2 +- src/lib/map.rs | 6 +- 35 files changed, 187 insertions(+), 192 deletions(-) diff --git a/src/comp/back/link.rs b/src/comp/back/link.rs index f94a9d0e273..11df59a7f43 100644 --- a/src/comp/back/link.rs +++ b/src/comp/back/link.rs @@ -313,7 +313,7 @@ fn build_link_meta(sess: &session::session, c: &ast::crate, output: &str, } // This calculates CMH as defined above - fn crate_meta_extras_hash(sha: sha1, crate: &ast::crate, + fn crate_meta_extras_hash(sha: sha1, _crate: &ast::crate, metas: &provided_metas) -> str { fn len_and_str(s: &str) -> str { ret #fmt("%u_%s", str::byte_len(s), s); @@ -349,7 +349,7 @@ fn build_link_meta(sess: &session::session, c: &ast::crate, output: &str, name, default)); } - fn crate_meta_name(sess: &session::session, crate: &ast::crate, + fn crate_meta_name(sess: &session::session, _crate: &ast::crate, output: &str, metas: &provided_metas) -> str { ret alt metas.name { some(v) { v } @@ -368,7 +368,7 @@ fn build_link_meta(sess: &session::session, c: &ast::crate, output: &str, }; } - fn crate_meta_vers(sess: &session::session, crate: &ast::crate, + fn crate_meta_vers(sess: &session::session, _crate: &ast::crate, metas: &provided_metas) -> str { ret alt metas.vers { some(v) { v } @@ -435,7 +435,7 @@ fn mangle(ss: &[str]) -> str { ret n; } -fn exported_name(path: &[str], hash: &str, vers: &str) -> str { +fn exported_name(path: &[str], hash: &str, _vers: &str) -> str { // FIXME: versioning isn't working yet ret mangle(path + ~[hash]); // + "@" + vers; @@ -459,7 +459,7 @@ fn mangle_internal_name_by_path_and_seq(ccx: &@crate_ctxt, path: &[str], ret mangle(path + ~[ccx.names.next(flav)]); } -fn mangle_internal_name_by_path(ccx: &@crate_ctxt, path: &[str]) -> str { +fn mangle_internal_name_by_path(_ccx: &@crate_ctxt, path: &[str]) -> str { ret mangle(path); } diff --git a/src/comp/back/upcall.rs b/src/comp/back/upcall.rs index f5fa9b02f8c..2edc027811c 100644 --- a/src/comp/back/upcall.rs +++ b/src/comp/back/upcall.rs @@ -50,23 +50,23 @@ type upcalls = dynastack_alloc: ValueRef, dynastack_free: ValueRef}; -fn declare_upcalls(tn: type_names, tydesc_type: TypeRef, +fn declare_upcalls(_tn: type_names, tydesc_type: TypeRef, taskptr_type: TypeRef, llmod: ModuleRef) -> @upcalls { - fn decl(tn: type_names, llmod: ModuleRef, name: str, tys: [TypeRef], + fn decl(llmod: ModuleRef, name: str, tys: [TypeRef], rv: TypeRef) -> ValueRef { let arg_tys: [TypeRef] = ~[]; for t: TypeRef in tys { arg_tys += ~[t]; } let fn_ty = T_fn(arg_tys, rv); ret trans::decl_cdecl_fn(llmod, "upcall_" + name, fn_ty); } - fn decl_with_taskptr(taskptr_type: TypeRef, tn: type_names, + fn decl_with_taskptr(taskptr_type: TypeRef, llmod: ModuleRef, name: str, tys: [TypeRef], rv: TypeRef) -> ValueRef { - ret decl(tn, llmod, name, ~[taskptr_type] + tys, rv); + ret decl(llmod, name, ~[taskptr_type] + tys, rv); } - let dv = bind decl_with_taskptr(taskptr_type, tn, llmod, _, _, T_void()); - let d = bind decl_with_taskptr(taskptr_type, tn, llmod, _, _, _); - let dr = bind decl(tn, llmod, _, _, _); + let dv = bind decl_with_taskptr(taskptr_type, llmod, _, _, T_void()); + let d = bind decl_with_taskptr(taskptr_type, llmod, _, _, _); + let dr = bind decl(llmod, _, _, _); let empty_vec: [TypeRef] = ~[]; ret @{grow_task: dv("grow_task", ~[T_size_t()]), diff --git a/src/comp/front/test.rs b/src/comp/front/test.rs index 36507cd6a00..ce172c0062f 100644 --- a/src/comp/front/test.rs +++ b/src/comp/front/test.rs @@ -51,7 +51,8 @@ fn modify_for_testing(crate: @ast::crate) -> @ast::crate { ret res; } -fn fold_mod(cx: &test_ctxt, m: &ast::_mod, fld: fold::ast_fold) -> ast::_mod { +fn fold_mod(_cx: &test_ctxt, m: &ast::_mod, fld: fold::ast_fold) + -> ast::_mod { // Remove any defined main function from the AST so it doesn't clash with // the one we're going to add. FIXME: This is sloppy. Instead we should diff --git a/src/comp/lib/llvm.rs b/src/comp/lib/llvm.rs index 4b8653088ee..9d80972ffb5 100644 --- a/src/comp/lib/llvm.rs +++ b/src/comp/lib/llvm.rs @@ -1264,7 +1264,7 @@ obj builder(B: BuilderRef, terminated: @mutable bool, ret llvm::LLVMBuildTruncOrBitCast(B, Val, DestTy, str::buf("")); } - fn Cast(Op: Opcode, Val: ValueRef, DestTy: TypeRef, Name: sbuf) -> + fn Cast(Op: Opcode, Val: ValueRef, DestTy: TypeRef, _Name: sbuf) -> ValueRef { assert (!*terminated); ret llvm::LLVMBuildCast(B, Op, Val, DestTy, str::buf("")); diff --git a/src/comp/metadata/decoder.rs b/src/comp/metadata/decoder.rs index 03a65dfd44c..dcb5fa2488d 100644 --- a/src/comp/metadata/decoder.rs +++ b/src/comp/metadata/decoder.rs @@ -224,7 +224,7 @@ fn get_symbol(data: @[u8], id: ast::node_id) -> str { ret item_symbol(lookup_item(id, data)); } -fn get_tag_variants(data: &@[u8], def: ast::def_id, tcx: &ty::ctxt, +fn get_tag_variants(_data: &@[u8], def: ast::def_id, tcx: &ty::ctxt, extres: &external_resolver) -> [ty::variant_info] { let external_crate_id = def.crate; let data = diff --git a/src/comp/metadata/tydecode.rs b/src/comp/metadata/tydecode.rs index 05e01d8af63..c753760e0a4 100644 --- a/src/comp/metadata/tydecode.rs +++ b/src/comp/metadata/tydecode.rs @@ -39,7 +39,7 @@ fn parse_ident(st: @pstate, sd: str_def, last: char) -> ast::ident { ret parse_ident_(st, sd, bind is_last(last, _)); } -fn parse_ident_(st: @pstate, sd: str_def, is_last: fn(char) -> bool ) -> +fn parse_ident_(st: @pstate, _sd: str_def, is_last: fn(char) -> bool ) -> ast::ident { let rslt = ""; while !is_last(peek(st) as char) { @@ -117,7 +117,7 @@ fn parse_path(st: @pstate, sd: str_def) -> ast::path { type arg_parser<T> = fn(@pstate, str_def) -> ast::constr_arg_general_<T> ; -fn parse_constr_arg(st: @pstate, sd: str_def) -> ast::fn_constr_arg { +fn parse_constr_arg(st: @pstate, _sd: str_def) -> ast::fn_constr_arg { alt peek(st) as char { '*' { st.pos += 1u; ret ast::carg_base; } c { diff --git a/src/comp/middle/alias.rs b/src/comp/middle/alias.rs index a9cd0a869b0..9edd0f14ba3 100644 --- a/src/comp/middle/alias.rs +++ b/src/comp/middle/alias.rs @@ -51,8 +51,8 @@ fn check_crate(tcx: ty::ctxt, crate: &@ast::crate) { tcx.sess.abort_if_errors(); } -fn visit_fn(cx: &@ctx, f: &ast::_fn, tp: &[ast::ty_param], sp: &span, - name: &fn_ident, id: ast::node_id, sc: &scope, v: &vt<scope>) { +fn visit_fn(cx: &@ctx, f: &ast::_fn, _tp: &[ast::ty_param], _sp: &span, + _name: &fn_ident, id: ast::node_id, sc: &scope, v: &vt<scope>) { visit::visit_fn_decl(f.decl, sc, v); for arg_: ast::arg in f.decl.inputs { cx.local_map.insert(arg_.id, arg(arg_.mode)); diff --git a/src/comp/middle/ast_map.rs b/src/comp/middle/ast_map.rs index a348787c761..cca7667a691 100644 --- a/src/comp/middle/ast_map.rs +++ b/src/comp/middle/ast_map.rs @@ -87,7 +87,7 @@ fn new_smallintmap_adapter<@K, ret smallintmap::find(map, key_idx(key)); } - fn remove(key: &K) -> option::t<V> { fail } + fn remove(_key: &K) -> option::t<V> { fail } fn rehash() { fail } diff --git a/src/comp/middle/freevars.rs b/src/comp/middle/freevars.rs index ccd932049a3..2822e404e50 100644 --- a/src/comp/middle/freevars.rs +++ b/src/comp/middle/freevars.rs @@ -44,8 +44,8 @@ fn collect_freevars(def_map: &resolve::def_map, sess: &session::session, for decl: ast::node_id in initial_decls { set_add(decls, decl); } let refs = @mutable ~[]; - let walk_fn = lambda(f: &ast::_fn, tps: &[ast::ty_param], sp: &span, - i: &ast::fn_ident, nid: ast::node_id) { + let walk_fn = lambda(f: &ast::_fn, _tps: &[ast::ty_param], _sp: &span, + _i: &ast::fn_ident, _nid: ast::node_id) { for a: ast::arg in f.decl.inputs { set_add(decls, a.id); } }; let walk_expr = lambda(expr: &@ast::expr) { diff --git a/src/comp/middle/resolve.rs b/src/comp/middle/resolve.rs index 9c1ad96a66b..8009100c68f 100644 --- a/src/comp/middle/resolve.rs +++ b/src/comp/middle/resolve.rs @@ -169,7 +169,7 @@ fn map_crate(e: &@env, c: &@ast::crate) { index: index_mod(c.node.module), mutable glob_imports: ~[], glob_imported_names: new_str_hash::<import_state>()}); - fn index_vi(e: @env, i: &@ast::view_item, sc: &scopes, v: &vt<scopes>) { + fn index_vi(e: @env, i: &@ast::view_item, sc: &scopes, _v: &vt<scopes>) { alt i.node { ast::view_item_import(name, ids, id) { e.imports.insert(id, todo(id, name, ids, i.span, sc)); @@ -215,7 +215,8 @@ fn map_crate(e: &@env, c: &@ast::crate) { with *visit::default_visitor::<scopes>()}; visit::visit_crate(*c, cons(scope_crate, @nil), visit::mk_vt(v_link_glob)); - fn link_glob(e: @env, vi: &@ast::view_item, sc: &scopes, v: &vt<scopes>) { + fn link_glob(e: @env, vi: &@ast::view_item, sc: &scopes, + _v: &vt<scopes>) { fn find_mod(e: @env, sc: scopes) -> @indexed_mod { alt sc { cons(scope_item(i), tl) { @@ -267,7 +268,7 @@ fn resolve_names(e: &@env, c: &@ast::crate) { visit_item: visit_item_with_scope, visit_block: visit_block_with_scope, visit_decl: visit_decl_with_scope, - visit_arm: bind walk_arm(e, _, _, _), + visit_arm: walk_arm, visit_pat: bind walk_pat(e, _, _, _), visit_expr: bind walk_expr(e, _, _, _), visit_ty: bind walk_ty(e, _, _, _), @@ -299,10 +300,10 @@ fn resolve_names(e: &@env, c: &@ast::crate) { } } fn walk_constr(e: @env, p: &ast::path, sp: &span, id: node_id, - sc: &scopes, v: &vt<scopes>) { + sc: &scopes, _v: &vt<scopes>) { maybe_insert(e, id, lookup_path_strict(*e, sc, sp, p.node, ns_value)); } - fn walk_arm(e: @env, a: &ast::arm, sc: &scopes, v: &vt<scopes>) { + fn walk_arm(a: &ast::arm, sc: &scopes, v: &vt<scopes>) { visit_arm_with_scope(a, sc, v); } fn walk_pat(e: &@env, pat: &@ast::pat, sc: &scopes, v: &vt<scopes>) { @@ -359,7 +360,7 @@ fn visit_fn_with_scope(e: &@env, f: &ast::_fn, tp: &[ast::ty_param], // for f's constrs in the table. for c: @ast::constr in f.decl.constraints { - resolve_constr(e, id, c, sc, v); + resolve_constr(e, c, sc, v); } visit::visit_fn(f, tp, sp, name, id, cons(scope_fn(f.decl, f.proto, tp), @sc), v); @@ -436,8 +437,7 @@ fn follow_import(e: &env, sc: &scopes, path: &[ident], sp: &span) -> } else { ret none; } } -fn resolve_constr(e: @env, id: node_id, c: &@ast::constr, sc: &scopes, - v: &vt<scopes>) { +fn resolve_constr(e: @env, c: &@ast::constr, sc: &scopes, _v: &vt<scopes>) { let new_def = lookup_path_strict(*e, sc, c.span, c.node.path.node, ns_value); if option::is_some(new_def) { @@ -921,7 +921,7 @@ fn lookup_in_mod(e: &env, m: &def, sp: &span, name: &ident, ns: namespace, } } -fn found_view_item(e: &env, vi: @ast::view_item, ns: namespace) -> +fn found_view_item(e: &env, vi: @ast::view_item) -> option::t<def> { alt vi.node { ast::view_item_use(_, _, id) { @@ -1040,7 +1040,9 @@ fn lookup_glob_in_mod(e: &env, info: @indexed_mod, sp: &span, id: &ident, fn lookup_in_mie(e: &env, mie: &mod_index_entry, ns: namespace) -> option::t<def> { alt mie { - mie_view_item(view_item) { ret found_view_item(e, view_item, ns); } + mie_view_item(view_item) { + if ns == ns_module { ret found_view_item(e, view_item); } + } mie_import_ident(id, _) { ret lookup_import(e, local_def(id), ns); } mie_item(item) { ret found_def_item(item, ns); } mie_tag_variant(item, variant_idx) { diff --git a/src/comp/middle/shape.rs b/src/comp/middle/shape.rs index 7927af71fe3..9c3c9176039 100644 --- a/src/comp/middle/shape.rs +++ b/src/comp/middle/shape.rs @@ -231,15 +231,15 @@ fn tag_kind(ccx : &@crate_ctxt, did : &ast::def_id) -> tag_kind { // Returns the code corresponding to the pointer size on this architecture. -fn s_int(tcx : &ty_ctxt) -> u8 { +fn s_int(_tcx : &ty_ctxt) -> u8 { ret shape_i32; // TODO: x86-64 } -fn s_uint(tcx : &ty_ctxt) -> u8 { +fn s_uint(_tcx : &ty_ctxt) -> u8 { ret shape_u32; // TODO: x86-64 } -fn s_float(tcx : &ty_ctxt) -> u8 { +fn s_float(_tcx : &ty_ctxt) -> u8 { ret shape_f64; // TODO: x86-64 } diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 3f5bea87bdc..a18b495a7bb 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -387,9 +387,8 @@ fn get_simple_extern_fn(externs: &hashmap<str, ValueRef>, llmod: ModuleRef, ret get_extern_fn(externs, llmod, name, lib::llvm::LLVMCCallConv, t); } -fn trans_native_call(b: &builder, glues: @glue_fns, lltaskptr: ValueRef, - externs: &hashmap<str, ValueRef>, tn: &type_names, - llmod: ModuleRef, name: &str, pass_task: bool, +fn trans_native_call(b: &builder, externs: &hashmap<str, ValueRef>, + llmod: ModuleRef, name: &str, args: &[ValueRef]) -> ValueRef { let n: int = std::vec::len::<ValueRef>(args) as int; let llnative: ValueRef = get_simple_extern_fn(externs, llmod, name, n); @@ -1933,7 +1932,7 @@ fn iter_sequence_inner(cx: &@block_ctxt, src: ValueRef, elt_ty: & // elt* ty::t, f: &val_and_ty_fn) -> result { fn adaptor_fn(f: val_and_ty_fn, elt_ty: ty::t, cx: &@block_ctxt, - dst: ValueRef, src: ValueRef) -> result { + _dst: ValueRef, src: ValueRef) -> result { let llptrty; if !ty::type_has_dynamic_size(bcx_tcx(cx), elt_ty) { let llty = type_of(bcx_ccx(cx), cx.sp, elt_ty); @@ -2537,7 +2536,7 @@ fn trans_unary(cx: &@block_ctxt, op: ast::unop, e: &@ast::expr, } fn trans_compare(cx: &@block_ctxt, op: ast::binop, - lhs: ValueRef, lhs_t: ty::t, rhs: ValueRef, + lhs: ValueRef, _lhs_t: ty::t, rhs: ValueRef, rhs_t: ty::t) -> result { // Determine the operation we need. let llop; @@ -3398,8 +3397,8 @@ fn join_branches(parent_cx: &@block_ctxt, ins: &[result]) -> @block_ctxt { tag out_method { return; save_in(ValueRef); } fn trans_if(cx: &@block_ctxt, cond: &@ast::expr, thn: &ast::blk, - els: &option::t<@ast::expr>, id: ast::node_id, - output: &out_method) -> result { + els: &option::t<@ast::expr>, output: &out_method) + -> result { let cond_res = trans_expr(cx, cond); if (ty::type_is_bot(bcx_tcx(cx), ty::expr_ty(bcx_tcx(cx), cond))) { @@ -3866,8 +3865,7 @@ fn lval_generic_fn(cx: &@block_ctxt, tpt: &ty::ty_param_kinds_and_ty, ret lv; } -fn lookup_discriminant(lcx: &@local_ctxt, tid: &ast::def_id, - vid: &ast::def_id) -> ValueRef { +fn lookup_discriminant(lcx: &@local_ctxt, vid: &ast::def_id) -> ValueRef { alt lcx.ccx.discrims.find(vid.node) { none. { // It's an external discriminant that we haven't seen yet. @@ -3929,7 +3927,7 @@ fn trans_var(cx: &@block_ctxt, sp: &span, id: ast::node_id) -> let bcx = alloc_result.bcx; let lltagptr = bcx.build.PointerCast(lltagblob, T_ptr(lltagty)); if std::vec::len(ty::tag_variants(ccx.tcx, tid)) != 1u { - let lldiscrim_gv = lookup_discriminant(bcx.fcx.lcx, tid, vid); + let lldiscrim_gv = lookup_discriminant(bcx.fcx.lcx, vid); let lldiscrim = bcx.build.Load(lldiscrim_gv); let lldiscrimptr = bcx.build.GEP(lltagptr, ~[C_int(0), C_int(0)]); @@ -3968,7 +3966,7 @@ fn trans_path(cx: &@block_ctxt, p: &ast::path, id: ast::node_id) -> } fn trans_field(cx: &@block_ctxt, sp: &span, v: ValueRef, t0: &ty::t, - field: &ast::ident, id: ast::node_id) -> lval_result { + field: &ast::ident) -> lval_result { let r = autoderef(cx, v, t0); let t = r.ty; alt ty::struct(bcx_tcx(cx), t) { @@ -4085,7 +4083,7 @@ fn trans_lval_gen(cx: &@block_ctxt, e: &@ast::expr) -> lval_result { ast::expr_field(base, ident) { let r = trans_expr(cx, base); let t = ty::expr_ty(bcx_tcx(cx), base); - ret trans_field(r.bcx, e.span, r.val, t, ident, e.id); + ret trans_field(r.bcx, e.span, r.val, t, ident); } ast::expr_index(base, idx) { ret trans_index(cx, e.span, base, idx, e.id); @@ -4123,7 +4121,7 @@ fn trans_lval_gen(cx: &@block_ctxt, e: &@ast::expr) -> lval_result { some(pair) { let r = pair.v; let t = pair.t; - ret trans_field(cx, e.span, r, t, ident, e.id); + ret trans_field(cx, e.span, r, t, ident); } _ { // Shouldn't happen. @@ -4237,8 +4235,7 @@ fn trans_cast(cx: &@block_ctxt, e: &@ast::expr, id: ast::node_id) -> result { fn trans_bind_thunk(cx: &@local_ctxt, sp: &span, incoming_fty: &ty::t, outgoing_fty: &ty::t, args: &[option::t<@ast::expr>], - env_ty: &ty::t, bound_tys: &[ty::t], - ty_param_count: uint, + env_ty: &ty::t, ty_param_count: uint, target_fn: &option::t<ValueRef>) -> {val: ValueRef, ty: TypeRef} { @@ -4494,7 +4491,7 @@ fn trans_bind_1(cx: &@block_ctxt, f: &@ast::expr, f_res: &lval_result, let pair_ty = node_id_type(bcx_ccx(cx), id); let llthunk = trans_bind_thunk(cx.fcx.lcx, cx.sp, pair_ty, outgoing_fty_real, - args, closure.ptrty, bound_tys, ty_param_count, + args, closure.ptrty, ty_param_count, target_res); // Construct the function pair @@ -4994,11 +4991,11 @@ fn trans_expr_out(cx: &@block_ctxt, e: &@ast::expr, output: out_method) -> } ast::expr_binary(op, x, y) { ret trans_binary(cx, op, x, y); } ast::expr_if(cond, thn, els) { - ret with_out_method(bind trans_if(cx, cond, thn, els, e.id, _), cx, + ret with_out_method(bind trans_if(cx, cond, thn, els, _), cx, e.id, output); } ast::expr_if_check(cond, thn, els) { - ret with_out_method(bind trans_if(cx, cond, thn, els, e.id, _), cx, + ret with_out_method(bind trans_if(cx, cond, thn, els, _), cx, e.id, output); } ast::expr_ternary(_, _, _) { @@ -5011,8 +5008,8 @@ fn trans_expr_out(cx: &@block_ctxt, e: &@ast::expr, output: out_method) -> ast::expr_while(cond, body) { ret trans_while(cx, cond, body); } ast::expr_do_while(body, cond) { ret trans_do_while(cx, body, cond); } ast::expr_alt(expr, arms) { - ret with_out_method(bind trans_alt::trans_alt(cx, expr, arms, e.id, - _), cx, e.id, output); + ret with_out_method(bind trans_alt::trans_alt(cx, expr, arms, _), + cx, e.id, output); } ast::expr_fn(f) { let ccx = bcx_ccx(cx); @@ -5911,8 +5908,7 @@ fn create_llargs_for_fn_args(cx: &@fn_ctxt, proto: ast::proto, } } -fn copy_args_to_allocas(fcx: @fn_ctxt, args: &[ast::arg], - arg_tys: &[ty::arg]) { +fn copy_args_to_allocas(fcx: @fn_ctxt, args: &[ast::arg]) { let bcx = new_raw_block_ctxt(fcx, fcx.llcopyargs); let arg_n: uint = 0u; for aarg: ast::arg in args { @@ -6050,7 +6046,7 @@ fn trans_closure(bcx_maybe: &option::t<@block_ctxt>, _ { } } let arg_tys = arg_tys_of_fn(fcx.lcx.ccx, id); - copy_args_to_allocas(fcx, f.decl.inputs, arg_tys); + copy_args_to_allocas(fcx, f.decl.inputs); // Figure out if we need to build a closure and act accordingly let res = alt f.proto { @@ -6203,7 +6199,7 @@ fn trans_tag_variant(cx: @local_ctxt, tag_id: ast::node_id, i += 1u; } let arg_tys = arg_tys_of_fn(cx.ccx, variant.node.id); - copy_args_to_allocas(fcx, fn_args, arg_tys); + copy_args_to_allocas(fcx, fn_args); let bcx = new_top_block_ctxt(fcx); let lltop = bcx.llbb; @@ -6356,7 +6352,7 @@ fn decl_fn_and_pair(ccx: &@crate_ctxt, sp: &span, path: &[str], flav: str, } fn decl_fn_and_pair_full(ccx: &@crate_ctxt, sp: &span, path: &[str], - flav: str, ty_params: &[ast::ty_param], + _flav: str, ty_params: &[ast::ty_param], node_id: ast::node_id, node_type: ty::t) { let llfty = type_of_fn_from_ty(ccx, sp, node_type, std::vec::len(ty_params)); @@ -6690,7 +6686,7 @@ fn decl_native_fn_and_pair(ccx: &@crate_ctxt, sp: &span, path: &[str], fn trans_simple_native_abi(bcx: &@block_ctxt, name: str, call_args: &mutable [ValueRef], fn_type: ty::t, - first_arg_n: uint, uses_retptr: bool, cc: uint) + uses_retptr: bool, cc: uint) -> {val: ValueRef, rptr: ValueRef} { let call_arg_tys: [TypeRef] = ~[]; for arg: ValueRef in call_args { call_arg_tys += ~[val_ty(arg)]; } @@ -6738,7 +6734,7 @@ fn decl_native_fn_and_pair(ccx: &@crate_ctxt, sp: &span, path: &[str], alt abi { ast::native_abi_llvm. { let result = - trans_simple_native_abi(bcx, name, call_args, fn_type, arg_n, + trans_simple_native_abi(bcx, name, call_args, fn_type, uses_retptr, lib::llvm::LLVMCCallConv); r = result.val; rptr = result.rptr; @@ -6747,14 +6743,13 @@ fn decl_native_fn_and_pair(ccx: &@crate_ctxt, sp: &span, path: &[str], let external_name = "rust_intrinsic_" + name; let result = trans_simple_native_abi(bcx, external_name, call_args, fn_type, - arg_n, uses_retptr, - lib::llvm::LLVMCCallConv); + uses_retptr, lib::llvm::LLVMCCallConv); r = result.val; rptr = result.rptr; } ast::native_abi_x86stdcall. { let result = - trans_simple_native_abi(bcx, name, call_args, fn_type, arg_n, + trans_simple_native_abi(bcx, name, call_args, fn_type, uses_retptr, lib::llvm::LLVMX86StdcallCallConv); r = result.val; @@ -6762,8 +6757,8 @@ fn decl_native_fn_and_pair(ccx: &@crate_ctxt, sp: &span, path: &[str], } _ { r = - trans_native_call(bcx.build, ccx.glues, lltaskptr, ccx.externs, - ccx.tn, ccx.llmod, name, pass_task, call_args); + trans_native_call(bcx.build, ccx.externs, + ccx.llmod, name, call_args); rptr = bcx.build.BitCast(fcx.llretptr, T_ptr(T_i32())); } } @@ -6783,7 +6778,7 @@ fn decl_native_fn_and_pair(ccx: &@crate_ctxt, sp: &span, path: &[str], fn item_path(item: &@ast::item) -> [str] { ret ~[item.ident]; } fn collect_native_item(ccx: @crate_ctxt, i: &@ast::native_item, pt: &[str], - v: &vt<[str]>) { + _v: &vt<[str]>) { alt i.node { ast::native_item_fn(_, _, _) { if !ccx.obj_methods.contains_key(i.id) { diff --git a/src/comp/middle/trans_alt.rs b/src/comp/middle/trans_alt.rs index 78200726b2d..ec029e6dd98 100644 --- a/src/comp/middle/trans_alt.rs +++ b/src/comp/middle/trans_alt.rs @@ -460,7 +460,7 @@ fn make_phi_bindings(bcx: &@block_ctxt, map: &[exit_node], } fn trans_alt(cx: &@block_ctxt, expr: &@ast::expr, arms: &[ast::arm], - id: ast::node_id, output: &trans::out_method) -> result { + output: &trans::out_method) -> result { let bodies = ~[]; let match: match = ~[]; let er = trans::trans_expr(cx, expr); diff --git a/src/comp/middle/trans_common.rs b/src/comp/middle/trans_common.rs index cf87d56424a..8323d1d5737 100644 --- a/src/comp/middle/trans_common.rs +++ b/src/comp/middle/trans_common.rs @@ -692,12 +692,12 @@ fn T_str() -> TypeRef { ret T_vec(T_i8()); } fn T_box(t: TypeRef) -> TypeRef { ret T_struct(~[T_int(), t]); } -fn T_port(t: TypeRef) -> TypeRef { +fn T_port(_t: TypeRef) -> TypeRef { ret T_struct(~[T_int()]); // Refcount } -fn T_chan(t: TypeRef) -> TypeRef { +fn T_chan(_t: TypeRef) -> TypeRef { ret T_struct(~[T_int()]); // Refcount } diff --git a/src/comp/middle/trans_objects.rs b/src/comp/middle/trans_objects.rs index 6f1b7f14478..8a95fb90334 100644 --- a/src/comp/middle/trans_objects.rs +++ b/src/comp/middle/trans_objects.rs @@ -55,7 +55,7 @@ fn trans_obj(cx: @local_ctxt, sp: &span, ob: &ast::_obj, ty::ret_ty_of_fn(ccx.tcx, ctor_id), fn_args, ty_params); let arg_tys: [ty::arg] = arg_tys_of_fn(ccx, ctor_id); - copy_args_to_allocas(fcx, fn_args, arg_tys); + copy_args_to_allocas(fcx, fn_args); // Create the first block context in the function and keep a handle on it // to pass to finish_fn later. @@ -601,7 +601,7 @@ fn finish_vtbl(cx: @local_ctxt, llmethods: [ValueRef], name: str) // returns the value returned from that call. fn process_bkwding_mthd(cx: @local_ctxt, sp: &span, m: @ty::method, ty_params: &[ast::ty_param], outer_obj_ty: ty::t, - additional_field_tys: &[ty::t]) -> ValueRef { + _additional_field_tys: &[ty::t]) -> ValueRef { // Create a local context that's aware of the name of the method we're // creating. diff --git a/src/comp/middle/tstate/auxiliary.rs b/src/comp/middle/tstate/auxiliary.rs index 30799bdbc95..3e5b25ec5ee 100644 --- a/src/comp/middle/tstate/auxiliary.rs +++ b/src/comp/middle/tstate/auxiliary.rs @@ -740,7 +740,7 @@ fn find_instance_(pattern: &[constr_arg_general_<inst>], type inst = {ident: ident, node: node_id}; type subst = [{from: inst, to: inst}]; -fn find_instances(fcx: &fn_ctxt, subst: &subst, c: &constraint) -> +fn find_instances(_fcx: &fn_ctxt, subst: &subst, c: &constraint) -> [{from: uint, to: uint}] { let rslt = ~[]; @@ -996,7 +996,7 @@ fn any_eq(v: &[node_id], d: node_id) -> bool { false } -fn constraint_mentions(fcx: &fn_ctxt, c: &norm_constraint, v: node_id) -> +fn constraint_mentions(_fcx: &fn_ctxt, c: &norm_constraint, v: node_id) -> bool { ret alt c.c.node { ninit(id, _) { v == id } @@ -1004,7 +1004,7 @@ fn constraint_mentions(fcx: &fn_ctxt, c: &norm_constraint, v: node_id) -> }; } -fn non_init_constraint_mentions(fcx: &fn_ctxt, c: &norm_constraint, +fn non_init_constraint_mentions(_fcx: &fn_ctxt, c: &norm_constraint, v: &node_id) -> bool { ret alt c.c.node { ninit(_, _) { false } @@ -1051,8 +1051,8 @@ fn op_to_oper_ty(io: init_op) -> oper_type { } // default function visitor -fn do_nothing<T>(f: &_fn, tp: &[ty_param], sp: &span, i: &fn_ident, - iid: node_id, cx: &T, v: &visit::vt<T>) { +fn do_nothing<T>(_f: &_fn, _tp: &[ty_param], _sp: &span, _i: &fn_ident, + _iid: node_id, _cx: &T, _v: &visit::vt<T>) { } diff --git a/src/comp/middle/tstate/bitvectors.rs b/src/comp/middle/tstate/bitvectors.rs index 7ead3a9d836..6e45902dfcf 100644 --- a/src/comp/middle/tstate/bitvectors.rs +++ b/src/comp/middle/tstate/bitvectors.rs @@ -165,8 +165,8 @@ fn relax_precond_block(fcx: &fn_ctxt, i: node_id, b:&blk) { @{visit_block: relax_precond_block_inner, visit_expr: relax_precond_expr, visit_stmt: relax_precond_stmt, - visit_item: (fn (i: &@item, cx: &relax_ctxt, - vt: &visit::vt<relax_ctxt>) {}) + visit_item: (fn (_i: &@item, _cx: &relax_ctxt, + _vt: &visit::vt<relax_ctxt>) {}) with *visitor}; let v1 = visit::mk_vt(visitor); v1.visit_block(b, cx, v1); diff --git a/src/comp/middle/tstate/pre_post_conditions.rs b/src/comp/middle/tstate/pre_post_conditions.rs index af6614d8deb..958687bfb00 100644 --- a/src/comp/middle/tstate/pre_post_conditions.rs +++ b/src/comp/middle/tstate/pre_post_conditions.rs @@ -45,12 +45,12 @@ import util::common::log_block; import syntax::codemap::span; import util::ppaux::fn_ident_to_string; -fn find_pre_post_mod(m: &_mod) -> _mod { +fn find_pre_post_mod(_m: &_mod) -> _mod { log "implement find_pre_post_mod!"; fail; } -fn find_pre_post_native_mod(m: &native_mod) -> native_mod { +fn find_pre_post_native_mod(_m: &native_mod) -> native_mod { log "implement find_pre_post_native_mod"; fail; } diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index c7de964bb8d..ca2bfe9ca9c 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -421,7 +421,7 @@ fn mk_ctxt(s: session::session, dm: resolve::def_map, amap: ast_map::map, // Type constructors -fn mk_raw_ty(cx: &ctxt, st: &sty, in_cname: &option::t<str>) -> @raw_t { +fn mk_raw_ty(cx: &ctxt, st: &sty, _in_cname: &option::t<str>) -> @raw_t { let cname = none; let h = hash_type_info(st, cname); let has_params: bool = false; @@ -516,19 +516,19 @@ fn gen_ty_full(cx: &ctxt, st: &sty, cname: &option::t<str>) -> t { // use the mk_foo() functions below. fn gen_ty(cx: &ctxt, st: &sty) -> t { ret gen_ty_full(cx, st, none); } -fn mk_nil(cx: &ctxt) -> t { ret idx_nil; } +fn mk_nil(_cx: &ctxt) -> t { ret idx_nil; } -fn mk_bot(cx: &ctxt) -> t { ret idx_bot; } +fn mk_bot(_cx: &ctxt) -> t { ret idx_bot; } -fn mk_bool(cx: &ctxt) -> t { ret idx_bool; } +fn mk_bool(_cx: &ctxt) -> t { ret idx_bool; } -fn mk_int(cx: &ctxt) -> t { ret idx_int; } +fn mk_int(_cx: &ctxt) -> t { ret idx_int; } -fn mk_float(cx: &ctxt) -> t { ret idx_float; } +fn mk_float(_cx: &ctxt) -> t { ret idx_float; } -fn mk_uint(cx: &ctxt) -> t { ret idx_uint; } +fn mk_uint(_cx: &ctxt) -> t { ret idx_uint; } -fn mk_mach(cx: &ctxt, tm: &ast::ty_mach) -> t { +fn mk_mach(_cx: &ctxt, tm: &ast::ty_mach) -> t { alt tm { ast::ty_u8. { ret idx_u8; } ast::ty_u16. { ret idx_u16; } @@ -543,11 +543,11 @@ fn mk_mach(cx: &ctxt, tm: &ast::ty_mach) -> t { } } -fn mk_char(cx: &ctxt) -> t { ret idx_char; } +fn mk_char(_cx: &ctxt) -> t { ret idx_char; } -fn mk_str(cx: &ctxt) -> t { ret idx_str; } +fn mk_str(_cx: &ctxt) -> t { ret idx_str; } -fn mk_istr(cx: &ctxt) -> t { ret idx_istr; } +fn mk_istr(_cx: &ctxt) -> t { ret idx_istr; } fn mk_tag(cx: &ctxt, did: &ast::def_id, tys: &[t]) -> t { ret gen_ty(cx, ty_tag(did, tys)); @@ -604,7 +604,7 @@ fn mk_param(cx: &ctxt, n: uint, k: ast::kind) -> t { ret gen_ty(cx, ty_param(n, k)); } -fn mk_type(cx: &ctxt) -> t { ret idx_type; } +fn mk_type(_cx: &ctxt) -> t { ret idx_type; } fn mk_native(cx: &ctxt, did: &def_id) -> t { ret gen_ty(cx, ty_native(did)); } @@ -2208,7 +2208,7 @@ mod unify { fn_common_res_err(result); fn_common_res_ok([arg], t); } - fn unify_fn_common(cx: &@ctxt, expected: &t, actual: &t, + fn unify_fn_common(cx: &@ctxt, _expected: &t, _actual: &t, expected_inputs: &[arg], expected_output: &t, actual_inputs: &[arg], actual_output: &t) -> fn_common_res { @@ -2251,7 +2251,7 @@ mod unify { expected: &t, actual: &t, expected_inputs: &[arg], expected_output: &t, actual_inputs: &[arg], actual_output: &t, expected_cf: &controlflow, actual_cf: &controlflow, - expected_constrs: &[@constr], actual_constrs: &[@constr]) + _expected_constrs: &[@constr], actual_constrs: &[@constr]) -> result { if e_proto != a_proto { ret ures_err(terr_mismatch); } alt expected_cf { @@ -2858,7 +2858,7 @@ fn bind_params_in_type(sp: &span, cx: &ctxt, next_ty_var: fn() -> int , let i = 0u; while i < ty_param_count { *param_var_ids += ~[next_ty_var()]; i += 1u; } fn binder(sp: span, cx: ctxt, param_var_ids: @mutable [int], - next_ty_var: fn() -> int , index: uint, kind: ast::kind) -> t { + _next_ty_var: fn() -> int , index: uint, _kind: ast::kind) -> t { if index < vec::len(*param_var_ids) { ret mk_var(cx, param_var_ids.(index)); } else { @@ -2878,8 +2878,8 @@ fn bind_params_in_type(sp: &span, cx: &ctxt, next_ty_var: fn() -> int , // substitions. fn substitute_type_params(cx: &ctxt, substs: &[ty::t], typ: t) -> t { if !type_contains_params(cx, typ) { ret typ; } - fn substituter(cx: ctxt, substs: @[ty::t], idx: uint, - kind: ast::kind) -> t { + fn substituter(_cx: ctxt, substs: @[ty::t], idx: uint, + _kind: ast::kind) -> t { // FIXME: bounds check can fail ret substs.(idx); } diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index d2e4639618d..901edf3b372 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -234,7 +234,7 @@ fn structure_of(fcx: &@fn_ctxt, sp: &span, typ: ty::t) -> ty::sty { // Returns the one-level-deep structure of the given type or none if it // is not known yet. -fn structure_of_maybe(fcx: &@fn_ctxt, sp: &span, typ: ty::t) -> +fn structure_of_maybe(fcx: &@fn_ctxt, _sp: &span, typ: ty::t) -> option::t<ty::sty> { let r = ty::unify::resolve_type_structure(fcx.ccx.tcx, fcx.var_bindings, typ); @@ -1040,7 +1040,7 @@ fn are_compatible(fcx: &@fn_ctxt, expected: &ty::t, actual: &ty::t) -> bool { // Returns the types of the arguments to a tag variant. -fn variant_arg_types(ccx: &@crate_ctxt, sp: &span, vid: &ast::def_id, +fn variant_arg_types(ccx: &@crate_ctxt, _sp: &span, vid: &ast::def_id, tag_ty_params: &[ty::t]) -> [ty::t] { let result: [ty::t] = ~[]; let tpt = ty::lookup_item_type(ccx.tcx, vid); @@ -1160,7 +1160,7 @@ mod writeback { } visit::visit_local(l, wbcx, v); } - fn visit_item(item: &@ast::item, wbcx: &wb_ctxt, v: &wb_vt) { + fn visit_item(_item: &@ast::item, _wbcx: &wb_ctxt, _v: &wb_vt) { // Ignore items } @@ -1282,10 +1282,10 @@ fn gather_locals(ccx: &@crate_ctxt, f: &ast::_fn, id: &ast::node_id, }; // Don't descend into fns and items - fn visit_fn<E>(f: &ast::_fn, tp: &[ast::ty_param], sp: &span, - i: &ast::fn_ident, id: ast::node_id, e: &E, - v: &visit::vt<E>) { } - fn visit_item<E>(i: &@ast::item, e: &E, v: &visit::vt<E>) { } + fn visit_fn<E>(_f: &ast::_fn, _tp: &[ast::ty_param], _sp: &span, + _i: &ast::fn_ident, _id: ast::node_id, _e: &E, + _v: &visit::vt<E>) { } + fn visit_item<E>(_i: &@ast::item, _e: &E, _v: &visit::vt<E>) { } let visit = @{visit_local: visit_local, @@ -1521,8 +1521,8 @@ type unifier = fn(fcx: &@fn_ctxt, sp: &span, expected: &ty::t, actual: &ty::t) -> ty::t; fn check_expr(fcx: &@fn_ctxt, expr: &@ast::expr) -> bool { - fn dummy_unify(fcx: &@fn_ctxt, sp: &span, - expected: &ty::t, actual: &ty::t) -> ty::t { + fn dummy_unify(_fcx: &@fn_ctxt, _sp: &span, + _expected: &ty::t, actual: &ty::t) -> ty::t { actual } ret check_expr_with_unifier(fcx, expr, dummy_unify, 0u); @@ -1639,7 +1639,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, } // A generic function for checking assignment expressions - fn check_assignment(fcx: &@fn_ctxt, sp: &span, lhs: &@ast::expr, + fn check_assignment(fcx: &@fn_ctxt, _sp: &span, lhs: &@ast::expr, rhs: &@ast::expr, id: &ast::node_id) -> bool { let t = next_ty_var(fcx); let bot = check_expr_with(fcx, lhs, t) | check_expr_with(fcx, rhs, t); @@ -1749,7 +1749,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, // or if-check fn check_then_else(fcx: &@fn_ctxt, thn: &ast::blk, elsopt: &option::t<@ast::expr>, id: ast::node_id, - sp: &span) -> bool { + _sp: &span) -> bool { let then_bot = check_block(fcx, thn); let els_bot = false; let if_t = @@ -2561,7 +2561,7 @@ fn check_block(fcx: &@fn_ctxt, blk: &ast::blk) -> bool { ret bot; } -fn check_const(ccx: &@crate_ctxt, sp: &span, e: &@ast::expr, +fn check_const(ccx: &@crate_ctxt, _sp: &span, e: &@ast::expr, id: &ast::node_id) { // FIXME: this is kinda a kludge; we manufacture a fake function context // and statement context for checking the initializer expression. diff --git a/src/comp/syntax/ext/concat_idents.rs b/src/comp/syntax/ext/concat_idents.rs index 43ec2488816..61eb791f6e0 100644 --- a/src/comp/syntax/ext/concat_idents.rs +++ b/src/comp/syntax/ext/concat_idents.rs @@ -3,7 +3,7 @@ import base::*; import syntax::ast; fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr, - body: option::t<str>) -> @ast::expr { + _body: option::t<str>) -> @ast::expr { let args: [@ast::expr] = alt arg.node { ast::expr_vec(elts, _, _) { elts } _ { cx.span_fatal(sp, "#concat_idents requires a vector argument .") } diff --git a/src/comp/syntax/ext/env.rs b/src/comp/syntax/ext/env.rs index 0ec14a1a399..142bff8f7dc 100644 --- a/src/comp/syntax/ext/env.rs +++ b/src/comp/syntax/ext/env.rs @@ -11,7 +11,7 @@ import base::*; export expand_syntax_ext; fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr, - body: option::t<str>) -> @ast::expr { + _body: option::t<str>) -> @ast::expr { let args: [@ast::expr] = alt arg.node { ast::expr_vec(elts, _, _) { elts } _ { cx.span_fatal(sp, "#env requires arguments of the form `[...]`.") } diff --git a/src/comp/syntax/ext/fmt.rs b/src/comp/syntax/ext/fmt.rs index 2dd607d1cfb..33c8cebb183 100644 --- a/src/comp/syntax/ext/fmt.rs +++ b/src/comp/syntax/ext/fmt.rs @@ -16,7 +16,7 @@ import codemap::span; export expand_syntax_ext; fn expand_syntax_ext(cx: &ext_ctxt, sp: span, arg: @ast::expr, - body: option::t<str>) -> @ast::expr { + _body: option::t<str>) -> @ast::expr { let args: [@ast::expr] = alt arg.node { ast::expr_vec(elts, _, _) { elts } _ { cx.span_fatal(sp, "#fmt requires arguments of the form `[...]`.") } diff --git a/src/comp/syntax/ext/ident_to_str.rs b/src/comp/syntax/ext/ident_to_str.rs index 41ef3e976ea..2681228976d 100644 --- a/src/comp/syntax/ext/ident_to_str.rs +++ b/src/comp/syntax/ext/ident_to_str.rs @@ -4,7 +4,7 @@ import base::*; import syntax::ast; fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr, - body: option::t<str>) -> @ast::expr { + _body: option::t<str>) -> @ast::expr { let args: [@ast::expr] = alt arg.node { ast::expr_vec(elts, _, _) { elts } _ { cx.span_fatal(sp, "#ident_to_str requires a vector argument .") } diff --git a/src/comp/syntax/ext/log_syntax.rs b/src/comp/syntax/ext/log_syntax.rs index 34c240a985c..f0834f4f079 100644 --- a/src/comp/syntax/ext/log_syntax.rs +++ b/src/comp/syntax/ext/log_syntax.rs @@ -3,7 +3,7 @@ import base::*; import syntax::ast; fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr, - body: option::t<str>) -> @ast::expr { + _body: option::t<str>) -> @ast::expr { cx.print_backtrace(); std::io::stdout().write_line(print::pprust::expr_to_str(arg)); diff --git a/src/comp/syntax/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs index a0443aeee82..dbe3920f4e8 100644 --- a/src/comp/syntax/ext/simplext.rs +++ b/src/comp/syntax/ext/simplext.rs @@ -159,7 +159,7 @@ type binders = mutable literal_ast_matchers: [selector]}; type bindings = hashmap<ident, arb_depth<matchable>>; -fn acumm_bindings(cx: &ext_ctxt, b_dest: &bindings, b_src: &bindings) { } +fn acumm_bindings(_cx: &ext_ctxt, _b_dest: &bindings, _b_src: &bindings) { } /* these three functions are the big moving parts */ @@ -204,7 +204,7 @@ fn use_selectors_to_bind(b: &binders, e: @expr) -> option::t<bindings> { fn transcribe(cx: &ext_ctxt, b: &bindings, body: @expr) -> @expr { let idx_path: @mutable [uint] = @mutable ~[]; - fn new_id(old: node_id, cx: &ext_ctxt) -> node_id { ret cx.next_id(); } + fn new_id(_old: node_id, cx: &ext_ctxt) -> node_id { ret cx.next_id(); } fn new_span(cx: &ext_ctxt, sp: &span) -> span { /* this discards information in the case of macro-defining macros */ ret {lo: sp.lo, hi: sp.hi, expanded_from: cx.backtrace()}; @@ -263,7 +263,7 @@ fn follow_for_trans(cx: &ext_ctxt, mmaybe: &option::t<arb_depth<matchable>>, /* helper for transcribe_exprs: what vars from `b` occur in `e`? */ iter free_vars(b: &bindings, e: @expr) -> ident { let idents: hashmap<ident, ()> = new_str_hash::<()>(); - fn mark_ident(i: &ident, fld: ast_fold, b: &bindings, + fn mark_ident(i: &ident, _fld: ast_fold, b: &bindings, idents: &hashmap<ident, ()>) -> ident { if b.contains_key(i) { idents.insert(i, ()); } ret i; @@ -344,7 +344,7 @@ fn transcribe_exprs(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint], // substitute, in a position that's required to be an ident fn transcribe_ident(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint], - i: &ident, fld: ast_fold) -> ident { + i: &ident, _fld: ast_fold) -> ident { ret alt follow_for_trans(cx, b.find(i), idx_path) { some(match_ident(a_id)) { a_id.node } some(m) { match_error(cx, m, "an identifier") } @@ -354,7 +354,7 @@ fn transcribe_ident(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint], fn transcribe_path(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint], - p: &path_, fld: ast_fold) -> path_ { + p: &path_, _fld: ast_fold) -> path_ { // Don't substitute into qualified names. if vec::len(p.types) > 0u || vec::len(p.idents) != 1u { ret p; } ret alt follow_for_trans(cx, b.find(p.idents.(0)), idx_path) { @@ -631,7 +631,7 @@ fn p_t_s_r_ellipses(cx: &ext_ctxt, repeat_me: @expr, offset: uint, fn p_t_s_r_length(cx: &ext_ctxt, len: uint, at_least: bool, s: selector, b: &binders) { - fn len_select(cx: &ext_ctxt, m: &matchable, at_least: bool, len: uint) + fn len_select(_cx: &ext_ctxt, m: &matchable, at_least: bool, len: uint) -> match_result { ret alt m { match_expr(e) { @@ -652,7 +652,7 @@ fn p_t_s_r_length(cx: &ext_ctxt, len: uint, at_least: bool, s: selector, ~[compose_sels(s, bind len_select(cx, _, at_least, len))]; } -fn p_t_s_r_actual_vector(cx: &ext_ctxt, elts: [@expr], repeat_after: bool, +fn p_t_s_r_actual_vector(cx: &ext_ctxt, elts: [@expr], _repeat_after: bool, s: &selector, b: &binders) { let idx: uint = 0u; while idx < vec::len(elts) { @@ -676,7 +676,7 @@ fn p_t_s_r_actual_vector(cx: &ext_ctxt, elts: [@expr], repeat_after: bool, } fn add_new_extension(cx: &ext_ctxt, sp: span, arg: @expr, - body: option::t<str>) -> base::macro_def { + _body: option::t<str>) -> base::macro_def { let args: [@ast::expr] = alt arg.node { ast::expr_vec(elts, _, _) { elts } _ { @@ -753,7 +753,7 @@ fn add_new_extension(cx: &ext_ctxt, sp: span, arg: @expr, ext: normal(ext)}; fn generic_extension(cx: &ext_ctxt, sp: span, arg: @expr, - body: option::t<str>, clauses: [@clause]) -> @expr { + _body: option::t<str>, clauses: [@clause]) -> @expr { for c: @clause in clauses { alt use_selectors_to_bind(c.params, arg) { some(bindings) { diff --git a/src/comp/syntax/fold.rs b/src/comp/syntax/fold.rs index eadb63f766c..b81a56c576f 100644 --- a/src/comp/syntax/fold.rs +++ b/src/comp/syntax/fold.rs @@ -76,31 +76,31 @@ type a_f = //fn nf_dummy<T>(&T node) -> T { fail; } -fn nf_crate_dummy(c: &crate) -> crate { fail; } -fn nf_crate_directive_dummy(c: &@crate_directive) -> @crate_directive { +fn nf_crate_dummy(_c: &crate) -> crate { fail; } +fn nf_crate_directive_dummy(_c: &@crate_directive) -> @crate_directive { fail; } -fn nf_view_item_dummy(v: &@view_item) -> @view_item { fail; } -fn nf_native_item_dummy(n: &@native_item) -> @native_item { fail; } -fn nf_item_dummy(i: &@item) -> @item { fail; } -fn nf_item_underscore_dummy(i: &item_) -> item_ { fail; } -fn nf_method_dummy(m: &@method) -> @method { fail; } -fn nf_blk_dummy(b: &blk) -> blk { fail; } -fn nf_stmt_dummy(s: &@stmt) -> @stmt { fail; } -fn nf_arm_dummy(a: &arm) -> arm { fail; } -fn nf_pat_dummy(p: &@pat) -> @pat { fail; } -fn nf_decl_dummy(d: &@decl) -> @decl { fail; } -fn nf_expr_dummy(e: &@expr) -> @expr { fail; } -fn nf_ty_dummy(t: &@ty) -> @ty { fail; } -fn nf_constr_dummy(c: &@constr) -> @constr { fail; } -fn nf_fn_dummy(f: &_fn) -> _fn { fail; } -fn nf_mod_dummy(m: &_mod) -> _mod { fail; } -fn nf_native_mod_dummy(n: &native_mod) -> native_mod { fail; } -fn nf_variant_dummy(v: &variant) -> variant { fail; } -fn nf_ident_dummy(i: &ident) -> ident { fail; } -fn nf_path_dummy(p: &path) -> path { fail; } -fn nf_obj_field_dummy(o: &obj_field) -> obj_field { fail; } -fn nf_local_dummy(o: &@local) -> @local { fail; } +fn nf_view_item_dummy(_v: &@view_item) -> @view_item { fail; } +fn nf_native_item_dummy(_n: &@native_item) -> @native_item { fail; } +fn nf_item_dummy(_i: &@item) -> @item { fail; } +fn nf_item_underscore_dummy(_i: &item_) -> item_ { fail; } +fn nf_method_dummy(_m: &@method) -> @method { fail; } +fn nf_blk_dummy(_b: &blk) -> blk { fail; } +fn nf_stmt_dummy(_s: &@stmt) -> @stmt { fail; } +fn nf_arm_dummy(_a: &arm) -> arm { fail; } +fn nf_pat_dummy(_p: &@pat) -> @pat { fail; } +fn nf_decl_dummy(_d: &@decl) -> @decl { fail; } +fn nf_expr_dummy(_e: &@expr) -> @expr { fail; } +fn nf_ty_dummy(_t: &@ty) -> @ty { fail; } +fn nf_constr_dummy(_c: &@constr) -> @constr { fail; } +fn nf_fn_dummy(_f: &_fn) -> _fn { fail; } +fn nf_mod_dummy(_m: &_mod) -> _mod { fail; } +fn nf_native_mod_dummy(_n: &native_mod) -> native_mod { fail; } +fn nf_variant_dummy(_v: &variant) -> variant { fail; } +fn nf_ident_dummy(_i: &ident) -> ident { fail; } +fn nf_path_dummy(_p: &path) -> path { fail; } +fn nf_obj_field_dummy(_o: &obj_field) -> obj_field { fail; } +fn nf_local_dummy(_o: &@local) -> @local { fail; } /* some little folds that probably aren't useful to have in ast_fold itself*/ @@ -176,7 +176,7 @@ fn noop_fold_crate_directive(cd: &crate_directive_, fld: ast_fold) -> } } -fn noop_fold_view_item(vi: &view_item_, fld: ast_fold) -> view_item_ { +fn noop_fold_view_item(vi: &view_item_, _fld: ast_fold) -> view_item_ { ret vi; } @@ -431,7 +431,7 @@ fn noop_fold_expr(e: &expr_, fld: ast_fold) -> expr_ { } } -fn noop_fold_ty(t: &ty_, fld: ast_fold) -> ty_ { +fn noop_fold_ty(t: &ty_, _fld: ast_fold) -> ty_ { //drop in ty::fold_ty here if necessary ret t; } @@ -476,7 +476,7 @@ fn noop_fold_variant(v: &variant_, fld: ast_fold) -> variant_ { ret {name: v.name, args: vec::map(fold_variant_arg, v.args), id: v.id}; } -fn noop_fold_ident(i: &ident, fld: ast_fold) -> ident { ret i; } +fn noop_fold_ident(i: &ident, _fld: ast_fold) -> ident { ret i; } fn noop_fold_path(p: &path_, fld: ast_fold) -> path_ { ret {global: p.global, diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 4ed64531319..da033bd9f1f 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -282,7 +282,7 @@ fn check_bad_word(p: &parser) { } } -fn parse_ty_fn(proto: ast::proto, p: &parser, lo: uint) -> ast::ty_ { +fn parse_ty_fn(proto: ast::proto, p: &parser) -> ast::ty_ { fn parse_fn_input_ty(p: &parser) -> ast::ty_arg { let lo = p.get_lo_pos(); // Ignore arg name, if present @@ -338,7 +338,7 @@ fn parse_ty_obj(p: &parser, hi: &mutable uint) -> ast::ty_ { let flo = p.get_lo_pos(); let proto: ast::proto = parse_proto(p); let ident = parse_value_ident(p); - let f = parse_ty_fn(proto, p, flo); + let f = parse_ty_fn(proto, p); expect(p, token::SEMI); alt f { ast::ty_fn(proto, inputs, output, cf, constrs) { @@ -574,16 +574,13 @@ fn parse_ty(p: &parser, colons_before_params: bool) -> @ast::ty { hi = p.get_hi_pos(); expect(p, token::RBRACKET); } else if (eat_word(p, "fn")) { - let flo = p.get_last_lo_pos(); - t = parse_ty_fn(ast::proto_fn, p, flo); + t = parse_ty_fn(ast::proto_fn, p); alt t { ast::ty_fn(_, _, out, _, _) { hi = out.span.hi; } } } else if (eat_word(p, "block")) { - let flo = p.get_last_lo_pos(); - t = parse_ty_fn(ast::proto_block, p, flo); + t = parse_ty_fn(ast::proto_block, p); alt t { ast::ty_fn(_, _, out, _, _) { hi = out.span.hi; } } } else if (eat_word(p, "iter")) { - let flo = p.get_last_lo_pos(); - t = parse_ty_fn(ast::proto_iter, p, flo); + t = parse_ty_fn(ast::proto_iter, p); alt t { ast::ty_fn(_, _, out, _, _) { hi = out.span.hi; } } } else if (eat_word(p, "obj")) { t = parse_ty_obj(p, hi); @@ -2427,7 +2424,7 @@ fn parse_native_view(p: &parser) -> [@ast::view_item] { fn parse_crate_from_source_file(input: &str, cfg: &ast::crate_cfg, sess: &parse_sess) -> @ast::crate { let p = new_parser_from_file(sess, cfg, input, 0u, 0u, SOURCE_FILE); - ret parse_crate_mod(p, cfg, sess); + ret parse_crate_mod(p, cfg); } fn parse_crate_from_source_str(name: &str, source: &str, cfg: &ast::crate_cfg, @@ -2438,11 +2435,11 @@ fn parse_crate_from_source_str(name: &str, source: &str, cfg: &ast::crate_cfg, let itr = @interner::mk(str::hash, str::eq); let rdr = lexer::new_reader(sess.cm, source, filemap, itr); let p = new_parser(sess, cfg, rdr, ftype); - ret parse_crate_mod(p, cfg, sess); + ret parse_crate_mod(p, cfg); } // Parses a source module as a crate -fn parse_crate_mod(p: &parser, cfg: &ast::crate_cfg, sess: parse_sess) -> +fn parse_crate_mod(p: &parser, _cfg: &ast::crate_cfg) -> @ast::crate { let lo = p.get_lo_pos(); let crate_attrs = parse_inner_attrs_and_next(p); diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index a8f694e6755..6353751be27 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -34,7 +34,7 @@ tag ann_node { type pp_ann = {pre: fn(&ann_node) , post: fn(&ann_node) }; fn no_ann() -> pp_ann { - fn ignore(node: &ann_node) { } + fn ignore(_node: &ann_node) { } ret {pre: ignore, post: ignore}; } diff --git a/src/comp/syntax/visit.rs b/src/comp/syntax/visit.rs index fd7a6b22661..ee271231d18 100644 --- a/src/comp/syntax/visit.rs +++ b/src/comp/syntax/visit.rs @@ -70,12 +70,12 @@ fn visit_crate_directive<E>(cd: &@crate_directive, e: &E, v: &vt<E>) { } } -fn visit_mod<E>(m: &_mod, sp: &span, e: &E, v: &vt<E>) { +fn visit_mod<E>(m: &_mod, _sp: &span, e: &E, v: &vt<E>) { for vi: @view_item in m.view_items { v.visit_view_item(vi, e, v); } for i: @item in m.items { v.visit_item(i, e, v); } } -fn visit_view_item<E>(vi: &@view_item, e: &E, v: &vt<E>) { } +fn visit_view_item<E>(_vi: &@view_item, _e: &E, _v: &vt<E>) { } fn visit_local<E>(loc: &@local, e: &E, v: &vt<E>) { v.visit_pat(loc.node.pat, e, v); @@ -161,8 +161,8 @@ fn visit_ty<E>(t: &@ty, e: &E, v: &vt<E>) { } } -fn visit_constr<E>(operator: &path, sp: &span, id: node_id, e: &E, - v: &vt<E>) { +fn visit_constr<E>(_operator: &path, _sp: &span, _id: node_id, _e: &E, + _v: &vt<E>) { // default } @@ -198,8 +198,8 @@ fn visit_fn_decl<E>(fd: &fn_decl, e: &E, v: &vt<E>) { v.visit_ty(fd.output, e, v); } -fn visit_fn<E>(f: &_fn, tp: &[ty_param], sp: &span, i: &fn_ident, id: node_id, - e: &E, v: &vt<E>) { +fn visit_fn<E>(f: &_fn, _tp: &[ty_param], _sp: &span, _i: &fn_ident, + _id: node_id, e: &E, v: &vt<E>) { visit_fn_decl(f.decl, e, v); v.visit_block(f.body, e, v); } @@ -365,22 +365,22 @@ type simple_visitor = visit_fn: fn(&_fn, &[ty_param], &span, &fn_ident, node_id) }; fn default_simple_visitor() -> simple_visitor { - ret @{visit_mod: fn (m: &_mod, sp: &span) { }, - visit_view_item: fn (vi: &@view_item) { }, - visit_native_item: fn (ni: &@native_item) { }, - visit_item: fn (i: &@item) { }, - visit_local: fn (l: &@local) { }, - visit_block: fn (b: &ast::blk) { }, - visit_stmt: fn (s: &@stmt) { }, - visit_arm: fn (a: &arm) { }, - visit_pat: fn (p: &@pat) { }, - visit_decl: fn (d: &@decl) { }, - visit_expr: fn (e: &@expr) { }, - visit_ty: fn (t: &@ty) { }, - visit_constr: fn (p: &path, sp: &span, id: node_id) { }, + ret @{visit_mod: fn (_m: &_mod, _sp: &span) { }, + visit_view_item: fn (_vi: &@view_item) { }, + visit_native_item: fn (_ni: &@native_item) { }, + visit_item: fn (_i: &@item) { }, + visit_local: fn (_l: &@local) { }, + visit_block: fn (_b: &ast::blk) { }, + visit_stmt: fn (_s: &@stmt) { }, + visit_arm: fn (_a: &arm) { }, + visit_pat: fn (_p: &@pat) { }, + visit_decl: fn (_d: &@decl) { }, + visit_expr: fn (_e: &@expr) { }, + visit_ty: fn (_t: &@ty) { }, + visit_constr: fn (_p: &path, _sp: &span, _id: node_id) { }, visit_fn: - fn (f: &_fn, tps: &[ty_param], sp: &span, ident: &fn_ident, - id: node_id) { + fn (_f: &_fn, _tps: &[ty_param], _sp: &span, _ident: &fn_ident, + _id: node_id) { }}; } diff --git a/src/lib/bitv.rs b/src/lib/bitv.rs index 74e68fd4b39..3e31dc4b34a 100644 --- a/src/lib/bitv.rs +++ b/src/lib/bitv.rs @@ -61,7 +61,7 @@ fn intersect(v0: &t, v1: &t) -> bool { ret process(sub, v0, v1); } -fn right(w0: uint, w1: uint) -> uint { ret w1; } +fn right(_w0: uint, w1: uint) -> uint { ret w1; } fn assign(v0: &t, v1: t) -> bool { let sub = right; diff --git a/src/lib/getopts.rs b/src/lib/getopts.rs index 681815881a7..22628f8aa6e 100644 --- a/src/lib/getopts.rs +++ b/src/lib/getopts.rs @@ -108,7 +108,7 @@ tag result { success(match); failure(fail_); } fn getopts(args: &[str], opts: &[opt]) -> result { let n_opts = vec::len::<opt>(opts); - fn f(x: uint) -> [optval] { ret ~[]; } + fn f(_x: uint) -> [optval] { ret ~[]; } let vals = vec::init_fn_mut::<[optval]>(f, n_opts); let free: [str] = ~[]; let l = vec::len::<str>(args); diff --git a/src/lib/io.rs b/src/lib/io.rs index 0778a64e3f1..10a59334f62 100644 --- a/src/lib/io.rs +++ b/src/lib/io.rs @@ -209,7 +209,7 @@ obj byte_buf_reader(bbuf: byte_buf) { bbuf.pos += 1u; ret b as int; } - fn unread_byte(byte: int) { log_err "TODO: unread_byte"; fail; } + fn unread_byte(_byte: int) { log_err "TODO: unread_byte"; fail; } fn eof() -> bool { ret bbuf.pos == vec::len::<u8>(bbuf.buf); } fn seek(offset: int, whence: seek_style) { let pos = bbuf.pos; @@ -278,7 +278,7 @@ obj fd_buf_writer(fd: int, res: option::t<@fd_res>) { count += nout as uint; } } - fn seek(offset: int, whence: seek_style) { + fn seek(_offset: int, _whence: seek_style) { log_err "need 64-bit native calls for seek, sorry"; fail; } diff --git a/src/lib/list.rs b/src/lib/list.rs index 7856fc800f2..ee25f7cd3bb 100644 --- a/src/lib/list.rs +++ b/src/lib/list.rs @@ -51,7 +51,7 @@ fn has<@T>(ls_: &list<T>, elt: &T) -> bool { } fn length<@T>(ls: &list<T>) -> uint { - fn count<T>(t: &T, u: &uint) -> uint { ret u + 1u; } + fn count<T>(_t: &T, u: &uint) -> uint { ret u + 1u; } ret foldl(ls, 0u, count); } diff --git a/src/lib/map.rs b/src/lib/map.rs index 3f92503e589..4590fd8c63d 100644 --- a/src/lib/map.rs +++ b/src/lib/map.rs @@ -43,8 +43,8 @@ fn mk_hashmap<@K, @V>(hasher: &hashfn<K>, eqer: &eqfn<K>) -> hashmap<K, V> { // is always a power of 2), so that all buckets are probed for a // fixed key. - fn hashl(n: uint, nbkts: uint) -> uint { ret (n >>> 16u) * 2u + 1u; } - fn hashr(n: uint, nbkts: uint) -> uint { ret 0x0000_ffff_u & n; } + fn hashl(n: uint, _nbkts: uint) -> uint { ret (n >>> 16u) * 2u + 1u; } + fn hashr(n: uint, _nbkts: uint) -> uint { ret 0x0000_ffff_u & n; } fn hash(h: uint, nbkts: uint, i: uint) -> uint { ret (hashl(h, nbkts) * i + hashr(h, nbkts)) % nbkts; } @@ -98,7 +98,7 @@ fn mk_hashmap<@K, @V>(hasher: &hashfn<K>, eqer: &eqfn<K>) -> hashmap<K, V> { ret option::none; } fn rehash<@K, @V>(hasher: &hashfn<K>, eqer: &eqfn<K>, - oldbkts: &[mutable bucket<K, V>], noldbkts: uint, + oldbkts: &[mutable bucket<K, V>], _noldbkts: uint, newbkts: &[mutable bucket<K, V>], nnewbkts: uint) { for b: bucket<K, V> in oldbkts { alt b {