From 418d09e547a021ad4853680f7efc3efc8774054c Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 1 Sep 2011 18:49:10 -0700 Subject: [PATCH] Convert all uses of #ifmt to #fmt. Issue #855 --- src/comp/back/link.rs | 6 +-- src/comp/driver/rustc.rs | 12 +++--- src/comp/driver/session.rs | 4 +- src/comp/front/attr.rs | 6 +-- src/comp/front/test.rs | 10 ++--- src/comp/lib/llvm.rs | 2 +- src/comp/metadata/creader.rs | 18 ++++----- src/comp/metadata/decoder.rs | 8 ++-- src/comp/metadata/encoder.rs | 2 +- src/comp/middle/alias.rs | 4 +- src/comp/middle/kind.rs | 6 +-- src/comp/middle/resolve.rs | 4 +- src/comp/middle/trans.rs | 28 +++++++------- src/comp/middle/tstate/states.rs | 2 +- src/comp/middle/ty.rs | 4 +- src/comp/middle/typeck.rs | 24 ++++++------ src/comp/syntax/codemap.rs | 10 ++--- src/comp/syntax/ext/expand.rs | 2 +- src/comp/syntax/ext/fmt.rs | 2 +- src/comp/syntax/ext/simplext.rs | 4 +- src/comp/syntax/parse/lexer.rs | 10 ++--- src/comp/syntax/print/pp.rs | 38 +++++++++---------- src/comp/syntax/untyped_ast.rs | 2 +- src/fuzzer/fuzzer.rs | 14 +++---- src/lib/net.rs | 2 +- src/lib/task.rs | 2 +- src/lib/test.rs | 12 +++--- src/test/bench/shootout-binarytrees.rs | 6 +-- src/test/bench/shootout-fannkuchredux.rs | 2 +- src/test/bench/shootout-pfib.rs | 4 +- .../bench/task-perf-word-count-generic.rs | 4 +- src/test/bench/task-perf-word-count.rs | 4 +- src/test/compile-fail/ext-after-attrib.rs | 4 +- src/test/compile-fail/extfmt-missing-type.rs | 2 +- src/test/compile-fail/extfmt-no-args.rs | 2 +- src/test/compile-fail/extfmt-non-literal.rs | 4 +- src/test/compile-fail/extfmt-non-literal2.rs | 4 +- .../compile-fail/extfmt-not-enough-args.rs | 2 +- src/test/compile-fail/extfmt-too-many-args.rs | 2 +- src/test/compile-fail/extfmt-unknown-type.rs | 2 +- src/test/compile-fail/extfmt-unsigned-plus.rs | 2 +- .../compile-fail/extfmt-unsigned-space.rs | 2 +- .../compile-fail/extfmt-unterminated-conv.rs | 2 +- src/test/compiletest/compiletest.rs | 34 ++++++++--------- src/test/compiletest/header.rs | 2 +- src/test/compiletest/runtest.rs | 30 +++++++-------- src/test/compiletest/util.rs | 2 +- src/test/run-fail/fmt-fail.rs | 2 +- src/test/run-pass/item-attributes.rs | 2 +- src/test/stdtest/qsort.rs | 2 +- 50 files changed, 180 insertions(+), 180 deletions(-) diff --git a/src/comp/back/link.rs b/src/comp/back/link.rs index 7ff80d70ce5..553478d7ed1 100644 --- a/src/comp/back/link.rs +++ b/src/comp/back/link.rs @@ -340,7 +340,7 @@ fn build_link_meta(sess: &session::session, c: &ast::crate, output: &istr, fn crate_meta_extras_hash(sha: sha1, _crate: &ast::crate, metas: &provided_metas) -> istr { fn len_and_str(s: &istr) -> istr { - ret #ifmt["%u_%s", str::byte_len(s), s]; + ret #fmt["%u_%s", str::byte_len(s), s]; } fn len_and_str_lit(l: &ast::lit) -> istr { @@ -372,7 +372,7 @@ fn build_link_meta(sess: &session::session, c: &ast::crate, output: &istr, fn warn_missing(sess: &session::session, name: &istr, default: &istr) { if !sess.get_opts().library { ret; } sess.warn( - #ifmt["missing crate link meta '%s', using '%s' as default", + #fmt["missing crate link meta '%s', using '%s' as default", name, default]); } @@ -458,7 +458,7 @@ fn mangle(ss: &[istr]) -> istr { let n = ~"_ZN"; // Begin name-sequence. for s: istr in ss { - n += #ifmt["%u%s", str::byte_len(s), s]; + n += #fmt["%u%s", str::byte_len(s), s]; } n += ~"E"; // End name-sequence. diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs index 78d17282724..829c40ed803 100644 --- a/src/comp/driver/rustc.rs +++ b/src/comp/driver/rustc.rs @@ -121,7 +121,7 @@ fn time<@T>(do_it: bool, what: &istr, thunk: fn() -> T) -> T { let start = std::time::precise_time_s(); let rv = thunk(); let end = std::time::precise_time_s(); - log_err #ifmt["time: %s took %s s", what, + log_err #fmt["time: %s took %s s", what, common::float_to_str(end - start, 3u)]; ret rv; } @@ -260,14 +260,14 @@ fn version(argv0: &istr) { let env_vers = #env["CFG_VERSION"]; if str::byte_len(env_vers) != 0u { vers = env_vers; } io::stdout().write_str( - #ifmt["%s %s\n", + #fmt["%s %s\n", argv0, vers]); } fn usage(argv0: &istr) { io::stdout().write_str( - #ifmt["usage: %s [options] \n", argv0] + + #fmt["usage: %s [options] \n", argv0] + ~" options: @@ -471,7 +471,7 @@ fn main(args: [istr]) { alt getopts::getopts(args, opts()) { getopts::success(m) { m } getopts::failure(f) { - log_err #ifmt["error: %s", getopts::fail_str(f)]; + log_err #fmt["error: %s", getopts::fail_str(f)]; fail } }; @@ -636,9 +636,9 @@ fn main(args: [istr]) { let err_code = run::run_program(prog, gcc_args); if 0 != err_code { sess.err( - #ifmt["linking with gcc failed with code %d", err_code]); + #fmt["linking with gcc failed with code %d", err_code]); sess.note( - #ifmt["gcc arguments: %s", + #fmt["gcc arguments: %s", str::connect(gcc_args, ~" ")]); sess.abort_if_errors(); } diff --git a/src/comp/driver/session.rs b/src/comp/driver/session.rs index 7f40921088d..312cdc58f69 100644 --- a/src/comp/driver/session.rs +++ b/src/comp/driver/session.rs @@ -94,12 +94,12 @@ obj session(targ_cfg: @config, } fn span_bug(sp: span, msg: &istr) -> ! { self.span_fatal(sp, - #ifmt["internal compiler error %s", + #fmt["internal compiler error %s", msg]); } fn bug(msg: &istr) -> ! { self.fatal( - #ifmt["internal compiler error %s", + #fmt["internal compiler error %s", msg]); } fn span_unimpl(sp: span, msg: &istr) -> ! { diff --git a/src/comp/front/attr.rs b/src/comp/front/attr.rs index 4ad38e2274e..ae104e62fa3 100644 --- a/src/comp/front/attr.rs +++ b/src/comp/front/attr.rs @@ -123,10 +123,10 @@ fn eq(a: @ast::meta_item, b: @ast::meta_item) -> bool { } fn contains(haystack: &[@ast::meta_item], needle: @ast::meta_item) -> bool { - log #ifmt["looking for %s", + log #fmt["looking for %s", syntax::print::pprust::meta_item_to_str(*needle)]; for item: @ast::meta_item in haystack { - log #ifmt["looking in %s", + log #fmt["looking in %s", syntax::print::pprust::meta_item_to_str(*item)]; if eq(item, needle) { log "found it!"; ret true; } } @@ -183,7 +183,7 @@ fn require_unique_names(sess: &session::session, metas: &[@ast::meta_item]) { let name = get_meta_item_name(meta); if map.contains_key(name) { sess.span_fatal(meta.span, - #ifmt["duplicate meta item `%s`", + #fmt["duplicate meta item `%s`", name]); } map.insert(name, ()); diff --git a/src/comp/front/test.rs b/src/comp/front/test.rs index f2eced86634..5103ffab827 100644 --- a/src/comp/front/test.rs +++ b/src/comp/front/test.rs @@ -92,14 +92,14 @@ fn fold_item(cx: &test_ctxt, i: &@ast::item, fld: fold::ast_fold) -> @ast::item { cx.path += [i.ident]; - log #ifmt["current path: %s", + log #fmt["current path: %s", ast_util::path_name_i(cx.path)]; if is_test_fn(i) { log "this is a test function"; let test = {path: cx.path, ignore: is_ignored(i)}; cx.testfns += [test]; - log #ifmt["have %u test functions", vec::len(cx.testfns)]; + log #fmt["have %u test functions", vec::len(cx.testfns)]; } let res = fold::noop_fold_item(i, fld); @@ -168,7 +168,7 @@ fn mk_test_module(cx: &test_ctxt) -> @ast::item { node: item_, span: dummy_sp()}; - log #ifmt["Synthetic test module:\n%s\n", + log #fmt["Synthetic test module:\n%s\n", pprust::item_to_str(@item)]; ret @item; @@ -234,7 +234,7 @@ fn mk_test_desc_vec_ty(cx: &test_ctxt) -> @ast::ty { } fn mk_test_desc_vec(cx: &test_ctxt) -> @ast::expr { - log #ifmt["building test vector from %u tests", vec::len(cx.testfns)]; + log #fmt["building test vector from %u tests", vec::len(cx.testfns)]; let descs = []; for test: test in cx.testfns { let test_ = test; // Satisfy alias analysis @@ -249,7 +249,7 @@ fn mk_test_desc_vec(cx: &test_ctxt) -> @ast::expr { fn mk_test_desc_rec(cx: &test_ctxt, test: test) -> @ast::expr { let path = test.path; - log #ifmt["encoding %s", + log #fmt["encoding %s", ast_util::path_name_i(path)]; let name_lit: ast::lit = diff --git a/src/comp/lib/llvm.rs b/src/comp/lib/llvm.rs index d59f6893815..105490ac223 100644 --- a/src/comp/lib/llvm.rs +++ b/src/comp/lib/llvm.rs @@ -1040,7 +1040,7 @@ fn type_to_str_inner(names: type_names, outer0: &[TypeRef], ty: TypeRef) -> } 13 { ret ~"Vector"; } 14 { ret ~"Metadata"; } - _ { log_err #ifmt["unknown TypeKind %d", kind as int]; fail; } + _ { log_err #fmt["unknown TypeKind %d", kind as int]; fail; } } } diff --git a/src/comp/metadata/creader.rs b/src/comp/metadata/creader.rs index 81978664a07..4fd911a1bad 100644 --- a/src/comp/metadata/creader.rs +++ b/src/comp/metadata/creader.rs @@ -99,12 +99,12 @@ fn metadata_matches(crate_data: &@[u8], metas: &[@ast::meta_item]) -> bool { let attrs = decoder::get_crate_attributes(crate_data); let linkage_metas = attr::find_linkage_metas(attrs); - log #ifmt["matching %u metadata requirements against %u items", + log #fmt["matching %u metadata requirements against %u items", vec::len(metas), vec::len(linkage_metas)]; for needed: @ast::meta_item in metas { if !attr::contains(linkage_metas, needed) { - log #ifmt["missing %s", + log #fmt["missing %s", pprust::meta_item_to_str(*needed)]; ret false; } @@ -169,13 +169,13 @@ fn find_library_crate_aux(nn: &{prefix: istr, suffix: istr}, // manually filtering fs::list_dir here. for library_search_path: istr in library_search_paths { - log #ifmt["searching %s", library_search_path]; + log #fmt["searching %s", library_search_path]; for path: istr in fs::list_dir(library_search_path) { - log #ifmt["searching %s", path]; + log #fmt["searching %s", path]; let f: istr = fs::basename(path); if !(str::starts_with(f, prefix) && str::ends_with(f, suffix)) { - log #ifmt["skipping %s, doesn't look like %s*%s", + log #fmt["skipping %s, doesn't look like %s*%s", path, prefix, suffix]; @@ -184,11 +184,11 @@ fn find_library_crate_aux(nn: &{prefix: istr, suffix: istr}, alt get_metadata_section(path) { option::some(cvec) { if !metadata_matches(cvec, metas) { - log #ifmt["skipping %s, metadata doesn't match", + log #fmt["skipping %s, metadata doesn't match", path]; cont; } - log #ifmt["found %s with matching metadata", + log #fmt["found %s with matching metadata", path]; ret some({ident: path, data: cvec}); } @@ -230,7 +230,7 @@ fn load_library_crate(sess: &session::session, span: span, ident: &ast::ident, some(t) { ret t; } none. { sess.span_fatal(span, - #ifmt["can't find crate for '%s'", + #fmt["can't find crate for '%s'", ident]); } } @@ -274,7 +274,7 @@ fn resolve_crate_deps(e: env, cdata: &@[u8]) -> cstore::cnum_map { for dep: decoder::crate_dep in decoder::get_crate_deps(cdata) { let extrn_cnum = dep.cnum; let cname = dep.ident; - log #ifmt["resolving dep %s", cname]; + log #fmt["resolving dep %s", cname]; if e.crate_cache.contains_key(cname) { log "already have it"; // We've already seen this crate diff --git a/src/comp/metadata/decoder.rs b/src/comp/metadata/decoder.rs index c3365f4f57c..e99e9d274da 100644 --- a/src/comp/metadata/decoder.rs +++ b/src/comp/metadata/decoder.rs @@ -348,7 +348,7 @@ fn get_attributes(md: &ebml::doc) -> [ast::attribute] { fn list_meta_items(meta_items: &ebml::doc, out: io::writer) { for mi: @ast::meta_item in get_meta_items(meta_items) { out.write_str( - #ifmt["%s\n", + #fmt["%s\n", pprust::meta_item_to_str(*mi)]); } } @@ -358,7 +358,7 @@ fn list_crate_attributes(md: &ebml::doc, out: io::writer) { for attr: ast::attribute in get_attributes(md) { out.write_str( - #ifmt["%s\n", + #fmt["%s\n", pprust::attribute_to_str(attr)]); } @@ -389,7 +389,7 @@ fn list_crate_deps(data: @[u8], out: io::writer) { for dep: crate_dep in get_crate_deps(data) { out.write_str( - #ifmt["%d %s\n", dep.cnum, + #fmt["%d %s\n", dep.cnum, dep.ident]); } @@ -411,7 +411,7 @@ fn list_crate_items(bytes: &@[u8], md: &ebml::doc, out: io::writer) { let did_doc = ebml::get_doc(def, tag_def_id); let did = parse_def_id(ebml::doc_data(did_doc)); out.write_str( - #ifmt["%s (%s)\n", + #fmt["%s (%s)\n", data.path, describe_def(items, did)]); } diff --git a/src/comp/metadata/encoder.rs b/src/comp/metadata/encoder.rs index 384088c59e6..7ed760c32dc 100644 --- a/src/comp/metadata/encoder.rs +++ b/src/comp/metadata/encoder.rs @@ -177,7 +177,7 @@ fn encode_inlineness(ebml_w: &ebml::writer, c: u8) { } fn def_to_str(did: &def_id) -> istr { - ret #ifmt["%d:%d", did.crate, did.node]; + ret #fmt["%d:%d", did.crate, did.node]; } fn encode_type_param_kinds(ebml_w: &ebml::writer, tps: &[ty_param]) { diff --git a/src/comp/middle/alias.rs b/src/comp/middle/alias.rs index aaa97399294..7b255ab1fc6 100644 --- a/src/comp/middle/alias.rs +++ b/src/comp/middle/alias.rs @@ -183,7 +183,7 @@ fn check_call(cx: &ctx, f: &@ast::expr, args: &[@ast::expr], sc: &scope) for r in restricts { if !option::is_none(r.unsafe_ty) { cx.tcx.sess.span_err(f.span, - #ifmt["function may alias with argument \ + #fmt["function may alias with argument \ %u, which is not immutably rooted", i]); } @@ -200,7 +200,7 @@ fn check_call(cx: &ctx, f: &@ast::expr, args: &[@ast::expr], sc: &scope) if i != j && ty_can_unsafely_include(cx, ty, arg_t.ty, mut_alias) { cx.tcx.sess.span_err(args[i].span, - #ifmt["argument %u may alias with argument %u, \ + #fmt["argument %u may alias with argument %u, \ which is not immutably rooted", i, j]); } i += 1u; diff --git a/src/comp/middle/kind.rs b/src/comp/middle/kind.rs index 71b21110962..744d328f0f7 100644 --- a/src/comp/middle/kind.rs +++ b/src/comp/middle/kind.rs @@ -114,13 +114,13 @@ fn type_and_kind(tcx: &ty::ctxt, e: &@ast::expr) -> fn need_expr_kind(tcx: &ty::ctxt, e: &@ast::expr, k_need: ast::kind, descr: &istr) { let tk = type_and_kind(tcx, e); - log #ifmt["for %s: want %s type, got %s type %s", descr, + log #fmt["for %s: want %s type, got %s type %s", descr, kind_to_str(k_need), kind_to_str(tk.kind), util::ppaux::ty_to_str(tcx, tk.ty)]; if !kind_lteq(k_need, tk.kind) { let s = - #ifmt["mismatched kinds for %s: needed %s type, got %s type %s", + #fmt["mismatched kinds for %s: needed %s type, got %s type %s", descr, kind_to_str(k_need), kind_to_str(tk.kind), util::ppaux::ty_to_str(tcx, tk.ty)]; @@ -169,7 +169,7 @@ fn check_expr(tcx: &ty::ctxt, e: &@ast::expr) { let k = ty::type_kind(tcx, t); if !kind_lteq(k_need, k) { let s = - #ifmt["mismatched kinds for typaram %d: \ + #fmt["mismatched kinds for typaram %d: \ needed %s type, got %s type %s", i, kind_to_str(k_need), kind_to_str(k), util::ppaux::ty_to_str(tcx, t)]; diff --git a/src/comp/middle/resolve.rs b/src/comp/middle/resolve.rs index 117c10b0db7..3fcf6bde032 100644 --- a/src/comp/middle/resolve.rs +++ b/src/comp/middle/resolve.rs @@ -572,7 +572,7 @@ fn unresolved_fatal(e: &env, sp: &span, id: &ident, kind: &istr) -> ! { } fn mk_unresolved_msg(id: &ident, kind: &istr) -> istr { - ret #ifmt["unresolved %s: %s", kind, id]; + ret #fmt["unresolved %s: %s", kind, id]; } // Lookup helpers @@ -1027,7 +1027,7 @@ fn lookup_glob_in_mod(e: &env, info: @indexed_mod, sp: &span, id: &ident, for match: glob_imp_def in matches { let sp = match.item.span; e.sess.span_note( - sp, #ifmt["'%s' is imported here", id]); + sp, #fmt["'%s' is imported here", id]); } e.sess.span_fatal(sp, ~"'" + id diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index ef2695fb2ab..f756cbd3201 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -1886,7 +1886,7 @@ fn lazily_emit_tydesc_glue(cx: &@block_ctxt, field: int, alt { ti.take_glue } { some(_) { } none. { - log #ifmt["+++ lazily_emit_tydesc_glue TAKE %s", + log #fmt["+++ lazily_emit_tydesc_glue TAKE %s", ty_to_str(bcx_tcx(cx), ti.ty)]; let lcx = cx.fcx.lcx; let glue_fn = @@ -1896,7 +1896,7 @@ fn lazily_emit_tydesc_glue(cx: &@block_ctxt, field: int, make_generic_glue(lcx, cx.sp, ti.ty, glue_fn, default_helper(make_take_glue), ti.ty_params, ~"take"); - log #ifmt["--- lazily_emit_tydesc_glue TAKE %s", + log #fmt["--- lazily_emit_tydesc_glue TAKE %s", ty_to_str(bcx_tcx(cx), ti.ty)]; } } @@ -1904,7 +1904,7 @@ fn lazily_emit_tydesc_glue(cx: &@block_ctxt, field: int, alt { ti.drop_glue } { some(_) { } none. { - log #ifmt["+++ lazily_emit_tydesc_glue DROP %s", + log #fmt["+++ lazily_emit_tydesc_glue DROP %s", ty_to_str(bcx_tcx(cx), ti.ty)]; let lcx = cx.fcx.lcx; let glue_fn = @@ -1914,7 +1914,7 @@ fn lazily_emit_tydesc_glue(cx: &@block_ctxt, field: int, make_generic_glue(lcx, cx.sp, ti.ty, glue_fn, default_helper(make_drop_glue), ti.ty_params, ~"drop"); - log #ifmt["--- lazily_emit_tydesc_glue DROP %s", + log #fmt["--- lazily_emit_tydesc_glue DROP %s", ty_to_str(bcx_tcx(cx), ti.ty)]; } } @@ -1922,7 +1922,7 @@ fn lazily_emit_tydesc_glue(cx: &@block_ctxt, field: int, alt { ti.free_glue } { some(_) { } none. { - log #ifmt["+++ lazily_emit_tydesc_glue FREE %s", + log #fmt["+++ lazily_emit_tydesc_glue FREE %s", ty_to_str(bcx_tcx(cx), ti.ty)]; let lcx = cx.fcx.lcx; let glue_fn = @@ -1932,7 +1932,7 @@ fn lazily_emit_tydesc_glue(cx: &@block_ctxt, field: int, make_generic_glue(lcx, cx.sp, ti.ty, glue_fn, default_helper(make_free_glue), ti.ty_params, ~"free"); - log #ifmt["--- lazily_emit_tydesc_glue FREE %s", + log #fmt["--- lazily_emit_tydesc_glue FREE %s", ty_to_str(bcx_tcx(cx), ti.ty)]; } } @@ -1940,10 +1940,10 @@ fn lazily_emit_tydesc_glue(cx: &@block_ctxt, field: int, alt { ti.cmp_glue } { some(_) { } none. { - log #ifmt["+++ lazily_emit_tydesc_glue CMP %s", + log #fmt["+++ lazily_emit_tydesc_glue CMP %s", ty_to_str(bcx_tcx(cx), ti.ty)]; ti.cmp_glue = some(bcx_ccx(cx).upcalls.cmp_type); - log #ifmt["--- lazily_emit_tydesc_glue CMP %s", + log #fmt["--- lazily_emit_tydesc_glue CMP %s", ty_to_str(bcx_tcx(cx), ti.ty)]; } } @@ -6273,15 +6273,15 @@ fn trans_crate(sess: &session::session, crate: &@ast::crate, tcx: &ty::ctxt, write_metadata(cx.ccx, crate); if ccx.sess.get_opts().stats { log_err "--- trans stats ---"; - log_err #ifmt["n_static_tydescs: %u", ccx.stats.n_static_tydescs]; - log_err #ifmt["n_derived_tydescs: %u", ccx.stats.n_derived_tydescs]; - log_err #ifmt["n_glues_created: %u", ccx.stats.n_glues_created]; - log_err #ifmt["n_null_glues: %u", ccx.stats.n_null_glues]; - log_err #ifmt["n_real_glues: %u", ccx.stats.n_real_glues]; + log_err #fmt["n_static_tydescs: %u", ccx.stats.n_static_tydescs]; + log_err #fmt["n_derived_tydescs: %u", ccx.stats.n_derived_tydescs]; + log_err #fmt["n_glues_created: %u", ccx.stats.n_glues_created]; + log_err #fmt["n_null_glues: %u", ccx.stats.n_null_glues]; + log_err #fmt["n_real_glues: %u", ccx.stats.n_real_glues]; for timing: {ident: istr, time: int} in *ccx.stats.fn_times { - log_err #ifmt["time: %s took %d ms", + log_err #fmt["time: %s took %d ms", timing.ident, timing.time]; } } diff --git a/src/comp/middle/tstate/states.rs b/src/comp/middle/tstate/states.rs index e6b35121ec2..1b4c14cb95a 100644 --- a/src/comp/middle/tstate/states.rs +++ b/src/comp/middle/tstate/states.rs @@ -171,7 +171,7 @@ fn find_pre_post_state_call(fcx: &fn_ctxt, pres: &prestate, a: &@expr, // FIXME: This could be a typestate constraint if vec::len(bs) != vec::len(ops) { fcx.ccx.tcx.sess.span_bug(a.span, - #ifmt["mismatched arg lengths: \ + #fmt["mismatched arg lengths: \ %u exprs vs. %u ops", vec::len(bs), vec::len(ops)]); } diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index 56ccb1b0dc5..0815a862b8c 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -2438,7 +2438,7 @@ mod unify { let sets = ~""; let j = 0u; while j < vec::len::>(vb.sets.nodes) { - if ufind::find(vb.sets, j) == i { sets += #ifmt[" %u", j]; } + if ufind::find(vb.sets, j) == i { sets += #fmt[" %u", j]; } j += 1u; } let typespec; @@ -2448,7 +2448,7 @@ mod unify { typespec = ~" =" + ty_to_str(tcx, typ); } } - log_err #ifmt["set %u:%s%s", i, typespec, sets]; + log_err #fmt["set %u:%s%s", i, typespec, sets]; i += 1u; } } diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 15e6301511c..2357ab1e420 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -1377,10 +1377,10 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast_util::pat_id_map, pat: &@ast::pat, let arg_len = vec::len::(arg_types); if arg_len != subpats_len { // TODO: note definition of tag variant - // TODO (issue #448): Wrap a #ifmt string over multiple + // TODO (issue #448): Wrap a #fmt string over multiple // lines... let s = - #ifmt["this pattern has %u field%s, but the \ + #fmt["this pattern has %u field%s, but the \ corresponding variant has %u field%s", subpats_len, if subpats_len == 1u { ~"" } else { ~"s" }, @@ -1400,7 +1400,7 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast_util::pat_id_map, pat: &@ast::pat, // TODO: note definition of tag variant fcx.ccx.tcx.sess.span_fatal( pat.span, - #ifmt["this pattern has %u field%s, \ + #fmt["this pattern has %u field%s, \ but the corresponding \ variant has no fields", subpats_len, @@ -1415,7 +1415,7 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast_util::pat_id_map, pat: &@ast::pat, // can never tell. fcx.ccx.tcx.sess.span_fatal( pat.span, - #ifmt["mismatched types: expected %s, found tag", + #fmt["mismatched types: expected %s, found tag", ty_to_str(fcx.ccx.tcx, expected)]); } } @@ -1428,7 +1428,7 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast_util::pat_id_map, pat: &@ast::pat, _ { fcx.ccx.tcx.sess.span_fatal( pat.span, - #ifmt["mismatched types: expected %s, found record", + #fmt["mismatched types: expected %s, found record", ty_to_str(fcx.ccx.tcx, expected)]); } } @@ -1437,7 +1437,7 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast_util::pat_id_map, pat: &@ast::pat, if ex_f_count < f_count || !etc && ex_f_count > f_count { fcx.ccx.tcx.sess.span_fatal( pat.span, - #ifmt["mismatched types: expected a record \ + #fmt["mismatched types: expected a record \ with %u fields, found one with %u \ fields", ex_f_count, f_count]); @@ -1450,7 +1450,7 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast_util::pat_id_map, pat: &@ast::pat, some(field) { check_pat(fcx, map, f.pat, field.mt.ty); } none. { fcx.ccx.tcx.sess.span_fatal(pat.span, - #ifmt["mismatched types: did not \ + #fmt["mismatched types: did not \ expect a record with a field %s", f.ident]); } @@ -1465,7 +1465,7 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast_util::pat_id_map, pat: &@ast::pat, _ { fcx.ccx.tcx.sess.span_fatal( pat.span, - #ifmt["mismatched types: expected %s, found tuple", + #fmt["mismatched types: expected %s, found tuple", ty_to_str(fcx.ccx.tcx, expected)]); } } @@ -1473,7 +1473,7 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast_util::pat_id_map, pat: &@ast::pat, if e_count != vec::len(ex_elts) { fcx.ccx.tcx.sess.span_fatal( pat.span, - #ifmt["mismatched types: expected a tuple \ + #fmt["mismatched types: expected a tuple \ with %u fields, found one with %u \ fields", vec::len(ex_elts), e_count]); @@ -1606,7 +1606,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier, if expected_arg_count != supplied_arg_count { fcx.ccx.tcx.sess.span_err( sp, - #ifmt["this function takes %u \ + #fmt["this function takes %u \ parameter%s but %u parameter%s supplied", expected_arg_count, if expected_arg_count == 1u { @@ -1828,7 +1828,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier, structure_of(fcx, oper.span, oper_t) != ty::ty_bool { tcx.sess.span_err( expr.span, - #ifmt["mismatched types: expected bool \ + #fmt["mismatched types: expected bool \ or integer but found %s", ty_to_str(tcx, oper_t)]); } @@ -2274,7 +2274,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier, _ { let t_err = resolve_type_vars_if_possible(fcx, base_t); let msg = - #ifmt["attempted field access on type %s", + #fmt["attempted field access on type %s", ty_to_str(tcx, t_err)]; tcx.sess.span_fatal(expr.span, msg); } diff --git a/src/comp/syntax/codemap.rs b/src/comp/syntax/codemap.rs index c56ccc21921..42120906b78 100644 --- a/src/comp/syntax/codemap.rs +++ b/src/comp/syntax/codemap.rs @@ -80,7 +80,7 @@ fn span_to_str(sp: &span, cm: &codemap) -> istr { let lo = lookup_char_pos(cm, cur.lo); let hi = lookup_char_pos(cm, cur.hi); res += - #ifmt["%s:%u:%u: %u:%u", + #fmt["%s:%u:%u: %u:%u", if some(lo.filename) == prev_file { ~"-" } else { @@ -114,9 +114,9 @@ fn emit_diagnostic(sp: &option::t, msg: &istr, kind: &istr, color: u8, if term::color_supported() { term::fg(io::stdout().get_buf_writer(), color); } - io::stdout().write_str(#ifmt[~"%s:", kind]); + io::stdout().write_str(#fmt[~"%s:", kind]); if term::color_supported() { term::reset(io::stdout().get_buf_writer()); } - io::stdout().write_str(#ifmt[~" %s\n", msg]); + io::stdout().write_str(#fmt[~" %s\n", msg]); maybe_highlight_lines(sp, cm, maybe_lines); } @@ -146,14 +146,14 @@ fn maybe_highlight_lines(sp: &option::t, cm: &codemap, // Print the offending lines for line: uint in display_lines { io::stdout().write_str( - #ifmt[~"%s:%u ", fm.name, line + 1u]); + #fmt[~"%s:%u ", fm.name, line + 1u]); let s = get_line(fm, line as int, file); if !str::ends_with(s, ~"\n") { s += ~"\n"; } io::stdout().write_str(s); } if elided { let last_line = display_lines[vec::len(display_lines) - 1u]; - let s = #ifmt[~"%s:%u ", fm.name, last_line + 1u]; + let s = #fmt[~"%s:%u ", fm.name, last_line + 1u]; let indent = str::char_len(s); let out = ~""; while indent > 0u { out += ~" "; indent -= 1u; } diff --git a/src/comp/syntax/ext/expand.rs b/src/comp/syntax/ext/expand.rs index ad58a617f45..c2a3a201126 100644 --- a/src/comp/syntax/ext/expand.rs +++ b/src/comp/syntax/ext/expand.rs @@ -27,7 +27,7 @@ fn expand_expr(exts: &hashmap, cx: &ext_ctxt, alt exts.find(extname) { none. { cx.span_fatal(pth.span, - #ifmt["macro undefined: '%s'", + #fmt["macro undefined: '%s'", extname]) } some(normal(ext)) { diff --git a/src/comp/syntax/ext/fmt.rs b/src/comp/syntax/ext/fmt.rs index 5e07c812236..abc73dc7c41 100644 --- a/src/comp/syntax/ext/fmt.rs +++ b/src/comp/syntax/ext/fmt.rs @@ -345,7 +345,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece], if expected_nargs < nargs { cx.span_fatal( sp, - #ifmt["too many arguments to #fmt. found %u, expected %u", + #fmt["too many arguments to #fmt. found %u, expected %u", nargs, expected_nargs]); } ret tmp_expr; diff --git a/src/comp/syntax/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs index 2df629d3f8c..3496791ce6e 100644 --- a/src/comp/syntax/ext/simplext.rs +++ b/src/comp/syntax/ext/simplext.rs @@ -309,9 +309,9 @@ fn transcribe_exprs(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint], let len = vec::len(*ms); if old_len != len { let msg = - #ifmt["'%s' occurs %u times, but ", + #fmt["'%s' occurs %u times, but ", fv, len] + - #ifmt["'%s' occurs %u times", + #fmt["'%s' occurs %u times", old_name, old_len]; cx.span_fatal( diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs index 57720422306..e479377f3d7 100644 --- a/src/comp/syntax/parse/lexer.rs +++ b/src/comp/syntax/parse/lexer.rs @@ -325,7 +325,7 @@ fn scan_numeric_escape(rdr: &reader, n_hex_digits: uint) -> char { rdr.bump(); if !is_hex_digit(n) { rdr.err( - #ifmt["illegal numeric character escape: %d", n as int]); + #fmt["illegal numeric character escape: %d", n as int]); fail; } accum_int *= 16; @@ -469,7 +469,7 @@ fn next_token_inner(rdr: &reader) -> token::token { 'U' { c2 = scan_numeric_escape(rdr, 8u); } c2 { rdr.err( - #ifmt["unknown character escape: %d", + #fmt["unknown character escape: %d", c2 as int]); fail; } @@ -510,7 +510,7 @@ fn next_token_inner(rdr: &reader) -> token::token { } c2 { rdr.err( - #ifmt["unknown string escape: %d", + #fmt["unknown string escape: %d", c2 as int]); fail; } @@ -551,7 +551,7 @@ fn next_token_inner(rdr: &reader) -> token::token { '%' { ret binop(rdr, token::PERCENT); } c { rdr.err( - #ifmt["unkown start of token: %d", c as int]); + #fmt["unkown start of token: %d", c as int]); fail; } } @@ -652,7 +652,7 @@ fn read_block_comment(rdr: &reader, code_to_the_left: bool) -> cmnt { let curr_line = ~"/*"; let level: int = 1; while level > 0 { - log #ifmt["=== block comment level %d", level]; + log #fmt["=== block comment level %d", level]; if rdr.is_eof() { rdr.err(~"unterminated block comment"); fail; } if rdr.curr() == '\n' { trim_whitespace_prefix_and_push_line(lines, curr_line, col); diff --git a/src/comp/syntax/print/pp.rs b/src/comp/syntax/print/pp.rs index 39e5b59eb61..ef92672435a 100644 --- a/src/comp/syntax/print/pp.rs +++ b/src/comp/syntax/print/pp.rs @@ -66,7 +66,7 @@ tag token { STRING(istr, int); BREAK(break_t); BEGIN(begin_t); END; EOF; } fn tok_str(t: token) -> istr { alt t { STRING(s, len) { - ret #ifmt[~"STR(%s,%d)", s, len]; + ret #fmt[~"STR(%s,%d)", s, len]; } BREAK(_) { ret ~"BREAK"; } BEGIN(_) { ret ~"BEGIN"; } @@ -85,7 +85,7 @@ fn buf_str(toks: &[mutable token], szs: &[mutable int], left: uint, while i != right && L != 0u { L -= 1u; if i != left { s += ~", "; } - s += #ifmt[~"%d=%s", szs[i], tok_str(toks[i])]; + s += #fmt[~"%d=%s", szs[i], tok_str(toks[i])]; i += 1u; i %= n; } @@ -104,7 +104,7 @@ fn mk_printer(out: io::writer, linewidth: uint) -> printer { // fall behind. let n: uint = 3u * linewidth; - log #ifmt[~"mk_printer %u", linewidth]; + log #fmt[~"mk_printer %u", linewidth]; let token: [mutable token] = vec::init_elt_mut(EOF, n); let size: [mutable int] = vec::init_elt_mut(0, n); let scan_stack: [mutable uint] = vec::init_elt_mut(0u, n); @@ -244,7 +244,7 @@ obj printer(out: io::writer, fn replace_last_token(t: token) { token[right] = t; } fn pretty_print(t: token) { - log #ifmt[~"pp [%u,%u]", left, right]; + log #fmt[~"pp [%u,%u]", left, right]; alt t { EOF. { if !scan_stack_empty { @@ -260,17 +260,17 @@ obj printer(out: io::writer, left = 0u; right = 0u; } else { self.advance_right(); } - log #ifmt[~"pp BEGIN/buffer [%u,%u]", left, right]; + log #fmt[~"pp BEGIN/buffer [%u,%u]", left, right]; token[right] = t; size[right] = -right_total; self.scan_push(right); } END. { if scan_stack_empty { - log #ifmt[~"pp END/print [%u,%u]", left, right]; + log #fmt[~"pp END/print [%u,%u]", left, right]; self.print(t, 0); } else { - log #ifmt[~"pp END/buffer [%u,%u]", left, right]; + log #fmt[~"pp END/buffer [%u,%u]", left, right]; self.advance_right(); token[right] = t; size[right] = -1; @@ -284,7 +284,7 @@ obj printer(out: io::writer, left = 0u; right = 0u; } else { self.advance_right(); } - log #ifmt[~"pp BREAK/buffer [%u,%u]", left, right]; + log #fmt[~"pp BREAK/buffer [%u,%u]", left, right]; self.check_stack(0); self.scan_push(right); token[right] = t; @@ -293,10 +293,10 @@ obj printer(out: io::writer, } STRING(s, len) { if scan_stack_empty { - log #ifmt[~"pp STRING/print [%u,%u]", left, right]; + log #fmt[~"pp STRING/print [%u,%u]", left, right]; self.print(t, len); } else { - log #ifmt[~"pp STRING/buffer [%u,%u]", left, right]; + log #fmt[~"pp STRING/buffer [%u,%u]", left, right]; self.advance_right(); token[right] = t; size[right] = len; @@ -307,14 +307,14 @@ obj printer(out: io::writer, } } fn check_stream() { - log #ifmt[~"check_stream [%u, %u] with left_total=%d, right_total=%d", + log #fmt[~"check_stream [%u, %u] with left_total=%d, right_total=%d", left, right, left_total, right_total]; if right_total - left_total > space { - log #ifmt[~"scan window is %d, longer than space on line (%d)", + log #fmt[~"scan window is %d, longer than space on line (%d)", right_total - left_total, space]; if !scan_stack_empty { if left == scan_stack[bottom] { - log #ifmt["setting %u to infinity and popping", left]; + log #fmt["setting %u to infinity and popping", left]; size[self.scan_pop_bottom()] = size_infinity; } } @@ -323,7 +323,7 @@ obj printer(out: io::writer, } } fn scan_push(x: uint) { - log #ifmt["scan_push %u", x]; + log #fmt["scan_push %u", x]; if scan_stack_empty { scan_stack_empty = false; } else { top += 1u; top %= buf_len; assert (top != bottom); } @@ -352,7 +352,7 @@ obj printer(out: io::writer, assert (right != left); } fn advance_left(x: token, L: int) { - log #ifmt["advnce_left [%u,%u], sizeof(%u)=%d", left, right, left, L]; + log #fmt["advnce_left [%u,%u], sizeof(%u)=%d", left, right, left, L]; if L >= 0 { self.print(x, L); alt x { @@ -391,13 +391,13 @@ obj printer(out: io::writer, } } fn print_newline(amount: int) { - log #ifmt["NEWLINE %d", amount]; + log #fmt["NEWLINE %d", amount]; out.write_str(~"\n"); pending_indentation = 0; self.indent(amount); } fn indent(amount: int) { - log #ifmt["INDENT %d", amount]; + log #fmt["INDENT %d", amount]; pending_indentation += amount; } fn top() -> print_stack_elt { @@ -414,7 +414,7 @@ obj printer(out: io::writer, out.write_str(s); } fn print(x: token, L: int) { - log #ifmt["print %s %d (remaining line space=%d)", + log #fmt["print %s %d (remaining line space=%d)", tok_str(x), L, space]; log buf_str(token, size, left, right, 6u); @@ -422,7 +422,7 @@ obj printer(out: io::writer, BEGIN(b) { if L > space { let col = margin - space + b.offset; - log #ifmt["print BEGIN -> push broken block at col %d", col]; + log #fmt["print BEGIN -> push broken block at col %d", col]; print_stack += [{offset: col, pbreak: broken(b.breaks)}]; } else { log "print BEGIN -> push fitting block"; diff --git a/src/comp/syntax/untyped_ast.rs b/src/comp/syntax/untyped_ast.rs index c1db95b2aaf..124a1e947f1 100644 --- a/src/comp/syntax/untyped_ast.rs +++ b/src/comp/syntax/untyped_ast.rs @@ -362,7 +362,7 @@ fn dummy() { alt *elts.(idx) { leaf_destructure(x) { x } _ { - ctx.ff(sp, #ifmt["expected %s in position %u", + ctx.ff(sp, #fmt["expected %s in position %u", #ident_to_str[leaf_destructure], idx]) } }], diff --git a/src/fuzzer/fuzzer.rs b/src/fuzzer/fuzzer.rs index 4de76a12abb..3b2491ad5aa 100644 --- a/src/fuzzer/fuzzer.rs +++ b/src/fuzzer/fuzzer.rs @@ -194,7 +194,7 @@ fn check_whole_compiler(code: &istr) { ~"/Users/jruderman/code/rust/build/stage1/rustc", [~"-c", filename]); - //log_err #ifmt("Status: %d", p.status); + //log_err #fmt("Status: %d", p.status); //log_err "Output: " + p.out; if p.err != ~"" { if contains(p.err, ~"argument of incompatible type") { @@ -264,7 +264,7 @@ fn content_is_dangerous_to_modify(code: &istr) -> bool { let dangerous_patterns = [~"obj", // not safe to steal; https://github.com/graydon/rust/issues/761 ~"#macro", // not safe to steal things inside of it, because they have a special syntax - ~"#", // strange representation of the arguments to #ifmt, for example + ~"#", // strange representation of the arguments to #fmt, for example ~" be ", // don't want to replace its child with a non-call: "Non-call expression in tail call" ~"@"]; // hangs when compiling: https://github.com/graydon/rust/issues/768 @@ -326,9 +326,9 @@ fn check_roundtrip_convergence(code: &istr, maxIters: uint) { } if old == new { - log_err #ifmt["Converged after %u iterations", i]; + log_err #fmt["Converged after %u iterations", i]; } else { - log_err #ifmt["Did not converge after %u iterations!", i]; + log_err #fmt["Did not converge after %u iterations!", i]; write_file(~"round-trip-a.rs", old); write_file(~"round-trip-b.rs", new); std::run::run_program(~"diff", @@ -339,12 +339,12 @@ fn check_roundtrip_convergence(code: &istr, maxIters: uint) { } fn check_convergence(files: &[istr]) { - log_err #ifmt["pp convergence tests: %u files", vec::len(files)]; + log_err #fmt["pp convergence tests: %u files", vec::len(files)]; for file in files { if !file_is_confusing(file) { let s = io::read_whole_file_str(file); if !content_is_confusing(s) { - log_err #ifmt["pp converge: %s", file]; + log_err #fmt["pp converge: %s", file]; // Change from 7u to 2u when https://github.com/graydon/rust/issues/759 is fixed check_roundtrip_convergence(s, 7u); } @@ -376,7 +376,7 @@ fn check_variants(files: &[istr]) { fn main(args: [istr]) { if vec::len(args) != 2u { - log_err #ifmt["usage: %s ", args[0]]; + log_err #fmt["usage: %s ", args[0]]; ret; } let files = []; diff --git a/src/lib/net.rs b/src/lib/net.rs index e7d8d13df2b..246574dd07b 100644 --- a/src/lib/net.rs +++ b/src/lib/net.rs @@ -6,7 +6,7 @@ tag ip_addr { ipv4(u8, u8, u8, u8); } fn format_addr(ip: ip_addr) -> istr { alt ip { ipv4(a, b, c, d) { - #ifmt["%u.%u.%u.%u", a as uint, b as uint, c as uint, d as uint] + #fmt["%u.%u.%u.%u", a as uint, b as uint, c as uint, d as uint] } _ { fail "Unsupported address type"; } } diff --git a/src/lib/task.rs b/src/lib/task.rs index f9765e64b88..71032bbcd64 100644 --- a/src/lib/task.rs +++ b/src/lib/task.rs @@ -81,7 +81,7 @@ fn join(task_port: (task_id, comm::port)) -> task_result { exit(_id, res) { if _id == id { ret res - } else { fail #ifmt["join received id %d, expected %d", _id, id] } + } else { fail #fmt["join received id %d, expected %d", _id, id] } } } } diff --git a/src/lib/test.rs b/src/lib/test.rs index 77936e2b572..e8ab05a46ba 100644 --- a/src/lib/test.rs +++ b/src/lib/test.rs @@ -120,11 +120,11 @@ fn run_tests_console_(opts: &test_opts, tests: &[test_desc], te_filtered(filtered_tests) { st.total = vec::len(filtered_tests); st.out.write_line( - #ifmt["\nrunning %u tests", st.total]); + #fmt["\nrunning %u tests", st.total]); } te_wait(test) { st.out.write_str( - #ifmt["test %s ... ", test.name]); + #fmt["test %s ... ", test.name]); } te_result(test, result) { alt result { @@ -167,17 +167,17 @@ fn run_tests_console_(opts: &test_opts, tests: &[test_desc], st.out.write_line(~"\nfailures:"); for test: test_desc in st.failures { let testname = test.name; // Satisfy alias analysis - st.out.write_line(#ifmt[" %s", testname]); + st.out.write_line(#fmt[" %s", testname]); } } - st.out.write_str(#ifmt["\nresult: "]); + st.out.write_str(#fmt["\nresult: "]); if success { // There's no parallelism at this point so it's safe to use color write_ok(st.out, true); } else { write_failed(st.out, true); } st.out.write_str( - #ifmt[". %u passed; %u failed; %u ignored\n\n", st.passed, + #fmt[". %u passed; %u failed; %u ignored\n\n", st.passed, st.failed, st.ignored]); ret success; @@ -225,7 +225,7 @@ fn run_tests(opts: &test_opts, tests: &[test_desc], to_task: &test_to_task, // provide a great user experience because you might sit waiting for the // result of a particular test for an unusually long amount of time. let concurrency = get_concurrency(); - log #ifmt["using %u test tasks", concurrency]; + log #fmt["using %u test tasks", concurrency]; let total = vec::len(filtered_tests); let run_idx = 0u; let wait_idx = 0u; diff --git a/src/test/bench/shootout-binarytrees.rs b/src/test/bench/shootout-binarytrees.rs index d0896241c9e..d6a44e6eb82 100644 --- a/src/test/bench/shootout-binarytrees.rs +++ b/src/test/bench/shootout-binarytrees.rs @@ -28,7 +28,7 @@ fn main() { } else { max_depth = n; } let stretch_depth = max_depth + 1; let stretch_tree = bottom_up_tree(0, stretch_depth); - log #ifmt["stretch tree of depth %d\t check: %d", stretch_depth, + log #fmt["stretch tree of depth %d\t check: %d", stretch_depth, item_check(stretch_tree)]; let long_lived_tree = bottom_up_tree(0, max_depth); let depth = min_depth; @@ -43,10 +43,10 @@ fn main() { chk += item_check(temp_tree); i += 1; } - log #ifmt["%d\t trees of depth %d\t check: %d", iterations * 2, depth, + log #fmt["%d\t trees of depth %d\t check: %d", iterations * 2, depth, chk]; depth += 2; } - log #ifmt["long lived trees of depth %d\t check: %d", max_depth, + log #fmt["long lived trees of depth %d\t check: %d", max_depth, item_check(long_lived_tree)]; } diff --git a/src/test/bench/shootout-fannkuchredux.rs b/src/test/bench/shootout-fannkuchredux.rs index c36fe8d832a..fa4a17180ae 100644 --- a/src/test/bench/shootout-fannkuchredux.rs +++ b/src/test/bench/shootout-fannkuchredux.rs @@ -58,5 +58,5 @@ fn fannkuch(n: int) -> int { fn main(args: [istr]) { let n = 7; - log #ifmt["Pfannkuchen(%d) = %d", n, fannkuch(n)]; + log #fmt["Pfannkuchen(%d) = %d", n, fannkuch(n)]; } diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index b9fba948561..6a9a5348c2e 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -67,7 +67,7 @@ fn stress_task(id: int) { let n = 15; assert (fib(n) == fib(n)); i += 1; - log_err #ifmt["%d: Completed %d iterations", id, i]; + log_err #fmt["%d: Completed %d iterations", id, i]; } } @@ -106,7 +106,7 @@ fn main(argv: [istr]) { let elapsed = stop - start; out.write_line( - #ifmt["%d\t%d\t%s", n, fibn, + #fmt["%d\t%d\t%s", n, fibn, u64::str(elapsed)]); } } diff --git a/src/test/bench/task-perf-word-count-generic.rs b/src/test/bench/task-perf-word-count-generic.rs index 5d01e725ed3..3a8f643bc37 100644 --- a/src/test/bench/task-perf-word-count-generic.rs +++ b/src/test/bench/task-perf-word-count-generic.rs @@ -127,7 +127,7 @@ mod map_reduce { while !is_done || ref_count > 0 { alt recv(p) { emit_val(v) { - // log_err #ifmt("received %d", v); + // log_err #fmt("received %d", v); ret some(v); } done. { @@ -202,7 +202,7 @@ fn main(argv: [istr]) { let out = io::stdout(); out.write_line( - #ifmt["Usage: %s ...", argv[0]]); + #fmt["Usage: %s ...", argv[0]]); // TODO: run something just to make sure the code hasn't // broken yet. This is the unit test mode of this program. diff --git a/src/test/bench/task-perf-word-count.rs b/src/test/bench/task-perf-word-count.rs index e947d6bd1d9..c62ebc73b5d 100644 --- a/src/test/bench/task-perf-word-count.rs +++ b/src/test/bench/task-perf-word-count.rs @@ -122,7 +122,7 @@ mod map_reduce { while !is_done || ref_count > 0 { alt recv(p) { emit_val(v) { - // log_err #ifmt("received %d", v); + // log_err #fmt("received %d", v); ret some(v); } done. { @@ -196,7 +196,7 @@ fn main(argv: [istr]) { let out = io::stdout(); out.write_line( - #ifmt["Usage: %s ...", argv[0]]); + #fmt["Usage: %s ...", argv[0]]); // TODO: run something just to make sure the code hasn't // broken yet. This is the unit test mode of this program. diff --git a/src/test/compile-fail/ext-after-attrib.rs b/src/test/compile-fail/ext-after-attrib.rs index 7d9d7770b89..ef15958c3fc 100644 --- a/src/test/compile-fail/ext-after-attrib.rs +++ b/src/test/compile-fail/ext-after-attrib.rs @@ -1,7 +1,7 @@ -// error-pattern:expecting [, found ifmt +// error-pattern:expecting [, found fmt // Don't know how to deal with a syntax extension appearing after an // item attribute. Probably could use a better error message. #[foo = "bar"] -#ifmt("baz") +#fmt("baz") fn main() { } \ No newline at end of file diff --git a/src/test/compile-fail/extfmt-missing-type.rs b/src/test/compile-fail/extfmt-missing-type.rs index 55adc1caec5..9e1cbc557d4 100644 --- a/src/test/compile-fail/extfmt-missing-type.rs +++ b/src/test/compile-fail/extfmt-missing-type.rs @@ -1,3 +1,3 @@ // error-pattern:missing type -fn main() { #ifmt["%+"]; } +fn main() { #fmt["%+"]; } diff --git a/src/test/compile-fail/extfmt-no-args.rs b/src/test/compile-fail/extfmt-no-args.rs index c69a4410fe0..7c13ef99dc5 100644 --- a/src/test/compile-fail/extfmt-no-args.rs +++ b/src/test/compile-fail/extfmt-no-args.rs @@ -1,3 +1,3 @@ // error-pattern:format string -fn main() { #ifmt[]; } +fn main() { #fmt[]; } diff --git a/src/test/compile-fail/extfmt-non-literal.rs b/src/test/compile-fail/extfmt-non-literal.rs index 451e020fcaf..445455f33d8 100644 --- a/src/test/compile-fail/extfmt-non-literal.rs +++ b/src/test/compile-fail/extfmt-non-literal.rs @@ -1,8 +1,8 @@ // error-pattern: literal fn main() { - // #ifmt's first argument must be a literal. Hopefully this + // #fmt's first argument must be a literal. Hopefully this // restriction can be eased eventually to just require a // compile-time constant. - let x = #ifmt["a" + "b"]; + let x = #fmt["a" + "b"]; } diff --git a/src/test/compile-fail/extfmt-non-literal2.rs b/src/test/compile-fail/extfmt-non-literal2.rs index 19af91bfcc7..8a2d7c4bbed 100644 --- a/src/test/compile-fail/extfmt-non-literal2.rs +++ b/src/test/compile-fail/extfmt-non-literal2.rs @@ -1,8 +1,8 @@ // error-pattern: literal fn main() { - // #ifmt's first argument must be a literal. Hopefully this + // #fmt's first argument must be a literal. Hopefully this // restriction can be eased eventually to just require a // compile-time constant. - let x = #ifmt[20]; + let x = #fmt[20]; } diff --git a/src/test/compile-fail/extfmt-not-enough-args.rs b/src/test/compile-fail/extfmt-not-enough-args.rs index beb9d3d8e96..849a836060d 100644 --- a/src/test/compile-fail/extfmt-not-enough-args.rs +++ b/src/test/compile-fail/extfmt-not-enough-args.rs @@ -2,4 +2,4 @@ use std; -fn main() { let s = #ifmt["%s%s%s", "test", "test"]; } +fn main() { let s = #fmt["%s%s%s", "test", "test"]; } diff --git a/src/test/compile-fail/extfmt-too-many-args.rs b/src/test/compile-fail/extfmt-too-many-args.rs index 393fd4ca618..4c91da227e1 100644 --- a/src/test/compile-fail/extfmt-too-many-args.rs +++ b/src/test/compile-fail/extfmt-too-many-args.rs @@ -2,4 +2,4 @@ use std; -fn main() { let s = #ifmt["%s", "test", "test"]; } +fn main() { let s = #fmt["%s", "test", "test"]; } diff --git a/src/test/compile-fail/extfmt-unknown-type.rs b/src/test/compile-fail/extfmt-unknown-type.rs index 7d2ce0902de..3a35a1d727b 100644 --- a/src/test/compile-fail/extfmt-unknown-type.rs +++ b/src/test/compile-fail/extfmt-unknown-type.rs @@ -1,3 +1,3 @@ // error-pattern:unknown type -fn main() { #ifmt["%w"]; } +fn main() { #fmt["%w"]; } diff --git a/src/test/compile-fail/extfmt-unsigned-plus.rs b/src/test/compile-fail/extfmt-unsigned-plus.rs index 1dfce7e89c4..4ac41efb312 100644 --- a/src/test/compile-fail/extfmt-unsigned-plus.rs +++ b/src/test/compile-fail/extfmt-unsigned-plus.rs @@ -2,5 +2,5 @@ fn main() { // Can't use a sign on unsigned conversions - #ifmt["%+u", 10u]; + #fmt["%+u", 10u]; } diff --git a/src/test/compile-fail/extfmt-unsigned-space.rs b/src/test/compile-fail/extfmt-unsigned-space.rs index 2866c569ff1..6393548eb3d 100644 --- a/src/test/compile-fail/extfmt-unsigned-space.rs +++ b/src/test/compile-fail/extfmt-unsigned-space.rs @@ -2,5 +2,5 @@ fn main() { // Can't use a space on unsigned conversions - #ifmt["% u", 10u]; + #fmt["% u", 10u]; } diff --git a/src/test/compile-fail/extfmt-unterminated-conv.rs b/src/test/compile-fail/extfmt-unterminated-conv.rs index 19cd69c7f69..3b7d0ce1767 100644 --- a/src/test/compile-fail/extfmt-unterminated-conv.rs +++ b/src/test/compile-fail/extfmt-unterminated-conv.rs @@ -1,3 +1,3 @@ // error-pattern:unterminated conversion -fn main() { #ifmt["%"]; } +fn main() { #fmt["%"]; } diff --git a/src/test/compiletest/compiletest.rs b/src/test/compiletest/compiletest.rs index 70448274984..5f3fd1944dd 100644 --- a/src/test/compiletest/compiletest.rs +++ b/src/test/compiletest/compiletest.rs @@ -70,21 +70,21 @@ fn parse_config(args: &[istr]) -> config { fn log_config(config: &config) { let c = config; - logv(c, #ifmt["configuration:"]); - logv(c, #ifmt["compile_lib_path: %s", + logv(c, #fmt["configuration:"]); + logv(c, #fmt["compile_lib_path: %s", config.compile_lib_path]); - logv(c, #ifmt["run_lib_path: %s", config.run_lib_path]); - logv(c, #ifmt["rustc_path: %s", config.rustc_path]); - logv(c, #ifmt["src_base: %s", config.src_base]); - logv(c, #ifmt["build_base: %s", config.build_base]); - logv(c, #ifmt["stage_id: %s", config.stage_id]); - logv(c, #ifmt["mode: %s", mode_str(config.mode)]); - logv(c, #ifmt["run_ignored: %b", config.run_ignored]); - logv(c, #ifmt["filter: %s", opt_str(config.filter)]); - logv(c, #ifmt["runtool: %s", opt_str(config.runtool)]); - logv(c, #ifmt["rustcflags: %s", opt_str(config.rustcflags)]); - logv(c, #ifmt["verbose: %b", config.verbose]); - logv(c, #ifmt["\n"]); + logv(c, #fmt["run_lib_path: %s", config.run_lib_path]); + logv(c, #fmt["rustc_path: %s", config.rustc_path]); + logv(c, #fmt["src_base: %s", config.src_base]); + logv(c, #fmt["build_base: %s", config.build_base]); + logv(c, #fmt["stage_id: %s", config.stage_id]); + logv(c, #fmt["mode: %s", mode_str(config.mode)]); + logv(c, #fmt["run_ignored: %b", config.run_ignored]); + logv(c, #fmt["filter: %s", opt_str(config.filter)]); + logv(c, #fmt["runtool: %s", opt_str(config.runtool)]); + logv(c, #fmt["rustcflags: %s", opt_str(config.rustcflags)]); + logv(c, #fmt["verbose: %b", config.verbose]); + logv(c, #fmt["\n"]); } fn opt_str(maybestr: option::t) -> istr { @@ -139,12 +139,12 @@ type tests_and_conv_fn = {tests: [test::test_desc], to_task: fn(&fn()) -> test::joinable}; fn make_tests(cx: &cx) -> tests_and_conv_fn { - log #ifmt["making tests from %s", cx.config.src_base]; + log #fmt["making tests from %s", cx.config.src_base]; let configport = port::<[u8]>(); let tests = []; for file: istr in fs::list_dir(cx.config.src_base) { let file = file; - log #ifmt["inspecting file %s", file]; + log #fmt["inspecting file %s", file]; if is_test(cx.config, file) { tests += [make_test(cx, file, configport)]; } @@ -182,7 +182,7 @@ fn make_test(cx: &cx, testfile: &istr, configport: &port<[u8]>) -> } fn make_test_name(config: &config, testfile: &istr) -> istr { - #ifmt["[%s] %s", mode_str(config.mode), testfile] + #fmt["[%s] %s", mode_str(config.mode), testfile] } /* diff --git a/src/test/compiletest/header.rs b/src/test/compiletest/header.rs index 5a4a0ea095b..d891e87f5dd 100644 --- a/src/test/compiletest/header.rs +++ b/src/test/compiletest/header.rs @@ -114,7 +114,7 @@ fn parse_name_value_directive(line: &istr, let value = str::slice(line, colon + str::byte_len(keycolon), str::byte_len(line)); - log #ifmt("%s: %s", directive, + log #fmt("%s: %s", directive, value); option::some(value) } else { option::none } diff --git a/src/test/compiletest/runtest.rs b/src/test/compiletest/runtest.rs index e8e51919680..9128160855b 100644 --- a/src/test/compiletest/runtest.rs +++ b/src/test/compiletest/runtest.rs @@ -24,7 +24,7 @@ fn run(cx: &cx, _testfile: -[u8]) { // We're going to be dumping a lot of info. Start on a new line. io::stdout().write_str(~"\n\n"); } - log #ifmt["running %s", testfile]; + log #fmt["running %s", testfile]; let props = load_props(testfile); alt cx.config.mode { mode_compile_fail. { run_cfail_test(cx, props, testfile); } @@ -90,12 +90,12 @@ fn run_pretty_test(cx: &cx, props: &test_props, testfile: &istr) { let round = 0; while round < rounds { - logv(cx.config, #ifmt["pretty-printing round %d", round]); + logv(cx.config, #fmt["pretty-printing round %d", round]); let procres = print_source(cx, testfile, srcs[round]); if procres.status != 0 { fatal_procres( - #ifmt["pretty-printing failed in round %d", round], + #fmt["pretty-printing failed in round %d", round], procres); } @@ -147,7 +147,7 @@ fn run_pretty_test(cx: &cx, props: &test_props, testfile: &istr) { if expected != actual { error(~"pretty-printed source does match expected source"); let msg = - #ifmt["\n\ + #fmt["\n\ expected:\n\ ------------------------------------------\n\ %s\n\ @@ -190,7 +190,7 @@ fn check_error_patterns(props: &test_props, testfile: &istr, let next_err_pat = props.error_patterns[next_err_idx]; for line: istr in str::split(procres.stdout, '\n' as u8) { if str::find(line, next_err_pat) > 0 { - log #ifmt["found error pattern %s", + log #fmt["found error pattern %s", next_err_pat]; next_err_idx += 1u; if next_err_idx == vec::len(props.error_patterns) { @@ -206,11 +206,11 @@ fn check_error_patterns(props: &test_props, testfile: &istr, vec::len(props.error_patterns)); if vec::len(missing_patterns) == 1u { fatal_procres( - #ifmt["error pattern '%s' not found!", + #fmt["error pattern '%s' not found!", missing_patterns[0]], procres); } else { for pattern: istr in missing_patterns { - error(#ifmt["error pattern '%s' not found!", + error(#fmt["error pattern '%s' not found!", pattern]); } fatal_procres(~"multiple error patterns not found", procres); @@ -299,7 +299,7 @@ fn program_output(cx: &cx, testfile: &istr, lib_path: &istr, prog: &istr, let cmdline = { let cmdline = make_cmdline(lib_path, prog, args); - logv(cx.config, #ifmt["executing %s", + logv(cx.config, #fmt["executing %s", cmdline]); cmdline }; @@ -312,7 +312,7 @@ fn program_output(cx: &cx, testfile: &istr, lib_path: &istr, prog: &istr, } fn make_cmdline(libpath: &istr, prog: &istr, args: &[istr]) -> istr { - #ifmt["%s %s %s", + #fmt["%s %s %s", lib_path_cmd_prefix(libpath), prog, str::connect(args, ~" ")] @@ -321,7 +321,7 @@ fn make_cmdline(libpath: &istr, prog: &istr, args: &[istr]) -> istr { // Build the LD_LIBRARY_PATH variable as it would be seen on the command line // for diagnostic purposes fn lib_path_cmd_prefix(path: &istr) -> istr { - #ifmt["%s=\"%s\"", + #fmt["%s=\"%s\"", util::lib_path_env_var(), util::make_new_path(path)] } @@ -362,14 +362,14 @@ fn output_base_name(config: &config, testfile: &istr) -> istr { parts = vec::slice(parts, 0u, vec::len(parts) - 1u); str::connect(parts, ~".") }; - #ifmt["%s%s.%s", base, filename, + #fmt["%s%s.%s", base, filename, config.stage_id] } fn maybe_dump_to_stdout(config: &config, out: &istr, err: &istr) { if config.verbose { - let sep1 = #ifmt["------%s------------------------------", ~"stdout"]; - let sep2 = #ifmt["------%s------------------------------", ~"stderr"]; + let sep1 = #fmt["------%s------------------------------", ~"stdout"]; + let sep2 = #fmt["------%s------------------------------", ~"stderr"]; let sep3 = ~"------------------------------------------"; io::stdout().write_line(sep1); io::stdout().write_line(out); @@ -380,14 +380,14 @@ fn maybe_dump_to_stdout(config: &config, out: &istr, err: &istr) { } fn error(err: &istr) { - io::stdout().write_line(#ifmt["\nerror: %s", err]); + io::stdout().write_line(#fmt["\nerror: %s", err]); } fn fatal(err: &istr) -> ! { error(err); fail; } fn fatal_procres(err: &istr, procres: procres) -> ! { let msg = - #ifmt["\n\ + #fmt["\n\ error: %s\n\ command: %s\n\ stdout:\n\ diff --git a/src/test/compiletest/util.rs b/src/test/compiletest/util.rs index 88320d29dc1..b15e16b5d4d 100644 --- a/src/test/compiletest/util.rs +++ b/src/test/compiletest/util.rs @@ -11,7 +11,7 @@ fn make_new_path(path: &istr) -> istr { // maintain the current value while adding our own alt getenv(lib_path_env_var()) { option::some(curr) { - #ifmt["%s:%s", path, curr] } + #fmt["%s:%s", path, curr] } option::none. { path } } } diff --git a/src/test/run-fail/fmt-fail.rs b/src/test/run-fail/fmt-fail.rs index 67814d12c45..2791db07446 100644 --- a/src/test/run-fail/fmt-fail.rs +++ b/src/test/run-fail/fmt-fail.rs @@ -2,4 +2,4 @@ // no-valgrind use std; -fn main() { let str_var: istr = ~"meh"; fail #ifmt["%s", str_var]; } +fn main() { let str_var: istr = ~"meh"; fail #fmt["%s", str_var]; } diff --git a/src/test/run-pass/item-attributes.rs b/src/test/run-pass/item-attributes.rs index 58d38ba94f4..dd5fb0b18b3 100644 --- a/src/test/run-pass/item-attributes.rs +++ b/src/test/run-pass/item-attributes.rs @@ -167,7 +167,7 @@ mod test_distinguish_syntax_ext { use std; fn f() { - #ifmt["test%s", ~"s"]; + #fmt["test%s", ~"s"]; #[attr = "val"] fn g() { } } diff --git a/src/test/stdtest/qsort.rs b/src/test/stdtest/qsort.rs index 8aaf9c61428..32109dc1caa 100644 --- a/src/test/stdtest/qsort.rs +++ b/src/test/stdtest/qsort.rs @@ -54,7 +54,7 @@ fn test_simple() { // Silly, but what else can we do? check vec::same_length(expected, immut_names); let pairs = vec::zip(expected, immut_names); - for (a, b) in pairs { log #ifmt["%d %d", a, b]; assert (a == b); } + for (a, b) in pairs { log #fmt["%d %d", a, b]; assert (a == b); } } // Local Variables: