Convert all uses of #ifmt to #fmt. Issue #855
This commit is contained in:
parent
b4b81117ce
commit
418d09e547
50 changed files with 180 additions and 180 deletions
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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] <input>\n", argv0] +
|
||||
#fmt["usage: %s [options] <input>\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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) -> ! {
|
||||
|
|
|
|||
|
|
@ -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, ());
|
||||
|
|
|
|||
|
|
@ -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 =
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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]) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)];
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2438,7 +2438,7 @@ mod unify {
|
|||
let sets = ~"";
|
||||
let j = 0u;
|
||||
while j < vec::len::<option::t<uint>>(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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1377,10 +1377,10 @@ 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 #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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<span>, 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<span>, 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; }
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ fn expand_expr(exts: &hashmap<istr, syntax_extension>, 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)) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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])
|
||||
}
|
||||
}],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue