Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Convert uses of #fmt to #ifmt. Issue #855

  • Loading branch information...
commit 498e38b705348333df9ab02059d07f114baccc45 1 parent 959938e
@brson brson authored
Showing with 345 additions and 380 deletions.
  1. +5 −9 src/comp/back/link.rs
  2. +18 −18 src/comp/driver/rustc.rs
  3. +5 −5 src/comp/driver/session.rs
  4. +7 −9 src/comp/front/attr.rs
  5. +8 −8 src/comp/front/test.rs
  6. +1 −1  src/comp/lib/llvm.rs
  7. +17 −17 src/comp/metadata/creader.rs
  8. +9 −12 src/comp/metadata/decoder.rs
  9. +1 −1  src/comp/metadata/encoder.rs
  10. +6 −6 src/comp/middle/alias.rs
  11. +13 −13 src/comp/middle/kind.rs
  12. +2 −4 src/comp/middle/resolve.rs
  13. +23 −23 src/comp/middle/trans.rs
  14. +3 −3 src/comp/middle/tstate/states.rs
  15. +5 −5 src/comp/middle/ty.rs
  16. +43 −42 src/comp/middle/typeck.rs
  17. +10 −13 src/comp/syntax/codemap.rs
  18. +3 −3 src/comp/syntax/ext/expand.rs
  19. +13 −12 src/comp/syntax/ext/fmt.rs
  20. +13 −12 src/comp/syntax/ext/ifmt.rs
  21. +5 −5 src/comp/syntax/ext/simplext.rs
  22. +7 −8 src/comp/syntax/parse/lexer.rs
  23. +20 −22 src/comp/syntax/print/pp.rs
  24. +1 −1  src/comp/syntax/untyped_ast.rs
  25. +7 −7 src/fuzzer/fuzzer.rs
  26. +1 −2  src/lib/net.rs
  27. +1 −1  src/lib/task.rs
  28. +7 −8 src/lib/test.rs
  29. +3 −3 src/test/bench/shootout-binarytrees.rs
  30. +1 −1  src/test/bench/shootout-fannkuchredux.rs
  31. +3 −4 src/test/bench/shootout-pfib.rs
  32. +2 −2 src/test/bench/task-perf-word-count-generic.rs
  33. +3 −3 src/test/bench/task-perf-word-count.rs
  34. +2 −2 src/test/compile-fail/ext-after-attrib.rs
  35. +1 −1  src/test/compile-fail/extfmt-missing-type.rs
  36. +1 −1  src/test/compile-fail/extfmt-no-args.rs
  37. +2 −2 src/test/compile-fail/extfmt-non-literal.rs
  38. +2 −2 src/test/compile-fail/extfmt-non-literal2.rs
  39. +1 −1  src/test/compile-fail/extfmt-not-enough-args.rs
  40. +1 −1  src/test/compile-fail/extfmt-too-many-args.rs
  41. +1 −1  src/test/compile-fail/extfmt-unknown-type.rs
  42. +2 −2 src/test/compile-fail/extfmt-unsigned-plus.rs
  43. +2 −2 src/test/compile-fail/extfmt-unsigned-space.rs
  44. +1 −1  src/test/compile-fail/extfmt-unterminated-conv.rs
  45. +21 −33 src/test/compiletest/compiletest.rs
  46. +2 −3 src/test/compiletest/header.rs
  47. +36 −40 src/test/compiletest/runtest.rs
  48. +1 −2  src/test/compiletest/util.rs
  49. +1 −1  src/test/run-fail/fmt-fail.rs
  50. +1 −1  src/test/run-pass/item-attributes.rs
  51. +1 −1  src/test/stdtest/qsort.rs
View
14 src/comp/back/link.rs
@@ -341,9 +341,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 istr::from_estr(#fmt["%u_%s",
- istr::byte_len(s),
- istr::to_estr(s)]);
+ ret #ifmt["%u_%s", istr::byte_len(s), s];
}
fn len_and_str_lit(l: &ast::lit) -> istr {
@@ -374,9 +372,9 @@ 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(istr::from_estr(
- #fmt["missing crate link meta '%s', using '%s' as default",
- istr::to_estr(name), istr::to_estr(default)]));
+ sess.warn(
+ #ifmt["missing crate link meta '%s', using '%s' as default",
+ name, default]);
}
fn crate_meta_name(sess: &session::session, _crate: &ast::crate,
@@ -461,9 +459,7 @@ fn mangle(ss: &[istr]) -> istr {
let n = ~"_ZN"; // Begin name-sequence.
for s: istr in ss {
- n += istr::from_estr(#fmt["%u%s",
- istr::byte_len(s),
- istr::to_estr(s)]);
+ n += #ifmt["%u%s", istr::byte_len(s), s];
}
n += ~"E"; // End name-sequence.
View
36 src/comp/driver/rustc.rs
@@ -122,8 +122,8 @@ 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 #fmt["time: %s took %s s", istr::to_estr(what),
- istr::to_estr(common::float_to_str(end - start, 3u))];
+ log_err #ifmt["time: %s took %s s", what,
+ common::float_to_str(end - start, 3u)];
ret rv;
}
@@ -255,21 +255,21 @@ fn pretty_print_input(sess: session::session, cfg: ast::crate_cfg,
}
fn version(argv0: &istr) {
- let vers = "unknown version";
+ let vers = ~"unknown version";
// FIXME: Restore after istr conversion
//let env_vers = #env["CFG_VERSION"];
- let env_vers = "FIXME";
- if str::byte_len(env_vers) != 0u { vers = env_vers; }
+ let env_vers = ~"FIXME";
+ if istr::byte_len(env_vers) != 0u { vers = env_vers; }
io::stdout().write_str(
- istr::from_estr(#fmt["%s %s\n",
- istr::to_estr(argv0),
- vers]));
+ #ifmt["%s %s\n",
+ argv0,
+ vers]);
}
fn usage(argv0: &istr) {
- io::stdout().write_str(istr::from_estr(
- #fmt["usage: %s [options] <input>\n", istr::to_estr(argv0)] +
- "
+ io::stdout().write_str(
+ #ifmt["usage: %s [options] <input>\n", argv0] +
+ ~"
options:
-h --help display this message
@@ -302,7 +302,7 @@ options:
--test build test harness
--gc garbage collect shared data (experimental/temporary)
-"));
+");
}
fn get_os(triple: &istr) -> session::os {
@@ -473,7 +473,7 @@ fn main(args: [str]) {
alt getopts::getopts(args, opts()) {
getopts::success(m) { m }
getopts::failure(f) {
- log_err #fmt["error: %s", istr::to_estr(getopts::fail_str(f))];
+ log_err #ifmt["error: %s", getopts::fail_str(f)];
fail
}
};
@@ -637,11 +637,11 @@ fn main(args: [str]) {
let err_code = run::run_program(prog, gcc_args);
if 0 != err_code {
- sess.err(istr::from_estr(
- #fmt["linking with gcc failed with code %d", err_code]));
- sess.note(istr::from_estr(
- #fmt["gcc arguments: %s",
- istr::to_estr(istr::connect(gcc_args, ~" "))]));
+ sess.err(
+ #ifmt["linking with gcc failed with code %d", err_code]);
+ sess.note(
+ #ifmt["gcc arguments: %s",
+ istr::connect(gcc_args, ~" ")]);
sess.abort_if_errors();
}
// Clean up on Darwin
View
10 src/comp/driver/session.rs
@@ -95,13 +95,13 @@ obj session(targ_cfg: @config,
}
fn span_bug(sp: span, msg: &istr) -> ! {
self.span_fatal(sp,
- istr::from_estr(#fmt["internal compiler error %s",
- istr::to_estr(msg)]));
+ #ifmt["internal compiler error %s",
+ msg]);
}
fn bug(msg: &istr) -> ! {
- self.fatal(istr::from_estr(
- #fmt["internal compiler error %s",
- istr::to_estr(msg)]));
+ self.fatal(
+ #ifmt["internal compiler error %s",
+ msg]);
}
fn span_unimpl(sp: span, msg: &istr) -> ! {
self.span_bug(sp, ~"unimplemented " + msg);
View
16 src/comp/front/attr.rs
@@ -124,13 +124,11 @@ fn eq(a: @ast::meta_item, b: @ast::meta_item) -> bool {
}
fn contains(haystack: &[@ast::meta_item], needle: @ast::meta_item) -> bool {
- log #fmt["looking for %s",
- istr::to_estr(
- syntax::print::pprust::meta_item_to_str(*needle))];
+ log #ifmt["looking for %s",
+ syntax::print::pprust::meta_item_to_str(*needle)];
for item: @ast::meta_item in haystack {
- log #fmt["looking in %s",
- istr::to_estr(
- syntax::print::pprust::meta_item_to_str(*item))];
+ log #ifmt["looking in %s",
+ syntax::print::pprust::meta_item_to_str(*item)];
if eq(item, needle) { log "found it!"; ret true; }
}
log "found it not :(";
@@ -185,9 +183,9 @@ fn require_unique_names(sess: &session::session, metas: &[@ast::meta_item]) {
for meta: @ast::meta_item in metas {
let name = get_meta_item_name(meta);
if map.contains_key(name) {
- sess.span_fatal(meta.span, istr::from_estr(
- #fmt["duplicate meta item `%s`",
- istr::to_estr(name)]));
+ sess.span_fatal(meta.span,
+ #ifmt["duplicate meta item `%s`",
+ name]);
}
map.insert(name, ());
}
View
16 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 #fmt["current path: %s",
- istr::to_estr(ast_util::path_name_i(cx.path))];
+ log #ifmt["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 #fmt["have %u test functions", vec::len(cx.testfns)];
+ log #ifmt["have %u test functions", vec::len(cx.testfns)];
}
let res = fold::noop_fold_item(i, fld);
@@ -168,8 +168,8 @@ fn mk_test_module(cx: &test_ctxt) -> @ast::item {
node: item_,
span: dummy_sp()};
- log #fmt["Synthetic test module:\n%s\n",
- istr::to_estr(pprust::item_to_str(@item))];
+ log #ifmt["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 #fmt["building test vector from %u tests", vec::len(cx.testfns)];
+ log #ifmt["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,8 +249,8 @@ 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 #fmt["encoding %s",
- istr::to_estr(ast_util::path_name_i(path))];
+ log #ifmt["encoding %s",
+ ast_util::path_name_i(path)];
let name_lit: ast::lit =
nospan(ast::lit_str(ast_util::path_name_i(path), ast::sk_rc));
View
2  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 #fmt["unknown TypeKind %d", kind as int]; fail; }
+ _ { log_err #ifmt["unknown TypeKind %d", kind as int]; fail; }
}
}
View
34 src/comp/metadata/creader.rs
@@ -100,13 +100,13 @@ 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 #fmt["matching %u metadata requirements against %u items",
+ log #ifmt["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 #fmt["missing %s",
- istr::to_estr(pprust::meta_item_to_str(*needed))];
+ log #ifmt["missing %s",
+ pprust::meta_item_to_str(*needed)];
ret false;
}
}
@@ -170,27 +170,27 @@ 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 #fmt["searching %s", istr::to_estr(library_search_path)];
+ log #ifmt["searching %s", library_search_path];
for path: istr in fs::list_dir(library_search_path) {
- log #fmt["searching %s", istr::to_estr(path)];
+ log #ifmt["searching %s", path];
let f: istr = fs::basename(path);
if !(istr::starts_with(f, prefix) && istr::ends_with(f, suffix))
{
- log #fmt["skipping %s, doesn't look like %s*%s",
- istr::to_estr(path),
- istr::to_estr(prefix),
- istr::to_estr(suffix)];
+ log #ifmt["skipping %s, doesn't look like %s*%s",
+ path,
+ prefix,
+ suffix];
cont;
}
alt get_metadata_section(path) {
option::some(cvec) {
if !metadata_matches(cvec, metas) {
- log #fmt["skipping %s, metadata doesn't match",
- istr::to_estr(path)];
+ log #ifmt["skipping %s, metadata doesn't match",
+ path];
cont;
}
- log #fmt["found %s with matching metadata",
- istr::to_estr(path)];
+ log #ifmt["found %s with matching metadata",
+ path];
ret some({ident: path, data: cvec});
}
_ { }
@@ -230,9 +230,9 @@ fn load_library_crate(sess: &session::session, span: span, ident: &ast::ident,
alt find_library_crate(sess, ident, metas, library_search_paths) {
some(t) { ret t; }
none. {
- sess.span_fatal(span, istr::from_estr(
- #fmt["can't find crate for '%s'",
- istr::to_estr(ident)]));
+ sess.span_fatal(span,
+ #ifmt["can't find crate for '%s'",
+ ident]);
}
}
}
@@ -275,7 +275,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 #fmt["resolving dep %s", istr::to_estr(cname)];
+ log #ifmt["resolving dep %s", cname];
if e.crate_cache.contains_key(cname) {
log "already have it";
// We've already seen this crate
View
21 src/comp/metadata/decoder.rs
@@ -349,9 +349,8 @@ 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(
- istr::from_estr(
- #fmt["%s\n",
- istr::to_estr(pprust::meta_item_to_str(*mi))]));
+ #ifmt["%s\n",
+ pprust::meta_item_to_str(*mi)]);
}
}
@@ -360,9 +359,8 @@ fn list_crate_attributes(md: &ebml::doc, out: io::writer) {
for attr: ast::attribute in get_attributes(md) {
out.write_str(
- istr::from_estr(
- #fmt["%s\n",
- istr::to_estr(pprust::attribute_to_str(attr))]));
+ #ifmt["%s\n",
+ pprust::attribute_to_str(attr)]);
}
out.write_str(~"\n\n");
@@ -392,8 +390,8 @@ fn list_crate_deps(data: @[u8], out: io::writer) {
for dep: crate_dep in get_crate_deps(data) {
out.write_str(
- istr::from_estr(#fmt["%d %s\n", dep.cnum,
- istr::to_estr(dep.ident)]));
+ #ifmt["%d %s\n", dep.cnum,
+ dep.ident]);
}
out.write_str(~"\n");
@@ -414,10 +412,9 @@ 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(
- istr::from_estr(
- #fmt["%s (%s)\n",
- istr::to_estr(data.path),
- istr::to_estr(describe_def(items, did))]));
+ #ifmt["%s (%s)\n",
+ data.path,
+ describe_def(items, did)]);
}
}
out.write_str(~"\n");
View
2  src/comp/metadata/encoder.rs
@@ -178,7 +178,7 @@ fn encode_inlineness(ebml_w: &ebml::writer, c: u8) {
}
fn def_to_str(did: &def_id) -> istr {
- ret istr::from_estr(#fmt["%d:%d", did.crate, did.node]);
+ ret #ifmt["%d:%d", did.crate, did.node];
}
fn encode_type_param_kinds(ebml_w: &ebml::writer, tps: &[ty_param]) {
View
12 src/comp/middle/alias.rs
@@ -257,10 +257,10 @@ fn check_call(cx: &ctx, f: &@ast::expr, args: &[@ast::expr], sc: &scope) ->
alt f.node {
ast::expr_path(_) {
if def_is_local(cx.tcx.def_map.get(f.id), true) {
- cx.tcx.sess.span_err(f.span, istr::from_estr(
- #fmt["function may alias with \
+ cx.tcx.sess.span_err(f.span,
+ #ifmt["function may alias with \
argument %u, which is not immutably rooted",
- unsafe_t_offsets[0]]));
+ unsafe_t_offsets[0]]);
}
}
_ { }
@@ -275,10 +275,10 @@ fn check_call(cx: &ctx, f: &@ast::expr, args: &[@ast::expr], sc: &scope) ->
let mut_alias = arg_t.mode == ty::mo_alias(true);
if i != offset &&
ty_can_unsafely_include(cx, unsafe, arg_t.ty, mut_alias) {
- cx.tcx.sess.span_err(args[i].span, istr::from_estr(
- #fmt["argument %u may alias with \
+ cx.tcx.sess.span_err(args[i].span,
+ #ifmt["argument %u may alias with \
argument %u, which is not immutably rooted",
- i, offset]));
+ i, offset]);
}
i += 1u;
}
View
26 src/comp/middle/kind.rs
@@ -96,11 +96,11 @@ fn lower_kind(a: kind, b: kind) -> kind {
if kind_lteq(a, b) { a } else { b }
}
-fn kind_to_str(k: kind) -> str {
+fn kind_to_str(k: kind) -> istr {
alt k {
- ast::kind_pinned. { "pinned" }
- ast::kind_unique. { "unique" }
- ast::kind_shared. { "shared" }
+ ast::kind_pinned. { ~"pinned" }
+ ast::kind_unique. { ~"unique" }
+ ast::kind_shared. { ~"shared" }
}
}
@@ -114,17 +114,17 @@ 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 #fmt["for %s: want %s type, got %s type %s", istr::to_estr(descr),
+ log #ifmt["for %s: want %s type, got %s type %s", descr,
kind_to_str(k_need), kind_to_str(tk.kind),
- istr::to_estr(util::ppaux::ty_to_str(tcx, tk.ty))];
+ util::ppaux::ty_to_str(tcx, tk.ty)];
if !kind_lteq(k_need, tk.kind) {
let s =
- #fmt["mismatched kinds for %s: needed %s type, got %s type %s",
- istr::to_estr(descr), kind_to_str(k_need),
+ #ifmt["mismatched kinds for %s: needed %s type, got %s type %s",
+ descr, kind_to_str(k_need),
kind_to_str(tk.kind),
- istr::to_estr(util::ppaux::ty_to_str(tcx, tk.ty))];
- tcx.sess.span_err(e.span, istr::from_estr(s));
+ util::ppaux::ty_to_str(tcx, tk.ty)];
+ tcx.sess.span_err(e.span, s);
}
}
@@ -169,11 +169,11 @@ fn check_expr(tcx: &ty::ctxt, e: &@ast::expr) {
let k = ty::type_kind(tcx, t);
if !kind_lteq(k_need, k) {
let s =
- #fmt["mismatched kinds for typaram %d: \
+ #ifmt["mismatched kinds for typaram %d: \
needed %s type, got %s type %s",
i, kind_to_str(k_need), kind_to_str(k),
- istr::to_estr(util::ppaux::ty_to_str(tcx, t))];
- tcx.sess.span_err(e.span, istr::from_estr(s));
+ util::ppaux::ty_to_str(tcx, t)];
+ tcx.sess.span_err(e.span, s);
}
i += 1;
}
View
6 src/comp/middle/resolve.rs
@@ -575,8 +575,7 @@ fn unresolved_fatal(e: &env, sp: &span, id: &ident, kind: &istr) -> ! {
}
fn mk_unresolved_msg(id: &ident, kind: &istr) -> istr {
- ret istr::from_estr(
- #fmt["unresolved %s: %s", istr::to_estr(kind), istr::to_estr(id)]);
+ ret #ifmt["unresolved %s: %s", kind, id];
}
// Lookup helpers
@@ -1011,8 +1010,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, istr::from_estr(#fmt["'%s' is imported here",
- istr::to_estr(id)]));
+ sp, #ifmt["'%s' is imported here", id]);
}
e.sess.span_fatal(sp,
~"'" + id
View
46 src/comp/middle/trans.rs
@@ -1893,8 +1893,8 @@ fn lazily_emit_tydesc_glue(cx: &@block_ctxt, field: int,
alt { ti.take_glue } {
some(_) { }
none. {
- log #fmt["+++ lazily_emit_tydesc_glue TAKE %s",
- istr::to_estr(ty_to_str(bcx_tcx(cx), ti.ty))];
+ log #ifmt["+++ lazily_emit_tydesc_glue TAKE %s",
+ ty_to_str(bcx_tcx(cx), ti.ty)];
let lcx = cx.fcx.lcx;
let glue_fn =
declare_generic_glue(lcx, ti.ty, T_glue_fn(*lcx.ccx),
@@ -1903,16 +1903,16 @@ 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 #fmt["--- lazily_emit_tydesc_glue TAKE %s",
- istr::to_estr(ty_to_str(bcx_tcx(cx), ti.ty))];
+ log #ifmt["--- lazily_emit_tydesc_glue TAKE %s",
+ ty_to_str(bcx_tcx(cx), ti.ty)];
}
}
} else if field == abi::tydesc_field_drop_glue {
alt { ti.drop_glue } {
some(_) { }
none. {
- log #fmt["+++ lazily_emit_tydesc_glue DROP %s",
- istr::to_estr(ty_to_str(bcx_tcx(cx), ti.ty))];
+ log #ifmt["+++ lazily_emit_tydesc_glue DROP %s",
+ ty_to_str(bcx_tcx(cx), ti.ty)];
let lcx = cx.fcx.lcx;
let glue_fn =
declare_generic_glue(lcx, ti.ty, T_glue_fn(*lcx.ccx),
@@ -1921,16 +1921,16 @@ 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 #fmt["--- lazily_emit_tydesc_glue DROP %s",
- istr::to_estr(ty_to_str(bcx_tcx(cx), ti.ty))];
+ log #ifmt["--- lazily_emit_tydesc_glue DROP %s",
+ ty_to_str(bcx_tcx(cx), ti.ty)];
}
}
} else if field == abi::tydesc_field_free_glue {
alt { ti.free_glue } {
some(_) { }
none. {
- log #fmt["+++ lazily_emit_tydesc_glue FREE %s",
- istr::to_estr(ty_to_str(bcx_tcx(cx), ti.ty))];
+ log #ifmt["+++ lazily_emit_tydesc_glue FREE %s",
+ ty_to_str(bcx_tcx(cx), ti.ty)];
let lcx = cx.fcx.lcx;
let glue_fn =
declare_generic_glue(lcx, ti.ty, T_glue_fn(*lcx.ccx),
@@ -1939,19 +1939,19 @@ 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 #fmt["--- lazily_emit_tydesc_glue FREE %s",
- istr::to_estr(ty_to_str(bcx_tcx(cx), ti.ty))];
+ log #ifmt["--- lazily_emit_tydesc_glue FREE %s",
+ ty_to_str(bcx_tcx(cx), ti.ty)];
}
}
} else if field == abi::tydesc_field_cmp_glue {
alt { ti.cmp_glue } {
some(_) { }
none. {
- log #fmt["+++ lazily_emit_tydesc_glue CMP %s",
- istr::to_estr(ty_to_str(bcx_tcx(cx), ti.ty))];
+ log #ifmt["+++ 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 #fmt["--- lazily_emit_tydesc_glue CMP %s",
- istr::to_estr(ty_to_str(bcx_tcx(cx), ti.ty))];
+ log #ifmt["--- lazily_emit_tydesc_glue CMP %s",
+ ty_to_str(bcx_tcx(cx), ti.ty)];
}
}
} else if field == abi::tydesc_field_copy_glue {
@@ -6323,16 +6323,16 @@ 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 #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];
+ 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];
for timing: {ident: istr, time: int} in *ccx.stats.fn_times {
- log_err #fmt["time: %s took %d ms",
- istr::to_estr(timing.ident), timing.time];
+ log_err #ifmt["time: %s took %d ms",
+ timing.ident, timing.time];
}
}
ret llmod;
View
6 src/comp/middle/tstate/states.rs
@@ -170,10 +170,10 @@ fn find_pre_post_state_call(fcx: &fn_ctxt, pres: &prestate, a: &@expr,
let changed = find_pre_post_state_expr(fcx, pres, a);
// FIXME: This could be a typestate constraint
if vec::len(bs) != vec::len(ops) {
- fcx.ccx.tcx.sess.span_bug(a.span, istr::from_estr(
- #fmt["mismatched arg lengths: \
+ fcx.ccx.tcx.sess.span_bug(a.span,
+ #ifmt["mismatched arg lengths: \
%u exprs vs. %u ops",
- vec::len(bs), vec::len(ops)]));
+ vec::len(bs), vec::len(ops)]);
}
ret find_pre_post_state_exprs(fcx, expr_poststate(fcx.ccx, a), id, ops,
bs, cf) || changed;
View
10 src/comp/middle/ty.rs
@@ -2440,20 +2440,20 @@ mod unify {
fn dump_var_bindings(tcx: ty_ctxt, vb: @var_bindings) {
let i = 0u;
while i < vec::len::<ufind::node>(vb.sets.nodes) {
- let sets = "";
+ let sets = ~"";
let j = 0u;
while j < vec::len::<option::t<uint>>(vb.sets.nodes) {
- if ufind::find(vb.sets, j) == i { sets += #fmt[" %u", j]; }
+ if ufind::find(vb.sets, j) == i { sets += #ifmt[" %u", j]; }
j += 1u;
}
let typespec;
alt smallintmap::find::<t>(vb.types, i) {
- none. { typespec = ""; }
+ none. { typespec = ~""; }
some(typ) {
- typespec = " =" + istr::to_estr(ty_to_str(tcx, typ));
+ typespec = ~" =" + ty_to_str(tcx, typ);
}
}
- log_err #fmt["set %u:%s%s", i, typespec, sets];
+ log_err #ifmt["set %u:%s%s", i, typespec, sets];
i += 1u;
}
}
View
85 src/comp/middle/typeck.rs
@@ -1368,16 +1368,16 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast_util::pat_id_map, pat: &@ast::pat,
let arg_len = vec::len::<ty::t>(arg_types);
if arg_len != subpats_len {
// TODO: note definition of tag variant
- // TODO (issue #448): Wrap a #fmt string over multiple
+ // TODO (issue #448): Wrap a #ifmt string over multiple
// lines...
let s =
- #fmt["this pattern has %u field%s, but the \
+ #ifmt["this pattern has %u field%s, but the \
corresponding variant has %u field%s",
subpats_len,
- if subpats_len == 1u { "" } else { "s" },
- arg_len, if arg_len == 1u { "" } else { "s" }];
+ if subpats_len == 1u { ~"" } else { ~"s" },
+ arg_len, if arg_len == 1u { ~"" } else { ~"s" }];
fcx.ccx.tcx.sess.span_fatal(
- pat.span, istr::from_estr(s));
+ pat.span, s);
}
// TODO: vec::iter2
@@ -1390,14 +1390,14 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast_util::pat_id_map, pat: &@ast::pat,
} else if subpats_len > 0u {
// TODO: note definition of tag variant
fcx.ccx.tcx.sess.span_fatal(
- pat.span, istr::from_estr(
- #fmt["this pattern has %u field%s, \
+ pat.span,
+ #ifmt["this pattern has %u field%s, \
but the corresponding \
variant has no fields",
subpats_len,
if subpats_len == 1u {
- ""
- } else { "s" }]));
+ ~""
+ } else { ~"s" }]);
}
write::ty_fixup(fcx, pat.id, path_tpot);
}
@@ -1405,9 +1405,9 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast_util::pat_id_map, pat: &@ast::pat,
// FIXME: Switch expected and actual in this message? I
// can never tell.
fcx.ccx.tcx.sess.span_fatal(
- pat.span, istr::from_estr(
- #fmt["mismatched types: expected %s, found tag",
- istr::to_estr(ty_to_str(fcx.ccx.tcx, expected))]));
+ pat.span,
+ #ifmt["mismatched types: expected %s, found tag",
+ ty_to_str(fcx.ccx.tcx, expected)]);
}
}
write::ty_fixup(fcx, pat.id, path_tpot);
@@ -1418,20 +1418,20 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast_util::pat_id_map, pat: &@ast::pat,
ty::ty_rec(fields) { ex_fields = fields; }
_ {
fcx.ccx.tcx.sess.span_fatal(
- pat.span, istr::from_estr(
- #fmt["mismatched types: expected %s, found record",
- istr::to_estr(ty_to_str(fcx.ccx.tcx, expected))]));
+ pat.span,
+ #ifmt["mismatched types: expected %s, found record",
+ ty_to_str(fcx.ccx.tcx, expected)]);
}
}
let f_count = vec::len(fields);
let ex_f_count = vec::len(ex_fields);
if ex_f_count < f_count || !etc && ex_f_count > f_count {
fcx.ccx.tcx.sess.span_fatal(
- pat.span, istr::from_estr(
- #fmt["mismatched types: expected a record \
+ pat.span,
+ #ifmt["mismatched types: expected a record \
with %u fields, found one with %u \
fields",
- ex_f_count, f_count]));
+ ex_f_count, f_count]);
}
fn matches(name: &istr, f: &ty::field) -> bool {
ret istr::eq(name, f.ident);
@@ -1440,10 +1440,10 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast_util::pat_id_map, pat: &@ast::pat,
alt vec::find(bind matches(f.ident, _), ex_fields) {
some(field) { check_pat(fcx, map, f.pat, field.mt.ty); }
none. {
- fcx.ccx.tcx.sess.span_fatal(pat.span, istr::from_estr(
- #fmt["mismatched types: did not \
+ fcx.ccx.tcx.sess.span_fatal(pat.span,
+ #ifmt["mismatched types: did not \
expect a record with a field %s",
- istr::to_estr(f.ident)]));
+ f.ident]);
}
}
}
@@ -1455,19 +1455,19 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast_util::pat_id_map, pat: &@ast::pat,
ty::ty_tup(elts) { ex_elts = elts; }
_ {
fcx.ccx.tcx.sess.span_fatal(
- pat.span, istr::from_estr(
- #fmt["mismatched types: expected %s, found tuple",
- istr::to_estr(ty_to_str(fcx.ccx.tcx, expected))]));
+ pat.span,
+ #ifmt["mismatched types: expected %s, found tuple",
+ ty_to_str(fcx.ccx.tcx, expected)]);
}
}
let e_count = vec::len(elts);
if e_count != vec::len(ex_elts) {
fcx.ccx.tcx.sess.span_fatal(
- pat.span, istr::from_estr(
- #fmt["mismatched types: expected a tuple \
+ pat.span,
+ #ifmt["mismatched types: expected a tuple \
with %u fields, found one with %u \
fields",
- vec::len(ex_elts), e_count]));
+ vec::len(ex_elts), e_count]);
}
let i = 0u;
for elt in elts { check_pat(fcx, map, elt, ex_elts[i]); i += 1u; }
@@ -1595,16 +1595,17 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier,
let expected_arg_count = vec::len(arg_tys);
let supplied_arg_count = vec::len(args);
if expected_arg_count != supplied_arg_count {
- fcx.ccx.tcx.sess.span_err(sp, istr::from_estr(
- #fmt["this function takes %u \
+ fcx.ccx.tcx.sess.span_err(
+ sp,
+ #ifmt["this function takes %u \
parameter%s but %u parameter%s supplied",
- expected_arg_count,
- if expected_arg_count == 1u {
- ""
- } else { "s" }, supplied_arg_count,
- if supplied_arg_count == 1u {
- " was"
- } else { "s were" }]));
+ expected_arg_count,
+ if expected_arg_count == 1u {
+ ~""
+ } else { ~"s" }, supplied_arg_count,
+ if supplied_arg_count == 1u {
+ ~" was"
+ } else { ~"s were" }]);
// HACK: extend the arguments list with dummy arguments to
// check against
let dummy = {mode: ty::mo_val, ty: ty::mk_nil(fcx.ccx.tcx)};
@@ -1819,10 +1820,10 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier,
if !type_is_integral(fcx, oper.span, oper_t) &&
structure_of(fcx, oper.span, oper_t) != ty::ty_bool {
tcx.sess.span_err(
- expr.span, istr::from_estr(
- #fmt["mismatched types: expected bool \
+ expr.span,
+ #ifmt["mismatched types: expected bool \
or integer but found %s",
- istr::to_estr(ty_to_str(tcx, oper_t))]));
+ ty_to_str(tcx, oper_t)]);
}
}
ast::neg. {
@@ -2266,9 +2267,9 @@ 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 =
- #fmt["attempted field access on type %s",
- istr::to_estr(ty_to_str(tcx, t_err))];
- tcx.sess.span_fatal(expr.span, istr::from_estr(msg));
+ #ifmt["attempted field access on type %s",
+ ty_to_str(tcx, t_err)];
+ tcx.sess.span_fatal(expr.span, msg);
}
}
}
View
23 src/comp/syntax/codemap.rs
@@ -80,13 +80,13 @@ fn span_to_str(sp: &span, cm: &codemap) -> istr {
while true {
let lo = lookup_char_pos(cm, cur.lo);
let hi = lookup_char_pos(cm, cur.hi);
- res += istr::from_estr(
- #fmt["%s:%u:%u: %u:%u",
+ res +=
+ #ifmt["%s:%u:%u: %u:%u",
if some(lo.filename) == prev_file {
- "-"
+ ~"-"
} else {
- istr::to_estr(lo.filename)
- }, lo.line, lo.col, hi.line, hi.col]);
+ lo.filename
+ }, lo.line, lo.col, hi.line, hi.col];
alt cur.expanded_from {
os_none. { break; }
os_some(new_sp) {
@@ -115,10 +115,9 @@ fn emit_diagnostic(sp: &option::t<span>, msg: &istr, kind: &istr, color: u8,
if term::color_supported() {
term::fg(io::stdout().get_buf_writer(), color);
}
- io::stdout().write_str(istr::from_estr(#fmt["%s:", istr::to_estr(kind)]));
+ io::stdout().write_str(#ifmt[~"%s:", kind]);
if term::color_supported() { term::reset(io::stdout().get_buf_writer()); }
- io::stdout().write_str(istr::from_estr(#fmt[" %s\n",
- istr::to_estr(msg)]));
+ io::stdout().write_str(#ifmt[~" %s\n", msg]);
maybe_highlight_lines(sp, cm, maybe_lines);
}
@@ -148,17 +147,15 @@ fn maybe_highlight_lines(sp: &option::t<span>, cm: &codemap,
// Print the offending lines
for line: uint in display_lines {
io::stdout().write_str(
- istr::from_estr(#fmt["%s:%u ",
- istr::to_estr(fm.name), line + 1u]));
+ #ifmt[~"%s:%u ", fm.name, line + 1u]);
let s = get_line(fm, line as int, file);
if !istr::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 = #fmt["%s:%u ",
- istr::to_estr(fm.name), last_line + 1u];
- let indent = str::char_len(s);
+ let s = #ifmt[~"%s:%u ", fm.name, last_line + 1u];
+ let indent = istr::char_len(s);
let out = ~"";
while indent > 0u { out += ~" "; indent -= 1u; }
out += ~"...\n";
View
6 src/comp/syntax/ext/expand.rs
@@ -26,9 +26,9 @@ fn expand_expr(exts: &hashmap<istr, syntax_extension>, cx: &ext_ctxt,
let extname = pth.node.idents[0];
alt exts.find(extname) {
none. {
- cx.span_fatal(pth.span, istr::from_estr(
- #fmt["macro undefined: '%s'",
- istr::to_estr(extname)]))
+ cx.span_fatal(pth.span,
+ #ifmt["macro undefined: '%s'",
+ extname])
}
some(normal(ext)) {
let expanded = ext(cx, pth.span, args, body);
View
25 src/comp/syntax/ext/fmt.rs
@@ -1,7 +1,7 @@
/*
- * The compiler code necessary to support the #fmt extension. Eventually this
+ * The compiler code necessary to support the #ifmt extension. Eventually this
* should all get sucked into either the standard library extfmt module or the
* compiler syntax extension plugin interface.
*/
@@ -22,15 +22,16 @@ fn expand_syntax_ext(cx: &ext_ctxt, sp: span, arg: @ast::expr,
alt arg.node {
ast::expr_vec(elts, _) { elts }
_ {
- cx.span_fatal(sp, ~"#fmt requires arguments of the form `[...]`.")
+ cx.span_fatal(
+ sp, ~"#ifmt requires arguments of the form `[...]`.")
}
};
if vec::len::<@ast::expr>(args) == 0u {
- cx.span_fatal(sp, ~"#fmt requires a format string");
+ cx.span_fatal(sp, ~"#ifmt requires a format string");
}
let fmt =
expr_to_str(cx, args[0],
- ~"first argument to #fmt must be a "
+ ~"first argument to #ifmt must be a "
+ ~"string literal.");
let fmtspan = args[0].span;
log "Format string:";
@@ -151,7 +152,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
let count_is_args = [count_lit];
ret make_call(cx, sp, count_is_path, count_is_args);
}
- _ { cx.span_unimpl(sp, ~"unimplemented #fmt conversion"); }
+ _ { cx.span_unimpl(sp, ~"unimplemented #ifmt conversion"); }
}
}
fn make_ty(cx: &ext_ctxt, sp: span, t: &ty) -> @ast::expr {
@@ -205,7 +206,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
_ { ret false; }
}
}
- let unsupported = ~"conversion not supported in #fmt string";
+ let unsupported = ~"conversion not supported in #ifmt string";
alt cnv.param {
option::none. { }
_ { cx.span_unimpl(sp, unsupported); }
@@ -217,14 +218,14 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
if !is_signed_type(cnv) {
cx.span_fatal(sp,
~"+ flag only valid in " +
- ~"signed #fmt conversion");
+ ~"signed #ifmt conversion");
}
}
flag_space_for_sign. {
if !is_signed_type(cnv) {
cx.span_fatal(sp,
~"space flag only valid in " +
- ~"signed #fmt conversions");
+ ~"signed #ifmt conversions");
}
}
flag_left_zero_pad. { }
@@ -330,7 +331,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
n += 1u;
if n >= nargs {
cx.span_fatal(sp,
- ~"not enough arguments to #fmt " +
+ ~"not enough arguments to #ifmt " +
~"for the given format string");
}
log "Building conversion:";
@@ -345,9 +346,9 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
if expected_nargs < nargs {
cx.span_fatal(
- sp, istr::from_estr(
- #fmt["too many arguments to #fmt. found %u, expected %u",
- nargs, expected_nargs]));
+ sp,
+ #ifmt["too many arguments to #fmt. found %u, expected %u",
+ nargs, expected_nargs]);
}
ret tmp_expr;
}
View
25 src/comp/syntax/ext/ifmt.rs
@@ -1,7 +1,7 @@
/*
- * The compiler code necessary to support the #fmt extension. Eventually this
+ * The compiler code necessary to support the #ifmt extension. Eventually this
* should all get sucked into either the standard library extfmt module or the
* compiler syntax extension plugin interface.
*/
@@ -22,15 +22,16 @@ fn expand_syntax_ext(cx: &ext_ctxt, sp: span, arg: @ast::expr,
alt arg.node {
ast::expr_vec(elts, _) { elts }
_ {
- cx.span_fatal(sp, ~"#fmt requires arguments of the form `[...]`.")
+ cx.span_fatal(
+ sp, ~"#ifmt requires arguments of the form `[...]`.")
}
};
if vec::len::<@ast::expr>(args) == 0u {
- cx.span_fatal(sp, ~"#fmt requires a format string");
+ cx.span_fatal(sp, ~"#ifmt requires a format string");
}
let fmt =
expr_to_str(cx, args[0],
- ~"first argument to #fmt must be a "
+ ~"first argument to #ifmt must be a "
+ ~"string literal.");
let fmtspan = args[0].span;
log "Format string:";
@@ -151,7 +152,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
let count_is_args = [count_lit];
ret make_call(cx, sp, count_is_path, count_is_args);
}
- _ { cx.span_unimpl(sp, ~"unimplemented #fmt conversion"); }
+ _ { cx.span_unimpl(sp, ~"unimplemented #ifmt conversion"); }
}
}
fn make_ty(cx: &ext_ctxt, sp: span, t: &ty) -> @ast::expr {
@@ -205,7 +206,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
_ { ret false; }
}
}
- let unsupported = ~"conversion not supported in #fmt string";
+ let unsupported = ~"conversion not supported in #ifmt string";
alt cnv.param {
option::none. { }
_ { cx.span_unimpl(sp, unsupported); }
@@ -217,14 +218,14 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
if !is_signed_type(cnv) {
cx.span_fatal(sp,
~"+ flag only valid in " +
- ~"signed #fmt conversion");
+ ~"signed #ifmt conversion");
}
}
flag_space_for_sign. {
if !is_signed_type(cnv) {
cx.span_fatal(sp,
~"space flag only valid in " +
- ~"signed #fmt conversions");
+ ~"signed #ifmt conversions");
}
}
flag_left_zero_pad. { }
@@ -330,7 +331,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
n += 1u;
if n >= nargs {
cx.span_fatal(sp,
- ~"not enough arguments to #fmt " +
+ ~"not enough arguments to #ifmt " +
~"for the given format string");
}
log "Building conversion:";
@@ -345,9 +346,9 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
if expected_nargs < nargs {
cx.span_fatal(
- sp, istr::from_estr(
- #fmt["too many arguments to #fmt. found %u, expected %u",
- nargs, expected_nargs]));
+ sp,
+ #ifmt["too many arguments to #fmt. found %u, expected %u",
+ nargs, expected_nargs]);
}
ret tmp_expr;
}
View
10 src/comp/syntax/ext/simplext.rs
@@ -309,13 +309,13 @@ fn transcribe_exprs(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint],
let len = vec::len(*ms);
if old_len != len {
let msg =
- #fmt["'%s' occurs %u times, but ",
- istr::to_estr(fv), len] +
- #fmt["'%s' occurs %u times",
- istr::to_estr(old_name),
+ #ifmt["'%s' occurs %u times, but ",
+ fv, len] +
+ #ifmt["'%s' occurs %u times",
+ old_name,
old_len];
cx.span_fatal(
- repeat_me.span, istr::from_estr(msg));
+ repeat_me.span, msg);
}
}
}
View
15 src/comp/syntax/parse/lexer.rs
@@ -326,8 +326,7 @@ fn scan_numeric_escape(rdr: &reader, n_hex_digits: uint) -> char {
rdr.bump();
if !is_hex_digit(n) {
rdr.err(
- istr::from_estr(
- #fmt["illegal numeric character escape: %d", n as int]));
+ #ifmt["illegal numeric character escape: %d", n as int]);
fail;
}
accum_int *= 16;
@@ -471,8 +470,8 @@ fn next_token_inner(rdr: &reader) -> token::token {
'U' { c2 = scan_numeric_escape(rdr, 8u); }
c2 {
rdr.err(
- istr::from_estr(#fmt["unknown character escape: %d",
- c2 as int]));
+ #ifmt["unknown character escape: %d",
+ c2 as int]);
fail;
}
}
@@ -512,8 +511,8 @@ fn next_token_inner(rdr: &reader) -> token::token {
}
c2 {
rdr.err(
- istr::from_estr(#fmt["unknown string escape: %d",
- c2 as int]));
+ #ifmt["unknown string escape: %d",
+ c2 as int]);
fail;
}
}
@@ -553,7 +552,7 @@ fn next_token_inner(rdr: &reader) -> token::token {
'%' { ret binop(rdr, token::PERCENT); }
c {
rdr.err(
- istr::from_estr(#fmt["unkown start of token: %d", c as int]));
+ #ifmt["unkown start of token: %d", c as int]);
fail;
}
}
@@ -654,7 +653,7 @@ fn read_block_comment(rdr: &reader, code_to_the_left: bool) -> cmnt {
let curr_line = ~"/*";
let level: int = 1;
while level > 0 {
- log #fmt["=== block comment level %d", level];
+ log #ifmt["=== 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);
View
42 src/comp/syntax/print/pp.rs
@@ -67,8 +67,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 istr::from_estr(
- #fmt["STR(%s,%d)", istr::to_estr(s), len]);
+ ret #ifmt[~"STR(%s,%d)", s, len];
}
BREAK(_) { ret ~"BREAK"; }
BEGIN(_) { ret ~"BEGIN"; }
@@ -87,8 +86,7 @@ fn buf_str(toks: &[mutable token], szs: &[mutable int], left: uint,
while i != right && L != 0u {
L -= 1u;
if i != left { s += ~", "; }
- s += istr::from_estr(
- #fmt["%d=%s", szs[i], istr::to_estr(tok_str(toks[i]))]);
+ s += #ifmt[~"%d=%s", szs[i], tok_str(toks[i])];
i += 1u;
i %= n;
}
@@ -107,7 +105,7 @@ fn mk_printer(out: io::writer, linewidth: uint) -> printer {
// fall behind.
let n: uint = 3u * linewidth;
- log #fmt["mk_printer %u", linewidth];
+ log #ifmt[~"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);
@@ -247,7 +245,7 @@ obj printer(out: io::writer,
fn replace_last_token(t: token) { token[right] = t; }
fn pretty_print(t: token) {
- log #fmt["pp [%u,%u]", left, right];
+ log #ifmt[~"pp [%u,%u]", left, right];
alt t {
EOF. {
if !scan_stack_empty {
@@ -263,17 +261,17 @@ obj printer(out: io::writer,
left = 0u;
right = 0u;
} else { self.advance_right(); }
- log #fmt["pp BEGIN/buffer [%u,%u]", left, right];
+ log #ifmt[~"pp BEGIN/buffer [%u,%u]", left, right];
token[right] = t;
size[right] = -right_total;
self.scan_push(right);
}
END. {
if scan_stack_empty {
- log #fmt["pp END/print [%u,%u]", left, right];
+ log #ifmt[~"pp END/print [%u,%u]", left, right];
self.print(t, 0);
} else {
- log #fmt["pp END/buffer [%u,%u]", left, right];
+ log #ifmt[~"pp END/buffer [%u,%u]", left, right];
self.advance_right();
token[right] = t;
size[right] = -1;
@@ -287,7 +285,7 @@ obj printer(out: io::writer,
left = 0u;
right = 0u;
} else { self.advance_right(); }
- log #fmt["pp BREAK/buffer [%u,%u]", left, right];
+ log #ifmt[~"pp BREAK/buffer [%u,%u]", left, right];
self.check_stack(0);
self.scan_push(right);
token[right] = t;
@@ -296,10 +294,10 @@ obj printer(out: io::writer,
}
STRING(s, len) {
if scan_stack_empty {
- log #fmt["pp STRING/print [%u,%u]", left, right];
+ log #ifmt[~"pp STRING/print [%u,%u]", left, right];
self.print(t, len);
} else {
- log #fmt["pp STRING/buffer [%u,%u]", left, right];
+ log #ifmt[~"pp STRING/buffer [%u,%u]", left, right];
self.advance_right();
token[right] = t;
size[right] = len;
@@ -310,14 +308,14 @@ obj printer(out: io::writer,
}
}
fn check_stream() {
- log #fmt["check_stream [%u, %u] with left_total=%d, right_total=%d",
+ log #ifmt[~"check_stream [%u, %u] with left_total=%d, right_total=%d",
left, right, left_total, right_total];
if right_total - left_total > space {
- log #fmt["scan window is %d, longer than space on line (%d)",
+ log #ifmt[~"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 #fmt["setting %u to infinity and popping", left];
+ log #ifmt["setting %u to infinity and popping", left];
size[self.scan_pop_bottom()] = size_infinity;
}
}
@@ -326,7 +324,7 @@ obj printer(out: io::writer,
}
}
fn scan_push(x: uint) {
- log #fmt["scan_push %u", x];
+ log #ifmt["scan_push %u", x];
if scan_stack_empty {
scan_stack_empty = false;
} else { top += 1u; top %= buf_len; assert (top != bottom); }
@@ -355,7 +353,7 @@ obj printer(out: io::writer,
assert (right != left);
}
fn advance_left(x: token, L: int) {
- log #fmt["advnce_left [%u,%u], sizeof(%u)=%d", left, right, left, L];
+ log #ifmt["advnce_left [%u,%u], sizeof(%u)=%d", left, right, left, L];
if L >= 0 {
self.print(x, L);
alt x {
@@ -394,13 +392,13 @@ obj printer(out: io::writer,
}
}
fn print_newline(amount: int) {
- log #fmt["NEWLINE %d", amount];
+ log #ifmt["NEWLINE %d", amount];
out.write_str(~"\n");
pending_indentation = 0;
self.indent(amount);
}
fn indent(amount: int) {
- log #fmt["INDENT %d", amount];
+ log #ifmt["INDENT %d", amount];
pending_indentation += amount;
}
fn top() -> print_stack_elt {
@@ -417,15 +415,15 @@ obj printer(out: io::writer,
out.write_str(s);
}
fn print(x: token, L: int) {
- log #fmt["print %s %d (remaining line space=%d)",
- istr::to_estr(tok_str(x)), L,
+ log #ifmt["print %s %d (remaining line space=%d)",
+ tok_str(x), L,
space];
log buf_str(token, size, left, right, 6u);
alt x {
BEGIN(b) {
if L > space {
let col = margin - space + b.offset;
- log #fmt["print BEGIN -> push broken block at col %d", col];
+ log #ifmt["print BEGIN -> push broken block at col %d", col];
print_stack += [{offset: col, pbreak: broken(b.breaks)}];
} else {
log "print BEGIN -> push fitting block";
View
2  src/comp/syntax/untyped_ast.rs
@@ -362,7 +362,7 @@ fn dummy() {
alt *elts.(idx) {
leaf_destructure(x) { x }
_ {
- ctx.ff(sp, #fmt["expected %s in position %u",
+ ctx.ff(sp, #ifmt["expected %s in position %u",
#ident_to_str[leaf_destructure], idx])
}
}],
View
14 src/fuzzer/fuzzer.rs
@@ -195,7 +195,7 @@ fn check_whole_compiler(code: &str) {
~"/Users/jruderman/code/rust/build/stage1/rustc",
[~"-c", istr::from_estr(filename)]);
- //log_err #fmt("Status: %d", p.status);
+ //log_err #ifmt("Status: %d", p.status);
//log_err "Output: " + p.out;
if p.err != "" {
if contains(p.err, "argument of incompatible type") {
@@ -265,7 +265,7 @@ fn content_is_dangerous_to_modify(code: &str) -> 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 #fmt, for example
+ "#", // strange representation of the arguments to #ifmt, 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
@@ -327,9 +327,9 @@ fn check_roundtrip_convergence(code: &str, maxIters: uint) {
}
if old == new {
- log_err #fmt["Converged after %u iterations", i];
+ log_err #ifmt["Converged after %u iterations", i];
} else {
- log_err #fmt["Did not converge after %u iterations!", i];
+ log_err #ifmt["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",
@@ -340,12 +340,12 @@ fn check_roundtrip_convergence(code: &str, maxIters: uint) {
}
fn check_convergence(files: &[str]) {
- log_err #fmt["pp convergence tests: %u files", vec::len(files)];
+ log_err #ifmt["pp convergence tests: %u files", vec::len(files)];
for file in files {
if !file_is_confusing(file) {
let s = istr::to_estr(io::read_whole_file_str(istr::from_estr(file)));
if !content_is_confusing(s) {
- log_err #fmt["pp converge: %s", file];
+ log_err #ifmt["pp converge: %s", istr::from_estr(file)];
// Change from 7u to 2u when https://github.com/graydon/rust/issues/759 is fixed
check_roundtrip_convergence(s, 7u);
}
@@ -377,7 +377,7 @@ fn check_variants(files: &[str]) {
fn main(args: [str]) {
if vec::len(args) != 2u {
- log_err #fmt["usage: %s <testdir>", args[0]];
+ log_err #ifmt["usage: %s <testdir>", istr::from_estr(args[0])];
ret;
}
let files = [];
View
3  src/lib/net.rs
@@ -7,8 +7,7 @@ tag ip_addr { ipv4(u8, u8, u8, u8); }
fn format_addr(ip: ip_addr) -> istr {
alt ip {
ipv4(a, b, c, d) {
- istr::from_estr(
- #fmt["%u.%u.%u.%u", a as uint, b as uint, c as uint, d as uint])
+ #ifmt["%u.%u.%u.%u", a as uint, b as uint, c as uint, d as uint]
}
_ { fail "Unsupported address type"; }
}
View
2  src/lib/task.rs
@@ -81,7 +81,7 @@ fn join(task_port: (task_id, comm::port<task_notification>)) -> task_result {
exit(_id, res) {
if _id == id {
ret res
- } else { fail #fmt["join received id %d, expected %d", _id, id] }
+ } else { fail #ifmt["join received id %d, expected %d", _id, id] }
}
}
}
View
15 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(
- istr::from_estr(#fmt["\nrunning %u tests", st.total]));
+ #ifmt["\nrunning %u tests", st.total]);
}
te_wait(test) {
st.out.write_str(
- istr::from_estr(#fmt["test %s ... ", test.name]));
+ #ifmt["test %s ... ", istr::from_estr(test.name)]);
}
te_result(test, result) {
alt result {
@@ -167,19 +167,18 @@ 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(istr::from_estr(#fmt[" %s", testname]));
+ st.out.write_line(#ifmt[" %s", istr::from_estr(testname)]);
}
}
- st.out.write_str(istr::from_estr(#fmt["\nresult: "]));
+ st.out.write_str(#ifmt["\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(
- istr::from_estr(
- #fmt[". %u passed; %u failed; %u ignored\n\n", st.passed,
- st.failed, st.ignored]));
+ #ifmt[". %u passed; %u failed; %u ignored\n\n", st.passed,
+ st.failed, st.ignored]);
ret success;
@@ -226,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 #fmt["using %u test tasks", concurrency];
+ log #ifmt["using %u test tasks", concurrency];
let total = vec::len(filtered_tests);
let run_idx = 0u;
let wait_idx = 0u;
View
6 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 #fmt["stretch tree of depth %d\t check: %d", stretch_depth,
+ log #ifmt["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 #fmt["%d\t trees of depth %d\t check: %d", iterations * 2, depth,
+ log #ifmt["%d\t trees of depth %d\t check: %d", iterations * 2, depth,
chk];
depth += 2;
}
- log #fmt["long lived trees of depth %d\t check: %d", max_depth,
+ log #ifmt["long lived trees of depth %d\t check: %d", max_depth,
item_check(long_lived_tree)];
}
View
2  src/test/bench/shootout-fannkuchredux.rs
@@ -58,5 +58,5 @@ fn fannkuch(n: int) -> int {
fn main(args: [str]) {
let n = 7;
- log #fmt["Pfannkuchen(%d) = %d", n, fannkuch(n)];
+ log #ifmt["Pfannkuchen(%d) = %d", n, fannkuch(n)];
}
View
7 src/test/bench/shootout-pfib.rs
@@ -69,7 +69,7 @@ fn stress_task(id: int) {
let n = 15;
assert (fib(n) == fib(n));
i += 1;
- log_err #fmt["%d: Completed %d iterations", id, i];
+ log_err #ifmt["%d: Completed %d iterations", id, i];
}
}
@@ -108,9 +108,8 @@ fn main(argv: [str]) {
let elapsed = stop - start;
out.write_line(
- istr::from_estr(
- #fmt["%d\t%d\t%s", n, fibn,
- istr::to_estr(u64::str(elapsed))]));
+ #ifmt["%d\t%d\t%s", n, fibn,
+ u64::str(elapsed)]);
}
}
}
View
4 src/test/bench/task-perf-word-count-generic.rs
@@ -128,7 +128,7 @@ mod map_reduce {
while !is_done || ref_count > 0 {
alt recv(p) {
emit_val(v) {
- // log_err #fmt("received %d", v);
+ // log_err #ifmt("received %d", v);
ret some(v);
}
done. {
@@ -203,7 +203,7 @@ fn main(argv: [str]) {
let out = io::stdout();
out.write_line(
- istr::from_estr(#fmt["Usage: %s <filename> ...", argv[0]]));
+ #ifmt["Usage: %s <filename> ...", istr::from_estr(argv[0])]);
// TODO: run something just to make sure the code hasn't
// broken yet. This is the unit test mode of this program.
View
6 src/test/bench/task-perf-word-count.rs
@@ -124,7 +124,7 @@ mod map_reduce {
while !is_done || ref_count > 0 {
alt recv(p) {
emit_val(v) {
- // log_err #fmt("received %d", v);
+ // log_err #ifmt("received %d", v);
ret some(v);
}
done. {
@@ -198,8 +198,8 @@ fn main(argv: [str]) {
if vec::len(argv) < 2u {
let out = io::stdout();
- out.write_line(istr::from_estr(
- #fmt["Usage: %s <filename> ...", argv[0]]));
+ out.write_line(
+ #ifmt["Usage: %s <filename> ...", istr::from_estr(argv[0])]);
// TODO: run something just to make sure the code hasn't
// broken yet. This is the unit test mode of this program.
View
4 src/test/compile-fail/ext-after-attrib.rs
@@ -1,7 +1,7 @@
-// error-pattern:expecting [, found fmt
+// error-pattern:expecting [, found ifmt
// Don't know how to deal with a syntax extension appearing after an
// item attribute. Probably could use a better error message.
#[foo = "bar"]
-#fmt("baz")
+#ifmt("baz")
fn main() { }
View
2  src/test/compile-fail/extfmt-missing-type.rs
@@ -1,3 +1,3 @@
// error-pattern:missing type
-fn main() { #fmt["%+"]; }
+fn main() { #ifmt["%+"]; }
View
2  src/test/compile-fail/extfmt-no-args.rs
@@ -1,3 +1,3 @@
// error-pattern:format string
-fn main() { #fmt[]; }
+fn main() { #ifmt[]; }
View
4 src/test/compile-fail/extfmt-non-literal.rs
@@ -1,8 +1,8 @@
// error-pattern: literal
fn main() {
- // #fmt's first argument must be a literal. Hopefully this
+ // #ifmt's first argument must be a literal. Hopefully this
// restriction can be eased eventually to just require a
// compile-time constant.
- let x = #fmt["a" + "b"];
+ let x = #ifmt["a" + "b"];
}
View
4 src/test/compile-fail/extfmt-non-literal2.rs
@@ -1,8 +1,8 @@
// error-pattern: literal
fn main() {
- // #fmt's first argument must be a literal. Hopefully this
+ // #ifmt's first argument must be a literal. Hopefully this
// restriction can be eased eventually to just require a
// compile-time constant.
- let x = #fmt[20];
+ let x = #ifmt[20];
}
View
2  src/test/compile-fail/extfmt-not-enough-args.rs
@@ -2,4 +2,4 @@
use std;
-fn main() { let s = #fmt["%s%s%s", "test", "test"]; }
+fn main() { let s = #ifmt["%s%s%s", "test", "test"]; }
View
2  src/test/compile-fail/extfmt-too-many-args.rs
@@ -2,4 +2,4 @@
use std;
-fn main() { let s = #fmt["%s", "test", "test"]; }
+fn main() { let s = #ifmt["%s", "test", "test"]; }
View
2  src/test/compile-fail/extfmt-unknown-type.rs
@@ -1,3 +1,3 @@
// error-pattern:unknown type
-fn main() { #fmt["%w"]; }
+fn main() { #ifmt["%w"]; }
View
4 src/test/compile-fail/extfmt-unsigned-plus.rs
@@ -1,6 +1,6 @@
-// error-pattern:only valid in signed #fmt conversion
+// error-pattern:only valid in signed #ifmt conversion
fn main() {
// Can't use a sign on unsigned conversions
- #fmt["%+u", 10u];
+ #ifmt["%+u", 10u];
}
View
4 src/test/compile-fail/extfmt-unsigned-space.rs
@@ -1,6 +1,6 @@
-// error-pattern:only valid in signed #fmt conversion
+// error-pattern:only valid in signed #ifmt conversion
fn main() {
// Can't use a space on unsigned conversions
- #fmt["% u", 10u];
+ #ifmt["% u", 10u];
}
View
2  src/test/compile-fail/extfmt-unterminated-conv.rs
@@ -1,3 +1,3 @@
// error-pattern:unterminated conversion
-fn main() { #fmt["%"]; }
+fn main() { #ifmt["%"]; }
View
54 src/test/compiletest/compiletest.rs
@@ -72,34 +72,21 @@ fn parse_config(args: &[istr]) -> config {
fn log_config(config: &config) {
let c = config;
- logv(c, istr::from_estr(
- #fmt["configuration:"]));
- logv(c, istr::from_estr(
- #fmt["compile_lib_path: %s",
- istr::to_estr(config.compile_lib_path)]));
- logv(c, istr::from_estr(
- #fmt["run_lib_path: %s", istr::to_estr(config.run_lib_path)]));
- logv(c, istr::from_estr(
- #fmt["rustc_path: %s", istr::to_estr(config.rustc_path)]));
- logv(c, istr::from_estr(
- #fmt["src_base: %s", istr::to_estr(config.src_base)]));
- logv(c, istr::from_estr(
- #fmt["build_base: %s", istr::to_estr(config.build_base)]));
- logv(c, istr::from_estr(
- #fmt["stage_id: %s", istr::to_estr(config.stage_id)]));
- logv(c, istr::from_estr(
- #fmt["mode: %s", istr::to_estr(mode_str(config.mode))]));
- logv(c, istr::from_estr(
- #fmt["run_ignored: %b", config.run_ignored]));
- logv(c, istr::from_estr(
- #fmt["filter: %s", istr::to_estr(opt_str(config.filter))]));
- logv(c, istr::from_estr(
- #fmt["runtool: %s", istr::to_estr(opt_str(config.runtool))]));
- logv(c, istr::from_estr(
- #fmt["rustcflags: %s", istr::to_estr(opt_str(config.rustcflags))]));
- logv(c, istr::from_estr(
- #fmt["verbose: %b", config.verbose]));
- logv(c, istr::from_estr(#fmt["\n"]));
+ logv(c, #ifmt["configuration:"]);
+ logv(c, #ifmt["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"]);
}
fn opt_str(maybestr: option::t<istr>) -> istr {
@@ -154,11 +141,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 #fmt["making tests from %s", istr::to_estr(cx.config.src_base)];
+ log #ifmt["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) {
- log #fmt["inspecting file %s", istr::to_estr(file)];
+ let file = file;
+ log #ifmt["inspecting file %s", file];
if is_test(cx.config, file) {
tests += [make_test(cx, file, configport)];
}
@@ -196,9 +184,9 @@ fn make_test(cx: &cx, testfile: &istr, configport: &port<[u8]>) ->
}
fn make_test_name(config: &config, testfile: &istr) -> str {
- #fmt["[%s] %s",
- istr::to_estr(mode_str(config.mode)),
- istr::to_estr(testfile)]
+ istr::to_estr(
+ #ifmt["[%s] %s", mode_str(config.mode),
+ testfile])
}
/*
View
5 src/test/compiletest/header.rs
@@ -115,9 +115,8 @@ fn parse_name_value_directive(line: &istr,
let value =
istr::slice(line, colon + istr::byte_len(keycolon),
istr::byte_len(line));
- log #fmt("%s: %s",
- istr::to_estr(directive),
- istr::to_estr(value));
+ log #ifmt("%s: %s", directive,
+ value);
option::some(value)
} else { option::none }
}
View
76 src/test/compiletest/runtest.rs
@@ -25,7 +25,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 #fmt["running %s", istr::to_estr(testfile)];
+ log #ifmt["running %s", testfile];
let props = load_props(testfile);
alt cx.config.mode {
mode_compile_fail. { run_cfail_test(cx, props, testfile); }
@@ -91,15 +91,13 @@ fn run_pretty_test(cx: &cx, props: &test_props, testfile: &istr) {
let round = 0;
while round < rounds {
- logv(cx.config,
- istr::from_estr(#fmt["pretty-printing round %d", round]));
+ logv(cx.config, #ifmt["pretty-printing round %d", round]);
let procres = print_source(cx, testfile, srcs[round]);
if procres.status != 0 {
fatal_procres(
- istr::from_estr(#fmt["pretty-printing failed in round %d",
- round]),
- procres);
+ #ifmt["pretty-printing failed in round %d", round],
+ procres);
}
srcs += [procres.stdout];
@@ -150,7 +148,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 =
- #fmt["\n\
+ #ifmt["\n\
expected:\n\
------------------------------------------\n\
%s\n\
@@ -160,8 +158,9 @@ actual:\n\
%s\n\
------------------------------------------\n\
\n",
- istr::to_estr(expected), istr::to_estr(actual)];
- io::stdout().write_str(istr::from_estr(msg));
+ expected,
+ actual];
+ io::stdout().write_str(msg);
fail;
}
}
@@ -192,7 +191,8 @@ fn check_error_patterns(props: &test_props, testfile: &istr,
let next_err_pat = props.error_patterns[next_err_idx];
for line: istr in istr::split(procres.stdout, '\n' as u8) {
if istr::find(line, next_err_pat) > 0 {
- log #fmt["found error pattern %s", istr::to_estr(next_err_pat)];
+ log #ifmt["found error pattern %s",
+ next_err_pat];