diff --git a/mk/target.mk b/mk/target.mk index b9221a56b9d85..fce6e8a9e2fcc 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -48,7 +48,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)): \ | $$(TLIB$(1)_T_$(2)_H_$(3))/ @$$(call E, compile_and_link: $$@) $$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_GLOB_$(2)),$$(notdir $$@)) - $$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) -o $$@ $$< && touch $$@ + $$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@ $$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_GLOB_$(2)),$$(notdir $$@)) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)): \ @@ -58,7 +58,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)): \ | $$(TLIB$(1)_T_$(2)_H_$(3))/ @$$(call E, compile_and_link: $$@) $$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_GLOB_$(2)),$$(notdir $$@)) - $$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) -o $$@ $$< && touch $$@ + $$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@ $$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_GLOB_$(2)),$$(notdir $$@)) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \ @@ -69,7 +69,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \ | $$(TLIB$(1)_T_$(2)_H_$(3))/ @$$(call E, compile_and_link: $$@) $$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@)) - $$(STAGE$(1)_T_$(2)_H_$(3)) $(BORROWCK) -o $$@ $$< && touch $$@ + $$(STAGE$(1)_T_$(2)_H_$(3)) $(BORROWCK) --out-dir $$(@D) $$< && touch $$@ $$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@)) # Only build the compiler for host triples @@ -90,7 +90,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): \ | $$(TLIB$(1)_T_$(2)_H_$(3))/ @$$(call E, compile_and_link: $$@) $$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@)) - $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@ + $$(STAGE$(1)_T_$(2)_H_$(3)) --out-dir $$(@D) $$< && touch $$@ $$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@)) $$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \ diff --git a/mk/tools.mk b/mk/tools.mk index 56aad4f10a259..32c034d878cb9 100644 --- a/mk/tools.mk +++ b/mk/tools.mk @@ -49,7 +49,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTPKG_$(4)): \ | $$(TLIB$(1)_T_$(4)_H_$(3))/ @$$(call E, compile_and_link: $$@) $$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTPKG_GLOB_$(4)),$$(notdir $$@)) - $$(STAGE$(1)_T_$(4)_H_$(3)) $$(WFLAGS_ST$(1)) -o $$@ $$< && touch $$@ + $$(STAGE$(1)_T_$(4)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@ $$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTPKG_GLOB_$(4)),$$(notdir $$@)) $$(TBIN$(1)_T_$(4)_H_$(3))/rustpkg$$(X_$(4)): \ @@ -67,7 +67,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTDOC_$(4)): \ | $$(TLIB$(1)_T_$(4)_H_$(3))/ @$$(call E, compile_and_link: $$@) $$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTDOC_GLOB_$(4)),$$(notdir $$@)) - $$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< && touch $$@ + $$(STAGE$(1)_T_$(4)_H_$(3)) --out-dir $$(@D) $$< && touch $$@ $$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTDOC_GLOB_$(4)),$$(notdir $$@)) $$(TBIN$(1)_T_$(4)_H_$(3))/rustdoc$$(X_$(4)): \ @@ -85,7 +85,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTI_$(4)): \ | $$(TLIB$(1)_T_$(4)_H_$(3))/ @$$(call E, compile_and_link: $$@) $$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTI_GLOB_$(4)),$$(notdir $$@)) - $$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< && touch $$@ + $$(STAGE$(1)_T_$(4)_H_$(3)) --out-dir $$(@D) $$< && touch $$@ $$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTI_GLOB_$(4)),$$(notdir $$@)) $$(TBIN$(1)_T_$(4)_H_$(3))/rusti$$(X_$(4)): \ @@ -106,7 +106,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUST_$(4)): \ | $$(TLIB$(1)_T_$(4)_H_$(3))/ @$$(call E, compile_and_link: $$@) $$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUST_GLOB_$(4)),$$(notdir $$@)) - $$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< && touch $$@ + $$(STAGE$(1)_T_$(4)_H_$(3)) --out-dir $$(@D) $$< && touch $$@ $$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUST_GLOB_$(4)),$$(notdir $$@)) $$(TBIN$(1)_T_$(4)_H_$(3))/rust$$(X_$(4)): \ diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index b01de242590d0..ce715ac2db5ad 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -11,7 +11,6 @@ #[crate_type = "bin"]; #[allow(non_camel_case_types)]; -#[allow(unrecognized_lint)]; // NOTE: remove after snapshot #[deny(warnings)]; extern mod extra; diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index ea679d19f73b8..3daacf38036ae 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -408,11 +408,10 @@ pub fn stop_after_phase_5(sess: Session) -> bool { #[fixed_stack_segment] pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &input, outdir: &Option, output: &Option) { - let outputs = build_output_filenames(input, outdir, output, [], sess); // We need nested scopes here, because the intermediate results can keep // large chunks of memory alive and we want to free them as soon as // possible to keep the peak memory usage low - let trans = { + let (outputs, trans) = { let expanded_crate = { let crate = phase_1_parse_input(sess, cfg.clone(), input); if stop_after_phase_1(sess) { return; } @@ -420,7 +419,10 @@ pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &input, }; let analysis = phase_3_run_analysis_passes(sess, expanded_crate); if stop_after_phase_3(sess) { return; } - phase_4_translate_to_llvm(sess, expanded_crate, &analysis, outputs) + let outputs = build_output_filenames(input, outdir, output, [], sess); + let trans = phase_4_translate_to_llvm(sess, expanded_crate, + &analysis, outputs); + (outputs, trans) }; phase_5_run_llvm_passes(sess, &trans, outputs); if stop_after_phase_5(sess) { return; } @@ -957,10 +959,7 @@ pub fn build_output_filenames(input: &input, }; if *sess.building_library { - // FIXME (#2401): We might want to warn here; we're actually not - // going to respect the user's choice of library name when it - // comes time to link, we'll be linking to - // lib--.so no matter what. + sess.warn("ignoring specified output filename for library."); } if *odir != None { diff --git a/src/librustc/middle/cfg/construct.rs b/src/librustc/middle/cfg/construct.rs index f34b28e1642fc..767c2b4ee2ed7 100644 --- a/src/librustc/middle/cfg/construct.rs +++ b/src/librustc/middle/cfg/construct.rs @@ -225,7 +225,7 @@ impl CFGBuilder { // Note that `break` and `loop` statements // may cause additional edges. - // NOTE: Is the condition considered part of the loop? + // Is the condition considered part of the loop? let loopback = self.add_dummy_node([pred]); // 1 let cond_exit = self.expr(cond, loopback); // 2 let expr_exit = self.add_node(expr.id, [cond_exit]); // 3 diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 725beee6604e7..0a008b2215ae5 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -171,6 +171,7 @@ use middle::trans::tvec; use middle::trans::type_of; use middle::ty; use util::common::indenter; +use util::ppaux::{Repr, vec_map_to_str}; use std::hashmap::HashMap; use std::vec; @@ -179,7 +180,6 @@ use syntax::ast::ident; use syntax::ast_util::path_to_ident; use syntax::ast_util; use syntax::codemap::{span, dummy_sp}; -use syntax::print::pprust::pat_to_str; // An option identifying a literal: either a unit-like struct or an // expression. @@ -353,19 +353,17 @@ pub struct Match<'self> { data: ArmData<'self> } -pub fn match_to_str(bcx: @mut Block, m: &Match) -> ~str { - if bcx.sess().verbose() { - // for many programs, this just take too long to serialize - fmt!("%?", m.pats.map(|p| pat_to_str(*p, bcx.sess().intr()))) - } else { - fmt!("%u pats", m.pats.len()) +impl<'self> Repr for Match<'self> { + fn repr(&self, tcx: ty::ctxt) -> ~str { + if tcx.sess.verbose() { + // for many programs, this just take too long to serialize + self.pats.repr(tcx) + } else { + fmt!("%u pats", self.pats.len()) + } } } -pub fn matches_to_str(bcx: @mut Block, m: &[Match]) -> ~str { - fmt!("%?", m.map(|n| match_to_str(bcx, n))) -} - pub fn has_nested_bindings(m: &[Match], col: uint) -> bool { for br in m.iter() { match br.pats[col].node { @@ -381,9 +379,9 @@ pub fn expand_nested_bindings<'r>(bcx: @mut Block, col: uint, val: ValueRef) -> ~[Match<'r>] { - debug!("expand_nested_bindings(bcx=%s, m=%s, col=%u, val=%?)", + debug!("expand_nested_bindings(bcx=%s, m=%s, col=%u, val=%s)", bcx.to_str(), - matches_to_str(bcx, m), + m.repr(bcx.tcx()), col, bcx.val_to_str(val)); let _indenter = indenter(); @@ -416,7 +414,7 @@ pub fn assert_is_binding_or_wild(bcx: @mut Block, p: @ast::pat) { bcx.sess().span_bug( p.span, fmt!("Expected an identifier pattern but found p: %s", - pat_to_str(p, bcx.sess().intr()))); + p.repr(bcx.tcx()))); } } @@ -429,9 +427,9 @@ pub fn enter_match<'r>(bcx: @mut Block, val: ValueRef, e: enter_pat) -> ~[Match<'r>] { - debug!("enter_match(bcx=%s, m=%s, col=%u, val=%?)", + debug!("enter_match(bcx=%s, m=%s, col=%u, val=%s)", bcx.to_str(), - matches_to_str(bcx, m), + m.repr(bcx.tcx()), col, bcx.val_to_str(val)); let _indenter = indenter(); @@ -467,7 +465,7 @@ pub fn enter_match<'r>(bcx: @mut Block, } } - debug!("result=%s", matches_to_str(bcx, result)); + debug!("result=%s", result.repr(bcx.tcx())); return result; } @@ -478,9 +476,9 @@ pub fn enter_default<'r>(bcx: @mut Block, col: uint, val: ValueRef) -> ~[Match<'r>] { - debug!("enter_default(bcx=%s, m=%s, col=%u, val=%?)", + debug!("enter_default(bcx=%s, m=%s, col=%u, val=%s)", bcx.to_str(), - matches_to_str(bcx, m), + m.repr(bcx.tcx()), col, bcx.val_to_str(val)); let _indenter = indenter(); @@ -525,9 +523,9 @@ pub fn enter_opt<'r>(bcx: @mut Block, variant_size: uint, val: ValueRef) -> ~[Match<'r>] { - debug!("enter_opt(bcx=%s, m=%s, col=%u, val=%?)", + debug!("enter_opt(bcx=%s, m=%s, col=%u, val=%s)", bcx.to_str(), - matches_to_str(bcx, m), + m.repr(bcx.tcx()), col, bcx.val_to_str(val)); let _indenter = indenter(); @@ -637,9 +635,9 @@ pub fn enter_rec_or_struct<'r>(bcx: @mut Block, fields: &[ast::ident], val: ValueRef) -> ~[Match<'r>] { - debug!("enter_rec_or_struct(bcx=%s, m=%s, col=%u, val=%?)", + debug!("enter_rec_or_struct(bcx=%s, m=%s, col=%u, val=%s)", bcx.to_str(), - matches_to_str(bcx, m), + m.repr(bcx.tcx()), col, bcx.val_to_str(val)); let _indenter = indenter(); @@ -672,9 +670,9 @@ pub fn enter_tup<'r>(bcx: @mut Block, val: ValueRef, n_elts: uint) -> ~[Match<'r>] { - debug!("enter_tup(bcx=%s, m=%s, col=%u, val=%?)", + debug!("enter_tup(bcx=%s, m=%s, col=%u, val=%s)", bcx.to_str(), - matches_to_str(bcx, m), + m.repr(bcx.tcx()), col, bcx.val_to_str(val)); let _indenter = indenter(); @@ -698,9 +696,9 @@ pub fn enter_tuple_struct<'r>(bcx: @mut Block, val: ValueRef, n_elts: uint) -> ~[Match<'r>] { - debug!("enter_tuple_struct(bcx=%s, m=%s, col=%u, val=%?)", + debug!("enter_tuple_struct(bcx=%s, m=%s, col=%u, val=%s)", bcx.to_str(), - matches_to_str(bcx, m), + m.repr(bcx.tcx()), col, bcx.val_to_str(val)); let _indenter = indenter(); @@ -723,9 +721,9 @@ pub fn enter_box<'r>(bcx: @mut Block, col: uint, val: ValueRef) -> ~[Match<'r>] { - debug!("enter_box(bcx=%s, m=%s, col=%u, val=%?)", + debug!("enter_box(bcx=%s, m=%s, col=%u, val=%s)", bcx.to_str(), - matches_to_str(bcx, m), + m.repr(bcx.tcx()), col, bcx.val_to_str(val)); let _indenter = indenter(); @@ -750,9 +748,9 @@ pub fn enter_uniq<'r>(bcx: @mut Block, col: uint, val: ValueRef) -> ~[Match<'r>] { - debug!("enter_uniq(bcx=%s, m=%s, col=%u, val=%?)", + debug!("enter_uniq(bcx=%s, m=%s, col=%u, val=%s)", bcx.to_str(), - matches_to_str(bcx, m), + m.repr(bcx.tcx()), col, bcx.val_to_str(val)); let _indenter = indenter(); @@ -777,9 +775,9 @@ pub fn enter_region<'r>(bcx: @mut Block, col: uint, val: ValueRef) -> ~[Match<'r>] { - debug!("enter_region(bcx=%s, m=%s, col=%u, val=%?)", + debug!("enter_region(bcx=%s, m=%s, col=%u, val=%s)", bcx.to_str(), - matches_to_str(bcx, m), + m.repr(bcx.tcx()), col, bcx.val_to_str(val)); let _indenter = indenter(); @@ -1213,11 +1211,11 @@ pub fn compile_guard(bcx: @mut Block, vals: &[ValueRef], chk: Option) -> @mut Block { - debug!("compile_guard(bcx=%s, guard_expr=%s, m=%s, vals=%?)", + debug!("compile_guard(bcx=%s, guard_expr=%s, m=%s, vals=%s)", bcx.to_str(), bcx.expr_to_str(guard_expr), - matches_to_str(bcx, m), - vals.map(|v| bcx.val_to_str(*v))); + m.repr(bcx.tcx()), + vec_map_to_str(vals, |v| bcx.val_to_str(*v))); let _indenter = indenter(); let mut bcx = bcx; @@ -1267,10 +1265,10 @@ pub fn compile_submatch(bcx: @mut Block, m: &[Match], vals: &[ValueRef], chk: Option) { - debug!("compile_submatch(bcx=%s, m=%s, vals=%?)", + debug!("compile_submatch(bcx=%s, m=%s, vals=%s)", bcx.to_str(), - matches_to_str(bcx, m), - vals.map(|v| bcx.val_to_str(*v))); + m.repr(bcx.tcx()), + vec_map_to_str(vals, |v| bcx.val_to_str(*v))); let _indenter = indenter(); /* @@ -1427,6 +1425,7 @@ fn compile_submatch_continue(mut bcx: @mut Block, // Decide what kind of branch we need let opts = get_options(bcx, m, col); + debug!("options=%?", opts); let mut kind = no_branch; let mut test_val = val; if opts.len() > 0u { @@ -1914,12 +1913,12 @@ fn bind_irrefutable_pat(bcx: @mut Block, debug!("bind_irrefutable_pat(bcx=%s, pat=%s, binding_mode=%?)", bcx.to_str(), - pat_to_str(pat, bcx.sess().intr()), + pat.repr(bcx.tcx()), binding_mode); if bcx.sess().asm_comments() { add_comment(bcx, fmt!("bind_irrefutable_pat(pat=%s)", - pat_to_str(pat, bcx.sess().intr()))); + pat.repr(bcx.tcx()))); } let _indenter = indenter(); diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 0a28da5f88a7c..6b35f4ae9a4ee 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -2218,23 +2218,14 @@ pub fn trans_mod(ccx: @mut CrateContext, m: &ast::_mod) { pub fn register_fn(ccx: @mut CrateContext, sp: span, sym: ~str, - node_id: ast::NodeId) - -> ValueRef { - let t = ty::node_id_to_type(ccx.tcx, node_id); - register_fn_full(ccx, sp, sym, node_id, t) -} - -pub fn register_fn_full(ccx: @mut CrateContext, - sp: span, - sym: ~str, - node_id: ast::NodeId, - node_type: ty::t) - -> ValueRef { + node_id: ast::NodeId, + node_type: ty::t) + -> ValueRef { let llfty = type_of_fn_from_ty(ccx, node_type); - register_fn_fuller(ccx, sp, sym, node_id, lib::llvm::CCallConv, llfty) + register_fn_llvmty(ccx, sp, sym, node_id, lib::llvm::CCallConv, llfty) } -pub fn register_fn_fuller(ccx: @mut CrateContext, +pub fn register_fn_llvmty(ccx: @mut CrateContext, sp: span, sym: ~str, node_id: ast::NodeId, @@ -2449,7 +2440,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef { ast::item_fn(_, purity, _, _, _) => { let llfn = if purity != ast::extern_fn { - register_fn_full(ccx, i.span, sym, i.id, ty) + register_fn(ccx, i.span, sym, i.id, ty) } else { foreign::register_foreign_fn(ccx, i.span, sym, i.id) }; @@ -2499,7 +2490,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef { let path = vec::append((*pth).clone(), [path_name(ni.ident)]); let sym = exported_name(ccx, path, ty, ni.attrs); - register_fn_full(ccx, ni.span, sym, ni.id, ty) + register_fn(ccx, ni.span, sym, ni.id, ty) } ast::foreign_item_static(*) => { let ident = token::ident_to_str(&ni.ident); @@ -2527,7 +2518,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef { llfn = match enm.node { ast::item_enum(_, _) => { - register_fn_full(ccx, (*v).span, sym, id, ty) + register_fn(ccx, (*v).span, sym, id, ty) } _ => fail!("node_variant, shouldn't happen") }; @@ -2551,7 +2542,8 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef { let ty = ty::node_id_to_type(ccx.tcx, ctor_id); let sym = exported_name(ccx, (*struct_path).clone(), ty, struct_item.attrs); - let llfn = register_fn_full(ccx, struct_item.span, sym, ctor_id, ty); + let llfn = register_fn(ccx, struct_item.span, + sym, ctor_id, ty); set_inline_hint(llfn); llfn } @@ -2586,7 +2578,7 @@ pub fn register_method(ccx: @mut CrateContext, let sym = exported_name(ccx, path, mty, m.attrs); - let llfn = register_fn_full(ccx, m.span, sym, id, mty); + let llfn = register_fn(ccx, m.span, sym, id, mty); set_inline_hint_if_appr(m.attrs, llfn); llfn } diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs index 20c8e69129d74..ede2292725cc9 100644 --- a/src/librustc/middle/trans/foreign.rs +++ b/src/librustc/middle/trans/foreign.rs @@ -1157,6 +1157,6 @@ pub fn register_foreign_fn(ccx: @mut CrateContext, let tys = shim_types(ccx, node_id); do tys.fn_ty.decl_fn |fnty| { - register_fn_fuller(ccx, sp, sym.take(), node_id, lib::llvm::CCallConv, fnty) + register_fn_llvmty(ccx, sp, sym.take(), node_id, lib::llvm::CCallConv, fnty) } } diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 8f0dd51457074..f396ed7f510a6 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -280,9 +280,13 @@ pub fn vstore_ty_to_str(cx: ctxt, mt: &mt, vs: ty::vstore) -> ~str { } } +pub fn vec_map_to_str(ts: &[T], f: &fn(t: &T) -> ~str) -> ~str { + let tstrs = ts.map(f); + fmt!("[%s]", tstrs.connect(", ")) +} + pub fn tys_to_str(cx: ctxt, ts: &[t]) -> ~str { - let tstrs = ts.map(|t| ty_to_str(cx, *t)); - fmt!("(%s)", tstrs.connect(", ")) + vec_map_to_str(ts, |t| ty_to_str(cx, *t)) } pub fn fn_sig_to_str(cx: ctxt, typ: &ty::FnSig) -> ~str { @@ -529,7 +533,7 @@ impl Repr for ~T { } fn repr_vec(tcx: ctxt, v: &[T]) -> ~str { - fmt!("[%s]", v.map(|t| t.repr(tcx)).connect(",")) + vec_map_to_str(v, |t| t.repr(tcx)) } impl<'self, T:Repr> Repr for &'self [T] { diff --git a/src/libstd/rt/io/flate.rs b/src/libstd/rt/io/flate.rs index e57b80658eef2..cbcc441811de6 100644 --- a/src/libstd/rt/io/flate.rs +++ b/src/libstd/rt/io/flate.rs @@ -10,7 +10,7 @@ //! Some various other I/O types -// NOTE: These ultimately belong somewhere else +// FIXME(#3660): should move to libextra use prelude::*; use super::*; diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 5cba22a8e2375..6b4da9671a963 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -466,11 +466,11 @@ pub fn node_id_to_str(map: map, id: NodeId, itr: @ident_interner) -> ~str { Some(&node_local(ident)) => { fmt!("local (id=%?, name=%s)", id, itr.get(ident.name)) } - Some(&node_block(_)) => { - fmt!("block") + Some(&node_block(ref block)) => { + fmt!("block %s (id=%?)", pprust::block_to_str(block, itr), id) } - Some(&node_struct_ctor(*)) => { - fmt!("struct_ctor") + Some(&node_struct_ctor(_, _, path)) => { + fmt!("struct_ctor %s (id=%?)", path_to_str(*path, itr), id) } } } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 11d3740be3f51..84e6544f78092 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -410,7 +410,7 @@ impl IdVisitor { impl Visitor<()> for IdVisitor { fn visit_mod(@mut self, module: &_mod, - span: span, + _span: span, node_id: NodeId, env: ()) { (self.visit_callback)(node_id);