Register snapshots and switch logging over to use of log_full or #error / #debug.
This commit is contained in:
parent
3b61064631
commit
8b580954fe
@ -203,7 +203,7 @@ fn try_parse_sources(filename: str, sources: map::hashmap<str, source>) {
|
||||
some(json::dict(_j)) {
|
||||
_j.items { |k, v|
|
||||
sources.insert(k, parse_source(k, v));
|
||||
log #fmt["source: %s", k];
|
||||
#debug("source: %s", k);
|
||||
}
|
||||
}
|
||||
_ { fail "malformed sources.json"; }
|
||||
@ -269,11 +269,11 @@ fn load_one_source_package(&src: source, p: map::hashmap<str, json::json>) {
|
||||
ref: ref,
|
||||
tags: tags
|
||||
});
|
||||
log " Loaded package: " + src.name + "/" + name;
|
||||
log_full(core::debug, " Loaded package: " + src.name + "/" + name);
|
||||
}
|
||||
|
||||
fn load_source_packages(&c: cargo, &src: source) {
|
||||
log "Loading source: " + src.name;
|
||||
log_full(core::debug, "Loading source: " + src.name);
|
||||
let dir = fs::connect(c.sourcedir, src.name);
|
||||
let pkgfile = fs::connect(dir, "packages.json");
|
||||
if !fs::path_exists(pkgfile) { ret; }
|
||||
@ -356,7 +356,7 @@ fn install_one_crate(c: cargo, _path: str, cf: str, _p: pkg) {
|
||||
if ri != -1 {
|
||||
name = str::slice(name, 0u, ri as uint);
|
||||
}
|
||||
log #fmt["Installing: %s", name];
|
||||
#debug("Installing: %s", name);
|
||||
let old = fs::list_dir(".");
|
||||
let p = run::program_output("rustc", [name + ".rc"]);
|
||||
if p.status != 0 {
|
||||
@ -370,22 +370,22 @@ fn install_one_crate(c: cargo, _path: str, cf: str, _p: pkg) {
|
||||
for ct: str in created {
|
||||
if (exec_suffix != "" && str::ends_with(ct, exec_suffix)) ||
|
||||
(exec_suffix == "" && !str::starts_with(ct, "./lib")) {
|
||||
log #fmt[" bin: %s", ct];
|
||||
#debug(" bin: %s", ct);
|
||||
// FIXME: need libstd fs::copy or something
|
||||
run::run_program("cp", [ct, c.bindir]);
|
||||
} else {
|
||||
log #fmt[" lib: %s", ct];
|
||||
#debug(" lib: %s", ct);
|
||||
run::run_program("cp", [ct, c.libdir]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn install_source(c: cargo, path: str) {
|
||||
log #fmt["source: %s", path];
|
||||
#debug("source: %s", path);
|
||||
fs::change_dir(path);
|
||||
let contents = fs::list_dir(".");
|
||||
|
||||
log #fmt["contents: %s", str::connect(contents, ", ")];
|
||||
#debug("contents: %s", str::connect(contents, ", "));
|
||||
|
||||
let cratefiles =
|
||||
vec::filter::<str>(contents, { |n| str::ends_with(n, ".rc") });
|
||||
|
@ -588,15 +588,15 @@ fn link_binary(sess: session::session,
|
||||
let long_libname =
|
||||
std::os::dylib_filename(#fmt("%s-%s-%s",
|
||||
lm.name, lm.extras_hash, lm.vers));
|
||||
log "link_meta.name: " + lm.name;
|
||||
log "long_libname: " + long_libname;
|
||||
log "out_filename: " + out_filename;
|
||||
log "dirname(out_filename): " + fs::dirname(out_filename);
|
||||
#debug("link_meta.name: %s", lm.name);
|
||||
#debug("long_libname: %s", long_libname);
|
||||
#debug("out_filename: %s", out_filename);
|
||||
#debug("dirname(out_filename): %s", fs::dirname(out_filename));
|
||||
|
||||
fs::connect(fs::dirname(out_filename), long_libname)
|
||||
} else { out_filename };
|
||||
|
||||
log "output: " + output;
|
||||
log_full(core::debug, "output: " + output);
|
||||
|
||||
// The default library location, we need this to find the runtime.
|
||||
// The location of crates will be determined as needed.
|
||||
@ -670,7 +670,7 @@ fn link_binary(sess: session::session,
|
||||
|
||||
gcc_args += rpath::get_rpath_flags(sess, output);
|
||||
|
||||
log #fmt("gcc link args: %s", str::connect(gcc_args, " "));
|
||||
#debug("gcc link args: %s", str::connect(gcc_args, " "));
|
||||
// We run 'gcc' here
|
||||
let prog = run::program_output(prog, gcc_args);
|
||||
if 0 != prog.status {
|
||||
|
@ -21,7 +21,7 @@ fn get_rpath_flags(sess: session::session, out_filename: str) -> [str] {
|
||||
ret [];
|
||||
}
|
||||
|
||||
log "preparing the RPATH!";
|
||||
#debug("preparing the RPATH!");
|
||||
|
||||
let cwd = os::getcwd();
|
||||
let sysroot = sess.filesearch().sysroot();
|
||||
@ -52,14 +52,14 @@ fn rpaths_to_flags(rpaths: [str]) -> [str] {
|
||||
fn get_rpaths(os: session::os, cwd: fs::path, sysroot: fs::path,
|
||||
output: fs::path, libs: [fs::path],
|
||||
target_triple: str) -> [str] {
|
||||
log #fmt("cwd: %s", cwd);
|
||||
log #fmt("sysroot: %s", sysroot);
|
||||
log #fmt("output: %s", output);
|
||||
log #fmt("libs:");
|
||||
#debug("cwd: %s", cwd);
|
||||
#debug("sysroot: %s", sysroot);
|
||||
#debug("output: %s", output);
|
||||
#debug("libs:");
|
||||
for libpath in libs {
|
||||
log #fmt(" %s", libpath);
|
||||
#debug(" %s", libpath);
|
||||
}
|
||||
log #fmt("target_triple: %s", target_triple);
|
||||
#debug("target_triple: %s", target_triple);
|
||||
|
||||
// Use relative paths to the libraries. Binaries can be moved
|
||||
// as long as they maintain the relative relationship to the
|
||||
@ -74,9 +74,9 @@ fn get_rpaths(os: session::os, cwd: fs::path, sysroot: fs::path,
|
||||
let fallback_rpaths = [get_install_prefix_rpath(cwd, target_triple)];
|
||||
|
||||
fn log_rpaths(desc: str, rpaths: [str]) {
|
||||
log #fmt("%s rpaths:", desc);
|
||||
#debug("%s rpaths:", desc);
|
||||
for rpath in rpaths {
|
||||
log #fmt(" %s", rpath);
|
||||
#debug(" %s", rpath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ fn find_linkage_metas(attrs: [ast::attribute]) -> [@ast::meta_item] {
|
||||
for attr: ast::attribute in find_attrs_by_name(attrs, "link") {
|
||||
alt attr.node.value.node {
|
||||
ast::meta_list(_, items) { metas += items; }
|
||||
_ { log "ignoring link attribute that has incorrect type"; }
|
||||
_ { #debug("ignoring link attribute that has incorrect type"); }
|
||||
}
|
||||
}
|
||||
ret metas;
|
||||
@ -140,9 +140,9 @@ fn contains(haystack: [@ast::meta_item], needle: @ast::meta_item) -> bool {
|
||||
for item: @ast::meta_item in haystack {
|
||||
log #fmt["looking in %s",
|
||||
syntax::print::pprust::meta_item_to_str(*item)];
|
||||
if eq(item, needle) { log "found it!"; ret true; }
|
||||
if eq(item, needle) { #debug("found it!"); ret true; }
|
||||
}
|
||||
log "found it not :(";
|
||||
#debug("found it not :(");
|
||||
ret false;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) ->
|
||||
@ast::item {
|
||||
|
||||
cx.path += [i.ident];
|
||||
log #fmt["current path: %s", ast_util::path_name_i(cx.path)];
|
||||
#debug("current path: %s", ast_util::path_name_i(cx.path));
|
||||
|
||||
if is_test_fn(i) {
|
||||
alt i.node {
|
||||
@ -89,12 +89,12 @@ fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) ->
|
||||
"unsafe functions cannot be used for tests");
|
||||
}
|
||||
_ {
|
||||
log "this is a test function";
|
||||
#debug("this is a test function");
|
||||
let test = {span: i.span,
|
||||
path: cx.path, ignore: is_ignored(cx, i),
|
||||
should_fail: should_fail(i)};
|
||||
cx.testfns += [test];
|
||||
log #fmt["have %u test functions", vec::len(cx.testfns)];
|
||||
#debug("have %u test functions", vec::len(cx.testfns));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -177,7 +177,7 @@ fn mk_test_module(cx: test_ctxt) -> @ast::item {
|
||||
node: item_,
|
||||
span: dummy_sp()};
|
||||
|
||||
log #fmt["Synthetic test module:\n%s\n", pprust::item_to_str(@item)];
|
||||
#debug("Synthetic test module:\n%s\n", pprust::item_to_str(@item));
|
||||
|
||||
ret @item;
|
||||
}
|
||||
@ -242,7 +242,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)];
|
||||
#debug("building test vector from %u tests", vec::len(cx.testfns));
|
||||
let descs = [];
|
||||
for test: test in cx.testfns {
|
||||
let test_ = test; // Satisfy alias analysis
|
||||
@ -258,7 +258,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr {
|
||||
let span = test.span;
|
||||
let path = test.path;
|
||||
|
||||
log #fmt["encoding %s", ast_util::path_name_i(path)];
|
||||
#debug("encoding %s", ast_util::path_name_i(path));
|
||||
|
||||
let name_lit: ast::lit =
|
||||
nospan(ast::lit_str(ast_util::path_name_i(path)));
|
||||
|
@ -1010,7 +1010,7 @@ fn type_to_str_inner(names: type_names, outer0: [TypeRef], ty: TypeRef) ->
|
||||
12 { ret "Opaque"; }
|
||||
13 { ret "Vector"; }
|
||||
14 { ret "Metadata"; }
|
||||
_ { log_err #fmt["unknown TypeKind %d", kind as int]; fail; }
|
||||
_ { #error("unknown TypeKind %d", kind as int); fail; }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,15 +107,15 @@ fn metadata_matches(crate_data: @[u8], metas: [@ast::meta_item]) -> bool {
|
||||
log #fmt["matching %u metadata requirements against %u items",
|
||||
vec::len(metas), vec::len(linkage_metas)];
|
||||
|
||||
log #fmt("crate metadata:");
|
||||
#debug("crate metadata:");
|
||||
for have: @ast::meta_item in linkage_metas {
|
||||
log #fmt(" %s", pprust::meta_item_to_str(*have));
|
||||
#debug(" %s", pprust::meta_item_to_str(*have));
|
||||
}
|
||||
|
||||
for needed: @ast::meta_item in metas {
|
||||
log #fmt["looking for %s", pprust::meta_item_to_str(*needed)];
|
||||
#debug("looking for %s", pprust::meta_item_to_str(*needed));
|
||||
if !attr::contains(linkage_metas, needed) {
|
||||
log #fmt["missing %s", pprust::meta_item_to_str(*needed)];
|
||||
#debug("missing %s", pprust::meta_item_to_str(*needed));
|
||||
ret false;
|
||||
}
|
||||
}
|
||||
@ -175,26 +175,26 @@ fn find_library_crate_aux(sess: session::session,
|
||||
let suffix: str = nn.suffix;
|
||||
|
||||
ret filesearch::search(filesearch, { |path|
|
||||
log #fmt("inspecting file %s", path);
|
||||
#debug("inspecting file %s", path);
|
||||
let f: str = fs::basename(path);
|
||||
if !(str::starts_with(f, prefix) && str::ends_with(f, suffix)) {
|
||||
log #fmt["skipping %s, doesn't look like %s*%s", path, prefix,
|
||||
suffix];
|
||||
option::none
|
||||
} else {
|
||||
log #fmt("%s is a candidate", path);
|
||||
#debug("%s is a candidate", path);
|
||||
alt get_metadata_section(sess, path) {
|
||||
option::some(cvec) {
|
||||
if !metadata_matches(cvec, metas) {
|
||||
log #fmt["skipping %s, metadata doesn't match", path];
|
||||
#debug("skipping %s, metadata doesn't match", path);
|
||||
option::none
|
||||
} else {
|
||||
log #fmt["found %s with matching metadata", path];
|
||||
#debug("found %s with matching metadata", path);
|
||||
option::some({ident: path, data: cvec})
|
||||
}
|
||||
}
|
||||
_ {
|
||||
log #fmt("could not load metadata for %s", path);
|
||||
#debug("could not load metadata for %s", path);
|
||||
option::none
|
||||
}
|
||||
}
|
||||
@ -270,21 +270,21 @@ fn resolve_crate(e: env, ident: ast::ident, metas: [@ast::meta_item],
|
||||
|
||||
// Go through the crate metadata and load any crates that it references
|
||||
fn resolve_crate_deps(e: env, cdata: @[u8]) -> cstore::cnum_map {
|
||||
log "resolving deps of external crate";
|
||||
#debug("resolving deps of external crate");
|
||||
// The map from crate numbers in the crate we're resolving to local crate
|
||||
// numbers
|
||||
let cnum_map = new_int_hash::<ast::crate_num>();
|
||||
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", cname];
|
||||
#debug("resolving dep %s", cname);
|
||||
if e.crate_cache.contains_key(cname) {
|
||||
log "already have it";
|
||||
#debug("already have it");
|
||||
// We've already seen this crate
|
||||
let local_cnum = e.crate_cache.get(cname);
|
||||
cnum_map.insert(extrn_cnum, local_cnum);
|
||||
} else {
|
||||
log "need to load it";
|
||||
#debug("need to load it");
|
||||
// This is a new one so we've got to load it
|
||||
// FIXME: Need better error reporting than just a bogus span
|
||||
let fake_span = ast_util::dummy_sp();
|
||||
|
@ -127,16 +127,16 @@ fn get_dep_hashes(cstore: cstore) -> [str] {
|
||||
p(cstore).use_crate_map.values {|cnum|
|
||||
let cdata = cstore::get_crate_data(cstore, cnum);
|
||||
let hash = decoder::get_crate_hash(cdata.data);
|
||||
log #fmt("Add hash[%s]: %s", cdata.name, hash);
|
||||
#debug("Add hash[%s]: %s", cdata.name, hash);
|
||||
result += [{name: cdata.name, hash: hash}];
|
||||
};
|
||||
fn lteq(a: crate_hash, b: crate_hash) -> bool {
|
||||
ret a.name <= b.name;
|
||||
}
|
||||
let sorted = std::sort::merge_sort(lteq, result);
|
||||
log "sorted:";
|
||||
#debug("sorted:");
|
||||
for x in sorted {
|
||||
log #fmt(" hash[%s]: %s", x.name, x.hash);
|
||||
#debug(" hash[%s]: %s", x.name, x.hash);
|
||||
}
|
||||
fn mapper(ch: crate_hash) -> str { ret ch.hash; }
|
||||
ret vec::map(sorted, mapper);
|
||||
|
@ -124,7 +124,7 @@ fn parse_constr_arg(st: @pstate, _sd: str_def) -> ast::fn_constr_arg {
|
||||
// FIXME
|
||||
ret ast::carg_ident((c as uint) - 48u);
|
||||
} else {
|
||||
log_err "Lit args are unimplemented";
|
||||
#error("Lit args are unimplemented");
|
||||
fail; // FIXME
|
||||
}
|
||||
/*
|
||||
@ -210,8 +210,8 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t {
|
||||
'c' { kind_copyable }
|
||||
'a' { kind_noncopyable }
|
||||
c {
|
||||
log_err "unexpected char in encoded type param: ";
|
||||
log_err c;
|
||||
#error("unexpected char in encoded type param: ");
|
||||
log_full(core::error, c);
|
||||
fail
|
||||
}
|
||||
};
|
||||
@ -318,7 +318,7 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t {
|
||||
assert (next(st) as char == ']');
|
||||
ret ty::mk_constr(st.tcx, tt, tcs);
|
||||
}
|
||||
c { log_err "unexpected char in type string: "; log_err c; fail; }
|
||||
c { #error("unexpected char in type string: %c", c); fail;}
|
||||
}
|
||||
}
|
||||
|
||||
@ -393,7 +393,7 @@ fn parse_def_id(buf: [u8]) -> ast::def_id {
|
||||
let len = vec::len::<u8>(buf);
|
||||
while colon_idx < len && buf[colon_idx] != ':' as u8 { colon_idx += 1u; }
|
||||
if colon_idx == len {
|
||||
log_err "didn't find ':' when parsing def id";
|
||||
#error("didn't find ':' when parsing def id");
|
||||
fail;
|
||||
}
|
||||
let crate_part = vec::slice::<u8>(buf, 0u, colon_idx);
|
||||
|
@ -714,9 +714,9 @@ fn create_function(fcx: @fn_ctxt) -> @metadata<subprogram_md> {
|
||||
let cx = fcx_ccx(fcx);
|
||||
let dbg_cx = option::get(cx.dbg_cx);
|
||||
|
||||
log "~~";
|
||||
log fcx.id;
|
||||
log cx.sess.span_str(fcx.sp);
|
||||
#debug("~~");
|
||||
log_full(core::debug, fcx.id);
|
||||
log_full(core::debug, cx.sess.span_str(fcx.sp));
|
||||
|
||||
let (ident, ret_ty, id) = alt cx.ast_map.get(fcx.id) {
|
||||
ast_map::node_item(item) {
|
||||
@ -746,8 +746,8 @@ fn create_function(fcx: @fn_ctxt) -> @metadata<subprogram_md> {
|
||||
}
|
||||
};
|
||||
|
||||
log ident;
|
||||
log id;
|
||||
log_full(core::debug, ident);
|
||||
log_full(core::debug, id);
|
||||
|
||||
let path = str::connect(fcx.lcx.path + [ident], "::");
|
||||
|
||||
|
@ -20,7 +20,7 @@ fn fn_usage_expr(expr: @ast::expr,
|
||||
alt ctx.tcx.def_map.find(expr.id) {
|
||||
some(ast::def_fn(_, ast::unsafe_fn.)) |
|
||||
some(ast::def_native_fn(_, ast::unsafe_fn.)) {
|
||||
log_err ("expr=", expr_to_str(expr));
|
||||
log_full(core::error, ("expr=", expr_to_str(expr)));
|
||||
ctx.tcx.sess.span_fatal(
|
||||
expr.span,
|
||||
"unsafe functions can only be called");
|
||||
|
@ -447,9 +447,9 @@ fn visit_fn_block_with_scope(_e: @env, decl: fn_decl, blk: ast::blk,
|
||||
span: span, id: node_id,
|
||||
sc: scopes, v: vt<scopes>) {
|
||||
let scope = scope_fn_expr(decl, id, []);
|
||||
log ("scope=", scope);
|
||||
log_full(core::debug, ("scope=", scope));
|
||||
visit::visit_fn_block(decl, blk, span, id, cons(scope, @sc), v);
|
||||
log ("unscope");
|
||||
log_full(core::debug, ("unscope"));
|
||||
}
|
||||
|
||||
fn visit_block_with_scope(b: ast::blk, sc: scopes, v: vt<scopes>) {
|
||||
|
@ -1122,7 +1122,7 @@ fn set_glue_inlining(cx: @local_ctxt, f: ValueRef, t: ty::t) {
|
||||
fn declare_tydesc(cx: @local_ctxt, sp: span, t: ty::t, ty_params: [uint],
|
||||
is_obj_body: bool) ->
|
||||
@tydesc_info {
|
||||
log "+++ declare_tydesc " + ty_to_str(cx.ccx.tcx, t);
|
||||
log_full(core::debug, "+++ declare_tydesc " + ty_to_str(cx.ccx.tcx, t));
|
||||
let ccx = cx.ccx;
|
||||
let llsize;
|
||||
let llalign;
|
||||
@ -1158,7 +1158,7 @@ fn declare_tydesc(cx: @local_ctxt, sp: span, t: ty::t, ty_params: [uint],
|
||||
mutable cmp_glue: none::<ValueRef>,
|
||||
ty_params: ty_params,
|
||||
is_obj_body: is_obj_body};
|
||||
log "--- declare_tydesc " + ty_to_str(cx.ccx.tcx, t);
|
||||
log_full(core::debug, "--- declare_tydesc " + ty_to_str(cx.ccx.tcx, t));
|
||||
ret info;
|
||||
}
|
||||
|
||||
@ -5713,16 +5713,16 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
|
||||
// Translate the metadata.
|
||||
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];
|
||||
#error("--- trans stats ---");
|
||||
#error("n_static_tydescs: %u", ccx.stats.n_static_tydescs);
|
||||
#error("n_derived_tydescs: %u", ccx.stats.n_derived_tydescs);
|
||||
#error("n_glues_created: %u", ccx.stats.n_glues_created);
|
||||
#error("n_null_glues: %u", ccx.stats.n_null_glues);
|
||||
#error("n_real_glues: %u", ccx.stats.n_real_glues);
|
||||
|
||||
|
||||
for timing: {ident: str, time: int} in *ccx.stats.fn_times {
|
||||
log_err #fmt["time: %s took %d ms", timing.ident, timing.time];
|
||||
#error("time: %s took %d ms", timing.ident, timing.time);
|
||||
}
|
||||
}
|
||||
ret (llmod, link_meta);
|
||||
|
@ -516,7 +516,7 @@ fn add_span_comment(bcx: @block_ctxt, sp: span, text: str) {
|
||||
let ccx = bcx_ccx(bcx);
|
||||
if (!ccx.sess.get_opts().no_asm_comments) {
|
||||
let s = text + " (" + ccx.sess.span_str(sp) + ")";
|
||||
log s;
|
||||
log_full(core::debug, s);
|
||||
add_comment(bcx, s);
|
||||
}
|
||||
}
|
||||
|
@ -15,12 +15,12 @@ fn collect_ids_block(b: blk, rs: @mutable [node_id]) { *rs += [b.node.id]; }
|
||||
fn collect_ids_stmt(s: @stmt, rs: @mutable [node_id]) {
|
||||
alt s.node {
|
||||
stmt_decl(_, id) {
|
||||
log "node_id " + int::str(id);
|
||||
log_full(core::debug, "node_id " + int::str(id));
|
||||
log_stmt(*s);;
|
||||
*rs += [id];
|
||||
}
|
||||
stmt_expr(_, id) {
|
||||
log "node_id " + int::str(id);
|
||||
log_full(core::debug, "node_id " + int::str(id));
|
||||
log_stmt(*s);;
|
||||
*rs += [id];
|
||||
}
|
||||
@ -44,7 +44,7 @@ fn node_ids_in_fn(body: blk, rs: @mutable [node_id]) {
|
||||
|
||||
fn init_vecs(ccx: crate_ctxt, node_ids: [node_id], len: uint) {
|
||||
for i: node_id in node_ids {
|
||||
log int::str(i) + " |-> " + uint::str(len);
|
||||
log_full(core::debug, int::str(i) + " |-> " + uint::str(len));
|
||||
add_node(ccx, i, empty_ann(len));
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,9 @@ fn tritv_to_str(fcx: fn_ctxt, v: tritv::t) -> str {
|
||||
ret s;
|
||||
}
|
||||
|
||||
fn log_tritv(fcx: fn_ctxt, v: tritv::t) { log tritv_to_str(fcx, v); }
|
||||
fn log_tritv(fcx: fn_ctxt, v: tritv::t) {
|
||||
log_full(core::debug, tritv_to_str(fcx, v));
|
||||
}
|
||||
|
||||
fn first_difference_string(fcx: fn_ctxt, expected: tritv::t, actual: tritv::t)
|
||||
-> str {
|
||||
@ -91,7 +93,9 @@ fn first_difference_string(fcx: fn_ctxt, expected: tritv::t, actual: tritv::t)
|
||||
ret s;
|
||||
}
|
||||
|
||||
fn log_tritv_err(fcx: fn_ctxt, v: tritv::t) { log_err tritv_to_str(fcx, v); }
|
||||
fn log_tritv_err(fcx: fn_ctxt, v: tritv::t) {
|
||||
log_full(core::error, tritv_to_str(fcx, v));
|
||||
}
|
||||
|
||||
fn tos(v: [uint]) -> str {
|
||||
let rslt = "";
|
||||
@ -103,51 +107,51 @@ fn tos(v: [uint]) -> str {
|
||||
ret rslt;
|
||||
}
|
||||
|
||||
fn log_cond(v: [uint]) { log tos(v); }
|
||||
fn log_cond(v: [uint]) { log_full(core::debug, tos(v)); }
|
||||
|
||||
fn log_cond_err(v: [uint]) { log_err tos(v); }
|
||||
fn log_cond_err(v: [uint]) { log_full(core::error, tos(v)); }
|
||||
|
||||
fn log_pp(pp: pre_and_post) {
|
||||
let p1 = tritv::to_vec(pp.precondition);
|
||||
let p2 = tritv::to_vec(pp.postcondition);
|
||||
log "pre:";
|
||||
#debug("pre:");
|
||||
log_cond(p1);
|
||||
log "post:";
|
||||
#debug("post:");
|
||||
log_cond(p2);
|
||||
}
|
||||
|
||||
fn log_pp_err(pp: pre_and_post) {
|
||||
let p1 = tritv::to_vec(pp.precondition);
|
||||
let p2 = tritv::to_vec(pp.postcondition);
|
||||
log_err "pre:";
|
||||
#error("pre:");
|
||||
log_cond_err(p1);
|
||||
log_err "post:";
|
||||
#error("post:");
|
||||
log_cond_err(p2);
|
||||
}
|
||||
|
||||
fn log_states(pp: pre_and_post_state) {
|
||||
let p1 = tritv::to_vec(pp.prestate);
|
||||
let p2 = tritv::to_vec(pp.poststate);
|
||||
log "prestate:";
|
||||
#debug("prestate:");
|
||||
log_cond(p1);
|
||||
log "poststate:";
|
||||
#debug("poststate:");
|
||||
log_cond(p2);
|
||||
}
|
||||
|
||||
fn log_states_err(pp: pre_and_post_state) {
|
||||
let p1 = tritv::to_vec(pp.prestate);
|
||||
let p2 = tritv::to_vec(pp.poststate);
|
||||
log_err "prestate:";
|
||||
#error("prestate:");
|
||||
log_cond_err(p1);
|
||||
log_err "poststate:";
|
||||
#error("poststate:");
|
||||
log_cond_err(p2);
|
||||
}
|
||||
|
||||
fn print_ident(i: ident) { log " " + i + " "; }
|
||||
fn print_ident(i: ident) { log_full(core::debug, " " + i + " "); }
|
||||
|
||||
fn print_idents(&idents: [ident]) {
|
||||
if vec::len::<ident>(idents) == 0u { ret; }
|
||||
log "an ident: " + vec::pop::<ident>(idents);
|
||||
log_full(core::debug, "an ident: " + vec::pop::<ident>(idents));
|
||||
print_idents(idents);
|
||||
}
|
||||
|
||||
@ -303,7 +307,7 @@ fn get_ts_ann(ccx: crate_ctxt, i: node_id) -> option::t<ts_ann> {
|
||||
fn node_id_to_ts_ann(ccx: crate_ctxt, id: node_id) -> ts_ann {
|
||||
alt get_ts_ann(ccx, id) {
|
||||
none. {
|
||||
log_err "node_id_to_ts_ann: no ts_ann for node_id " + int::str(id);
|
||||
#error("node_id_to_ts_ann: no ts_ann for node_id %d", id);
|
||||
fail;
|
||||
}
|
||||
some(t) { ret t; }
|
||||
@ -311,12 +315,12 @@ fn node_id_to_ts_ann(ccx: crate_ctxt, id: node_id) -> ts_ann {
|
||||
}
|
||||
|
||||
fn node_id_to_poststate(ccx: crate_ctxt, id: node_id) -> poststate {
|
||||
log "node_id_to_poststate";
|
||||
#debug("node_id_to_poststate");
|
||||
ret node_id_to_ts_ann(ccx, id).states.poststate;
|
||||
}
|
||||
|
||||
fn stmt_to_ann(ccx: crate_ctxt, s: stmt) -> ts_ann {
|
||||
log "stmt_to_ann";
|
||||
#debug("stmt_to_ann");
|
||||
alt s.node {
|
||||
stmt_decl(_, id) { ret node_id_to_ts_ann(ccx, id); }
|
||||
stmt_expr(_, id) { ret node_id_to_ts_ann(ccx, id); }
|
||||
@ -326,14 +330,14 @@ fn stmt_to_ann(ccx: crate_ctxt, s: stmt) -> ts_ann {
|
||||
|
||||
/* fails if e has no annotation */
|
||||
fn expr_states(ccx: crate_ctxt, e: @expr) -> pre_and_post_state {
|
||||
log "expr_states";
|
||||
#debug("expr_states");
|
||||
ret node_id_to_ts_ann(ccx, e.id).states;
|
||||
}
|
||||
|
||||
|
||||
/* fails if e has no annotation */
|
||||
fn expr_pp(ccx: crate_ctxt, e: @expr) -> pre_and_post {
|
||||
log "expr_pp";
|
||||
#debug("expr_pp");
|
||||
ret node_id_to_ts_ann(ccx, e.id).conditions;
|
||||
}
|
||||
|
||||
@ -344,7 +348,7 @@ fn stmt_pp(ccx: crate_ctxt, s: stmt) -> pre_and_post {
|
||||
|
||||
/* fails if b has no annotation */
|
||||
fn block_pp(ccx: crate_ctxt, b: blk) -> pre_and_post {
|
||||
log "block_pp";
|
||||
#debug("block_pp");
|
||||
ret node_id_to_ts_ann(ccx, b.node.id).conditions;
|
||||
}
|
||||
|
||||
@ -359,7 +363,7 @@ fn clear_precond(ccx: crate_ctxt, id: node_id) {
|
||||
}
|
||||
|
||||
fn block_states(ccx: crate_ctxt, b: blk) -> pre_and_post_state {
|
||||
log "block_states";
|
||||
#debug("block_states");
|
||||
ret node_id_to_ts_ann(ccx, b.node.id).states;
|
||||
}
|
||||
|
||||
@ -420,43 +424,43 @@ fn block_poststate(ccx: crate_ctxt, b: blk) -> poststate {
|
||||
}
|
||||
|
||||
fn set_prestate_ann(ccx: crate_ctxt, id: node_id, pre: prestate) -> bool {
|
||||
log "set_prestate_ann";
|
||||
#debug("set_prestate_ann");
|
||||
ret set_prestate(node_id_to_ts_ann(ccx, id), pre);
|
||||
}
|
||||
|
||||
fn extend_prestate_ann(ccx: crate_ctxt, id: node_id, pre: prestate) -> bool {
|
||||
log "extend_prestate_ann";
|
||||
#debug("extend_prestate_ann");
|
||||
ret extend_prestate(node_id_to_ts_ann(ccx, id).states.prestate, pre);
|
||||
}
|
||||
|
||||
fn set_poststate_ann(ccx: crate_ctxt, id: node_id, post: poststate) -> bool {
|
||||
log "set_poststate_ann";
|
||||
#debug("set_poststate_ann");
|
||||
ret set_poststate(node_id_to_ts_ann(ccx, id), post);
|
||||
}
|
||||
|
||||
fn extend_poststate_ann(ccx: crate_ctxt, id: node_id, post: poststate) ->
|
||||
bool {
|
||||
log "extend_poststate_ann";
|
||||
#debug("extend_poststate_ann");
|
||||
ret extend_poststate(node_id_to_ts_ann(ccx, id).states.poststate, post);
|
||||
}
|
||||
|
||||
fn set_pre_and_post(ccx: crate_ctxt, id: node_id, pre: precond,
|
||||
post: postcond) {
|
||||
log "set_pre_and_post";
|
||||
#debug("set_pre_and_post");
|
||||
let t = node_id_to_ts_ann(ccx, id);
|
||||
set_precondition(t, pre);
|
||||
set_postcondition(t, post);
|
||||
}
|
||||
|
||||
fn copy_pre_post(ccx: crate_ctxt, id: node_id, sub: @expr) {
|
||||
log "set_pre_and_post";
|
||||
#debug("set_pre_and_post");
|
||||
let p = expr_pp(ccx, sub);
|
||||
copy_pre_post_(ccx, id, p.precondition, p.postcondition);
|
||||
}
|
||||
|
||||
fn copy_pre_post_(ccx: crate_ctxt, id: node_id, pre: prestate,
|
||||
post: poststate) {
|
||||
log "set_pre_and_post";
|
||||
#debug("set_pre_and_post");
|
||||
let t = node_id_to_ts_ann(ccx, id);
|
||||
set_precondition(t, pre);
|
||||
set_postcondition(t, post);
|
||||
@ -499,7 +503,7 @@ fn constraints_expr(cx: ty::ctxt, e: @expr) -> [@ty::constr] {
|
||||
fn node_id_to_def_strict(cx: ty::ctxt, id: node_id) -> def {
|
||||
alt cx.def_map.find(id) {
|
||||
none. {
|
||||
log_err "node_id_to_def: node_id " + int::str(id) + " has no def";
|
||||
#error("node_id_to_def: node_id %d has no def", id);
|
||||
fail;
|
||||
}
|
||||
some(d) { ret d; }
|
||||
@ -546,7 +550,8 @@ fn match_args(fcx: fn_ctxt, occs: @mutable [pred_args],
|
||||
log "match_args: looking at " +
|
||||
constr_args_to_str(fn (i: inst) -> str { ret i.ident; }, occ);
|
||||
for pd: pred_args in *occs {
|
||||
log "match_args: candidate " + pred_args_to_str(pd);
|
||||
log_full(core::debug,
|
||||
"match_args: candidate " + pred_args_to_str(pd));
|
||||
fn eq(p: inst, q: inst) -> bool { ret p.node == q.node; }
|
||||
if ty::args_eq(eq, pd.node.args, occ) { ret pd.node.bit_num; }
|
||||
}
|
||||
@ -750,7 +755,7 @@ fn replace(subst: subst, d: pred_args) -> [constr_arg_general_<inst>] {
|
||||
}
|
||||
}
|
||||
_ {
|
||||
// log_err "##";
|
||||
// #error("##");
|
||||
rslt += [c.node];
|
||||
}
|
||||
}
|
||||
@ -760,7 +765,7 @@ fn replace(subst: subst, d: pred_args) -> [constr_arg_general_<inst>] {
|
||||
for (constr_arg_general_<tup(ident, def_id)> p in rslt) {
|
||||
alt (p) {
|
||||
case (carg_ident(?p)) {
|
||||
log_err p._0;
|
||||
log_full(core::error, p._0);
|
||||
}
|
||||
case (_) {}
|
||||
}
|
||||
@ -975,7 +980,7 @@ fn args_mention<T>(args: [@constr_arg_use], q: fn([T], node_id) -> bool,
|
||||
alt (a.node) {
|
||||
case (carg_ident(?p1)) {
|
||||
auto res = q(s, p1._1);
|
||||
log_err (res);
|
||||
log_full(core::error, (res));
|
||||
res
|
||||
}
|
||||
case (_) { false }
|
||||
|
@ -158,7 +158,7 @@ fn relax_precond_block(fcx: fn_ctxt, i: node_id, b: blk) {
|
||||
}
|
||||
|
||||
fn gen_poststate(fcx: fn_ctxt, id: node_id, c: tsconstr) -> bool {
|
||||
log "gen_poststate";
|
||||
#debug("gen_poststate");
|
||||
ret set_in_poststate(bit_num(fcx, c),
|
||||
node_id_to_ts_ann(fcx.ccx, id).states);
|
||||
}
|
||||
@ -174,7 +174,7 @@ fn kill_all_prestate(fcx: fn_ctxt, id: node_id) {
|
||||
|
||||
|
||||
fn kill_poststate(fcx: fn_ctxt, id: node_id, c: tsconstr) -> bool {
|
||||
log "kill_poststate";
|
||||
#debug("kill_poststate");
|
||||
ret clear_in_poststate(bit_num(fcx, c),
|
||||
node_id_to_ts_ann(fcx.ccx, id).states);
|
||||
}
|
||||
@ -203,7 +203,7 @@ fn clear_in_poststate_expr(fcx: fn_ctxt, e: @expr, t: poststate) {
|
||||
}
|
||||
|
||||
fn kill_poststate_(fcx: fn_ctxt, c: tsconstr, post: poststate) -> bool {
|
||||
log "kill_poststate_";
|
||||
#debug("kill_poststate_");
|
||||
ret clear_in_poststate_(bit_num(fcx, c), post);
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ fn check_states_stmt(s: @stmt, fcx: fn_ctxt, v: visit::vt<fn_ctxt>) {
|
||||
|
||||
|
||||
log("check_states_stmt:");
|
||||
log print::pprust::stmt_to_str(*s);
|
||||
log_full(core::debug, print::pprust::stmt_to_str(*s));
|
||||
log("prec = ");
|
||||
log_tritv(fcx, prec);
|
||||
log("pres = ");
|
||||
|
@ -13,7 +13,7 @@ type ctxt = {cs: @mutable [sp_constr], tcx: ty::ctxt};
|
||||
fn collect_local(loc: @local, cx: ctxt, v: visit::vt<ctxt>) {
|
||||
pat_bindings(loc.node.pat) {|p|
|
||||
let ident = alt p.node { pat_bind(id, _) { id } };
|
||||
log "collect_local: pushing " + ident;;
|
||||
log_full(core::debug, "collect_local: pushing " + ident);;
|
||||
*cx.cs += [respan(loc.span, ninit(p.id, ident))];
|
||||
};
|
||||
visit::visit_local(loc, cx, v);
|
||||
@ -65,7 +65,8 @@ fn find_locals(tcx: ty::ctxt,
|
||||
|
||||
fn add_constraint(tcx: ty::ctxt, c: sp_constr, next: uint, tbl: constr_map) ->
|
||||
uint {
|
||||
log constraint_to_str(tcx, c) + " |-> " + uint::str(next);
|
||||
log_full(core::debug,
|
||||
constraint_to_str(tcx, c) + " |-> " + uint::str(next));
|
||||
alt c.node {
|
||||
ninit(id, i) { tbl.insert(local_def(id), cinit(next, c.span, i)); }
|
||||
npred(p, d_id, args) {
|
||||
|
@ -17,12 +17,12 @@ import syntax::codemap::span;
|
||||
import util::ppaux::fn_ident_to_string;
|
||||
|
||||
fn find_pre_post_mod(_m: _mod) -> _mod {
|
||||
log "implement find_pre_post_mod!";
|
||||
#debug("implement find_pre_post_mod!");
|
||||
fail;
|
||||
}
|
||||
|
||||
fn find_pre_post_native_mod(_m: native_mod) -> native_mod {
|
||||
log "implement find_pre_post_native_mod";
|
||||
#debug("implement find_pre_post_native_mod");
|
||||
fail;
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ fn find_pre_post_item(ccx: crate_ctxt, i: item) {
|
||||
be the union of all postconditions for <args> */
|
||||
fn find_pre_post_exprs(fcx: fn_ctxt, args: [@expr], id: node_id) {
|
||||
if vec::len::<@expr>(args) > 0u {
|
||||
log "find_pre_post_exprs: oper =";
|
||||
#debug("find_pre_post_exprs: oper =");
|
||||
log_expr(*args[0]);
|
||||
}
|
||||
fn do_one(fcx: fn_ctxt, e: @expr) { find_pre_post_expr(fcx, e); }
|
||||
@ -276,7 +276,7 @@ fn handle_var(fcx: fn_ctxt, rslt: pre_and_post, id: node_id, name: ident) {
|
||||
}
|
||||
|
||||
fn handle_var_def(fcx: fn_ctxt, rslt: pre_and_post, def: def, name: ident) {
|
||||
log ("handle_var_def: ", def, name);
|
||||
log_full(core::debug, ("handle_var_def: ", def, name));
|
||||
alt def {
|
||||
def_local(d_id, _) | def_arg(d_id, _) {
|
||||
use_var(fcx, d_id.node);
|
||||
@ -302,7 +302,7 @@ fn find_pre_post_expr_fn_upvars(fcx: fn_ctxt, e: @expr) {
|
||||
let rslt = expr_pp(fcx.ccx, e);
|
||||
clear_pp(rslt);
|
||||
for def in *freevars::get_freevars(fcx.ccx.tcx, e.id) {
|
||||
log ("handle_var_def: def=", def);
|
||||
log_full(core::debug, ("handle_var_def: def=", def));
|
||||
handle_var_def(fcx, rslt, def.def, "upvar");
|
||||
}
|
||||
}
|
||||
@ -358,7 +358,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) {
|
||||
vec::iter(cap_clause.moves, use_cap_item);
|
||||
|
||||
vec::iter(cap_clause.moves) { |cap_item|
|
||||
log ("forget_in_postcond: ", cap_item);
|
||||
log_full(core::debug, ("forget_in_postcond: ", cap_item));
|
||||
forget_in_postcond(fcx, e.id, cap_item.id);
|
||||
}
|
||||
}
|
||||
@ -565,7 +565,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) {
|
||||
}
|
||||
|
||||
fn find_pre_post_stmt(fcx: fn_ctxt, s: stmt) {
|
||||
log "stmt =";
|
||||
#debug("stmt =");
|
||||
log_stmt(s);
|
||||
alt s.node {
|
||||
stmt_decl(adecl, id) {
|
||||
@ -678,9 +678,9 @@ fn find_pre_post_block(fcx: fn_ctxt, b: blk) {
|
||||
fn do_one_(fcx: fn_ctxt, s: @stmt) {
|
||||
find_pre_post_stmt(fcx, *s);
|
||||
/*
|
||||
log_err "pre_post for stmt:";
|
||||
#error("pre_post for stmt:");
|
||||
log_stmt_err(*s);
|
||||
log_err "is:";
|
||||
#error("is:");
|
||||
log_pp_err(stmt_pp(fcx.ccx, *s));
|
||||
*/
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
|
||||
}
|
||||
expr_while(test, body) {
|
||||
/*
|
||||
log_err "in a while loop:";
|
||||
#error("in a while loop:");
|
||||
log_expr_err(*e);
|
||||
aux::log_tritv_err(fcx, block_poststate(fcx.ccx, body));
|
||||
aux::log_tritv_err(fcx, pres);
|
||||
@ -476,7 +476,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
|
||||
let loop_pres =
|
||||
intersect_states(block_poststate(fcx.ccx, body), pres);
|
||||
// aux::log_tritv_err(fcx, loop_pres);
|
||||
// log_err "---------------";
|
||||
// #error("---------------");
|
||||
|
||||
let changed =
|
||||
set_prestate_ann(fcx.ccx, e.id, loop_pres) |
|
||||
@ -621,14 +621,14 @@ fn find_pre_post_state_stmt(fcx: fn_ctxt, pres: prestate, s: @stmt) -> bool {
|
||||
let stmt_ann = stmt_to_ann(fcx.ccx, *s);
|
||||
|
||||
/*
|
||||
log_err ("[" + fcx.name + "]");
|
||||
log_err "*At beginning: stmt = ";
|
||||
log_full(core::error, ("[" + fcx.name + "]"));
|
||||
#error("*At beginning: stmt = ");
|
||||
log_stmt_err(*s);
|
||||
log_err "*prestate = ";
|
||||
#error("*prestate = ");
|
||||
log_tritv_err(fcx, stmt_ann.states.prestate);
|
||||
log_err "*poststate =";
|
||||
#error("*poststate =");
|
||||
log_tritv_err(fcx, stmt_ann.states.poststate);
|
||||
log_err "pres = ";
|
||||
#error("pres = ");
|
||||
log_tritv_err(fcx, pres);
|
||||
*/
|
||||
|
||||
@ -646,14 +646,14 @@ fn find_pre_post_state_stmt(fcx: fn_ctxt, pres: prestate, s: @stmt) -> bool {
|
||||
set_poststate(stmt_ann, c_and_p.post) | c_and_p.changed;
|
||||
|
||||
/*
|
||||
log_err "Summary: stmt = ";
|
||||
#error("Summary: stmt = ");
|
||||
log_stmt_err(*s);
|
||||
log_err "prestate = ";
|
||||
#error("prestate = ");
|
||||
log_tritv_err(fcx, stmt_ann.states.prestate);
|
||||
log_err "poststate =";
|
||||
#error("poststate =");
|
||||
log_tritv_err(fcx, stmt_ann.states.poststate);
|
||||
log_err "changed =";
|
||||
log_err changed;
|
||||
#error("changed =");
|
||||
log_full(core::error, changed);
|
||||
*/
|
||||
|
||||
ret changed;
|
||||
@ -671,7 +671,7 @@ fn find_pre_post_state_stmt(fcx: fn_ctxt, pres: prestate, s: @stmt) -> bool {
|
||||
set_poststate(stmt_ann, expr_poststate(fcx.ccx, ex));
|
||||
|
||||
/*
|
||||
log_err "Finally:";
|
||||
#error("Finally:");
|
||||
log_stmt_err(*s);
|
||||
log_err("prestate = ");
|
||||
log_err(bitv::to_str(stmt_ann.states.prestate));
|
||||
@ -718,16 +718,16 @@ fn find_pre_post_state_block(fcx: fn_ctxt, pres0: prestate, b: blk) -> bool {
|
||||
|
||||
|
||||
/*
|
||||
log_err "For block:";
|
||||
#error("For block:");
|
||||
log_block_err(b);
|
||||
log_err "poststate = ";
|
||||
#error("poststate = ");
|
||||
log_states_err(block_states(fcx.ccx, b));
|
||||
log_err "pres0:";
|
||||
#error("pres0:");
|
||||
log_tritv_err(fcx, pres0);
|
||||
log_err "post:";
|
||||
#error("post:");
|
||||
log_tritv_err(fcx, post);
|
||||
log_err "changed = ";
|
||||
log_err changed;
|
||||
#error("changed = ");
|
||||
log_full(core::error, changed);
|
||||
*/
|
||||
|
||||
ret changed;
|
||||
@ -773,8 +773,8 @@ fn find_pre_post_state_fn(fcx: fn_ctxt,
|
||||
}
|
||||
|
||||
/*
|
||||
log_err "find_pre_post_state_fn";
|
||||
log_err changed;
|
||||
#error("find_pre_post_state_fn");
|
||||
log_full(core::error, changed);
|
||||
fcx.ccx.tcx.sess.span_note(f_body.span, fcx.name);
|
||||
*/
|
||||
|
||||
|
@ -1535,7 +1535,7 @@ fn is_pred_ty(cx: ctxt, fty: t) -> bool {
|
||||
fn ty_var_id(cx: ctxt, typ: t) -> int {
|
||||
alt struct(cx, typ) {
|
||||
ty::ty_var(vid) { ret vid; }
|
||||
_ { log_err "ty_var_id called on non-var ty"; fail; }
|
||||
_ { #error("ty_var_id called on non-var ty"); fail; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -2450,7 +2450,7 @@ mod unify {
|
||||
none. { typespec = ""; }
|
||||
some(typ) { typespec = " =" + ty_to_str(tcx, typ); }
|
||||
}
|
||||
log_err #fmt["set %u:%s%s", i, typespec, sets];
|
||||
#error("set %u:%s%s", i, typespec, sets);
|
||||
i += 1u;
|
||||
}
|
||||
}
|
||||
|
@ -1530,7 +1530,8 @@ fn check_expr_fn_with_unifier(fcx: @fn_ctxt,
|
||||
|
||||
fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
|
||||
expected: ty::t) -> bool {
|
||||
//log_err "typechecking expr " + syntax::print::pprust::expr_to_str(expr);
|
||||
#debug("typechecking expr %s",
|
||||
syntax::print::pprust::expr_to_str(expr));
|
||||
|
||||
// A generic function to factor out common logic from call and bind
|
||||
// expressions.
|
||||
|
@ -28,8 +28,8 @@ fn expand_syntax_ext(cx: ext_ctxt, sp: span, arg: @ast::expr,
|
||||
expr_to_str(cx, args[0],
|
||||
"first argument to #fmt must be a " + "string literal.");
|
||||
let fmtspan = args[0].span;
|
||||
log "Format string:";
|
||||
log fmt;
|
||||
#debug("Format string:");
|
||||
log_full(core::debug, fmt);
|
||||
fn parse_fmt_err_(cx: ext_ctxt, sp: span, msg: str) -> ! {
|
||||
cx.span_fatal(sp, msg);
|
||||
}
|
||||
@ -252,53 +252,57 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr])
|
||||
}
|
||||
fn log_conv(c: conv) {
|
||||
alt c.param {
|
||||
some(p) { log "param: " + int::to_str(p, 10u); }
|
||||
_ { log "param: none"; }
|
||||
some(p) { log_full(core::debug, "param: " + int::to_str(p, 10u)); }
|
||||
_ { #debug("param: none"); }
|
||||
}
|
||||
for f: flag in c.flags {
|
||||
alt f {
|
||||
flag_left_justify. { log "flag: left justify"; }
|
||||
flag_left_zero_pad. { log "flag: left zero pad"; }
|
||||
flag_space_for_sign. { log "flag: left space pad"; }
|
||||
flag_sign_always. { log "flag: sign always"; }
|
||||
flag_alternate. { log "flag: alternate"; }
|
||||
flag_left_justify. { #debug("flag: left justify"); }
|
||||
flag_left_zero_pad. { #debug("flag: left zero pad"); }
|
||||
flag_space_for_sign. { #debug("flag: left space pad"); }
|
||||
flag_sign_always. { #debug("flag: sign always"); }
|
||||
flag_alternate. { #debug("flag: alternate"); }
|
||||
}
|
||||
}
|
||||
alt c.width {
|
||||
count_is(i) { log "width: count is " + int::to_str(i, 10u); }
|
||||
count_is(i) { log_full(core::debug,
|
||||
"width: count is " + int::to_str(i, 10u)); }
|
||||
count_is_param(i) {
|
||||
log "width: count is param " + int::to_str(i, 10u);
|
||||
log_full(core::debug,
|
||||
"width: count is param " + int::to_str(i, 10u));
|
||||
}
|
||||
count_is_next_param. { log "width: count is next param"; }
|
||||
count_implied. { log "width: count is implied"; }
|
||||
count_is_next_param. { #debug("width: count is next param"); }
|
||||
count_implied. { #debug("width: count is implied"); }
|
||||
}
|
||||
alt c.precision {
|
||||
count_is(i) { log "prec: count is " + int::to_str(i, 10u); }
|
||||
count_is(i) { log_full(core::debug,
|
||||
"prec: count is " + int::to_str(i, 10u)); }
|
||||
count_is_param(i) {
|
||||
log "prec: count is param " + int::to_str(i, 10u);
|
||||
log_full(core::debug,
|
||||
"prec: count is param " + int::to_str(i, 10u));
|
||||
}
|
||||
count_is_next_param. { log "prec: count is next param"; }
|
||||
count_implied. { log "prec: count is implied"; }
|
||||
count_is_next_param. { #debug("prec: count is next param"); }
|
||||
count_implied. { #debug("prec: count is implied"); }
|
||||
}
|
||||
alt c.ty {
|
||||
ty_bool. { log "type: bool"; }
|
||||
ty_str. { log "type: str"; }
|
||||
ty_char. { log "type: char"; }
|
||||
ty_bool. { #debug("type: bool"); }
|
||||
ty_str. { #debug("type: str"); }
|
||||
ty_char. { #debug("type: char"); }
|
||||
ty_int(s) {
|
||||
alt s {
|
||||
signed. { log "type: signed"; }
|
||||
unsigned. { log "type: unsigned"; }
|
||||
signed. { #debug("type: signed"); }
|
||||
unsigned. { #debug("type: unsigned"); }
|
||||
}
|
||||
}
|
||||
ty_bits. { log "type: bits"; }
|
||||
ty_bits. { #debug("type: bits"); }
|
||||
ty_hex(cs) {
|
||||
alt cs {
|
||||
case_upper. { log "type: uhex"; }
|
||||
case_lower. { log "type: lhex"; }
|
||||
case_upper. { #debug("type: uhex"); }
|
||||
case_lower. { #debug("type: lhex"); }
|
||||
}
|
||||
}
|
||||
ty_octal. { log "type: octal"; }
|
||||
ty_float. { log "type: float"; }
|
||||
ty_octal. { #debug("type: octal"); }
|
||||
ty_float. { #debug("type: float"); }
|
||||
}
|
||||
}
|
||||
let fmt_sp = args[0].span;
|
||||
@ -318,7 +322,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr])
|
||||
"not enough arguments to #fmt " +
|
||||
"for the given format string");
|
||||
}
|
||||
log "Building conversion:";
|
||||
#debug("Building conversion:");
|
||||
log_conv(conv);
|
||||
let arg_expr = args[n];
|
||||
let c_expr = make_new_conv(cx, fmt_sp, conv, arg_expr);
|
||||
|
@ -29,7 +29,7 @@ fn eval_crate_directives(cx: ctx, cdirs: [@ast::crate_directive], prefix: str,
|
||||
fn eval_crate_directives_to_mod(cx: ctx, cdirs: [@ast::crate_directive],
|
||||
prefix: str, suffix: option::t<str>)
|
||||
-> (ast::_mod, [ast::attribute]) {
|
||||
log #fmt("eval crate prefix: %s", prefix);
|
||||
#debug("eval crate prefix: %s", prefix);
|
||||
log #fmt("eval crate suffix: %s",
|
||||
option::from_maybe("none", suffix));
|
||||
let (cview_items, citems, cattrs)
|
||||
@ -72,9 +72,9 @@ fn parse_companion_mod(cx: ctx, prefix: str, suffix: option::t<str>)
|
||||
}
|
||||
|
||||
let modpath = companion_file(prefix, suffix);
|
||||
log #fmt("looking for companion mod %s", modpath);
|
||||
#debug("looking for companion mod %s", modpath);
|
||||
if file_exists(modpath) {
|
||||
log "found companion mod";
|
||||
#debug("found companion mod");
|
||||
let p0 = new_parser_from_file(cx.sess, cx.cfg, modpath,
|
||||
cx.chpos, cx.byte_pos, SOURCE_FILE);
|
||||
let inner_attrs = parse_inner_attrs_and_next(p0);
|
||||
|
@ -560,7 +560,7 @@ fn consume_non_eol_whitespace(rdr: reader) {
|
||||
}
|
||||
|
||||
fn push_blank_line_comment(rdr: reader, &comments: [cmnt]) {
|
||||
log ">>> blank-line comment";
|
||||
#debug(">>> blank-line comment");
|
||||
let v: [str] = [];
|
||||
comments += [{style: blank_line, lines: v, pos: rdr.get_chpos()}];
|
||||
}
|
||||
@ -575,16 +575,16 @@ fn consume_whitespace_counting_blank_lines(rdr: reader, &comments: [cmnt]) {
|
||||
}
|
||||
|
||||
fn read_line_comments(rdr: reader, code_to_the_left: bool) -> cmnt {
|
||||
log ">>> line comments";
|
||||
#debug(">>> line comments");
|
||||
let p = rdr.get_chpos();
|
||||
let lines: [str] = [];
|
||||
while rdr.curr() == '/' && rdr.next() == '/' {
|
||||
let line = read_one_line_comment(rdr);
|
||||
log line;
|
||||
log_full(core::debug, line);
|
||||
lines += [line];
|
||||
consume_non_eol_whitespace(rdr);
|
||||
}
|
||||
log "<<< line comments";
|
||||
#debug("<<< line comments");
|
||||
ret {style: if code_to_the_left { trailing } else { isolated },
|
||||
lines: lines,
|
||||
pos: p};
|
||||
@ -603,12 +603,12 @@ fn trim_whitespace_prefix_and_push_line(&lines: [str], s: str, col: uint) {
|
||||
s1 = str::slice(s, col, str::byte_len(s));
|
||||
} else { s1 = ""; }
|
||||
} else { s1 = s; }
|
||||
log "pushing line: " + s1;
|
||||
log_full(core::debug, "pushing line: " + s1);
|
||||
lines += [s1];
|
||||
}
|
||||
|
||||
fn read_block_comment(rdr: reader, code_to_the_left: bool) -> cmnt {
|
||||
log ">>> block comment";
|
||||
#debug(">>> block comment");
|
||||
let p = rdr.get_chpos();
|
||||
let lines: [str] = [];
|
||||
let col: uint = rdr.get_col();
|
||||
@ -617,7 +617,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];
|
||||
#debug("=== 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);
|
||||
@ -648,7 +648,7 @@ fn read_block_comment(rdr: reader, code_to_the_left: bool) -> cmnt {
|
||||
if !rdr.is_eof() && rdr.curr() != '\n' && vec::len(lines) == 1u {
|
||||
style = mixed;
|
||||
}
|
||||
log "<<< block comment";
|
||||
#debug("<<< block comment");
|
||||
ret {style: style, lines: lines, pos: p};
|
||||
}
|
||||
|
||||
@ -658,13 +658,13 @@ fn peeking_at_comment(rdr: reader) -> bool {
|
||||
}
|
||||
|
||||
fn consume_comment(rdr: reader, code_to_the_left: bool, &comments: [cmnt]) {
|
||||
log ">>> consume comment";
|
||||
#debug(">>> consume comment");
|
||||
if rdr.curr() == '/' && rdr.next() == '/' {
|
||||
comments += [read_line_comments(rdr, code_to_the_left)];
|
||||
} else if rdr.curr() == '/' && rdr.next() == '*' {
|
||||
comments += [read_block_comment(rdr, code_to_the_left)];
|
||||
} else { fail; }
|
||||
log "<<< consume comment";
|
||||
#debug("<<< consume comment");
|
||||
}
|
||||
|
||||
fn is_lit(t: token::token) -> bool {
|
||||
@ -707,7 +707,7 @@ fn gather_comments_and_literals(cm: codemap::codemap, path: str,
|
||||
if is_lit(tok.tok) {
|
||||
literals += [{lit: rdr.get_str_from(tok.bpos), pos: tok.chpos}];
|
||||
}
|
||||
log "tok: " + token::to_str(rdr, tok.tok);
|
||||
log_full(core::debug, "tok: " + token::to_str(rdr, tok.tok));
|
||||
first_read = false;
|
||||
}
|
||||
ret {cmnts: comments, lits: literals};
|
||||
|
@ -101,7 +101,7 @@ fn mk_printer(out: io::writer, linewidth: uint) -> printer {
|
||||
// fall behind.
|
||||
|
||||
let n: uint = 3u * linewidth;
|
||||
log #fmt["mk_printer %u", linewidth];
|
||||
#debug("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);
|
||||
@ -241,7 +241,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];
|
||||
#debug("pp [%u,%u]", left, right);
|
||||
alt t {
|
||||
EOF. {
|
||||
if !scan_stack_empty {
|
||||
@ -257,17 +257,17 @@ obj printer(out: io::writer,
|
||||
left = 0u;
|
||||
right = 0u;
|
||||
} else { self.advance_right(); }
|
||||
log #fmt["pp BEGIN/buffer [%u,%u]", left, right];
|
||||
#debug("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];
|
||||
#debug("pp END/print [%u,%u]", left, right);
|
||||
self.print(t, 0);
|
||||
} else {
|
||||
log #fmt["pp END/buffer [%u,%u]", left, right];
|
||||
#debug("pp END/buffer [%u,%u]", left, right);
|
||||
self.advance_right();
|
||||
token[right] = t;
|
||||
size[right] = -1;
|
||||
@ -281,7 +281,7 @@ obj printer(out: io::writer,
|
||||
left = 0u;
|
||||
right = 0u;
|
||||
} else { self.advance_right(); }
|
||||
log #fmt["pp BREAK/buffer [%u,%u]", left, right];
|
||||
#debug("pp BREAK/buffer [%u,%u]", left, right);
|
||||
self.check_stack(0);
|
||||
self.scan_push(right);
|
||||
token[right] = t;
|
||||
@ -290,10 +290,10 @@ obj printer(out: io::writer,
|
||||
}
|
||||
STRING(s, len) {
|
||||
if scan_stack_empty {
|
||||
log #fmt["pp STRING/print [%u,%u]", left, right];
|
||||
#debug("pp STRING/print [%u,%u]", left, right);
|
||||
self.print(t, len);
|
||||
} else {
|
||||
log #fmt["pp STRING/buffer [%u,%u]", left, right];
|
||||
#debug("pp STRING/buffer [%u,%u]", left, right);
|
||||
self.advance_right();
|
||||
token[right] = t;
|
||||
size[right] = len;
|
||||
@ -311,7 +311,7 @@ obj printer(out: io::writer,
|
||||
right_total - left_total, space];
|
||||
if !scan_stack_empty {
|
||||
if left == scan_stack[bottom] {
|
||||
log #fmt["setting %u to infinity and popping", left];
|
||||
#debug("setting %u to infinity and popping", left);
|
||||
size[self.scan_pop_bottom()] = size_infinity;
|
||||
}
|
||||
}
|
||||
@ -320,7 +320,7 @@ obj printer(out: io::writer,
|
||||
}
|
||||
}
|
||||
fn scan_push(x: uint) {
|
||||
log #fmt["scan_push %u", x];
|
||||
#debug("scan_push %u", x);
|
||||
if scan_stack_empty {
|
||||
scan_stack_empty = false;
|
||||
} else { top += 1u; top %= buf_len; assert (top != bottom); }
|
||||
@ -349,7 +349,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];
|
||||
#debug("advnce_left [%u,%u], sizeof(%u)=%d", left, right, left, L);
|
||||
if L >= 0 {
|
||||
self.print(x, L);
|
||||
alt x {
|
||||
@ -388,13 +388,13 @@ obj printer(out: io::writer,
|
||||
}
|
||||
}
|
||||
fn print_newline(amount: int) {
|
||||
log #fmt["NEWLINE %d", amount];
|
||||
#debug("NEWLINE %d", amount);
|
||||
out.write_str("\n");
|
||||
pending_indentation = 0;
|
||||
self.indent(amount);
|
||||
}
|
||||
fn indent(amount: int) {
|
||||
log #fmt["INDENT %d", amount];
|
||||
#debug("INDENT %d", amount);
|
||||
pending_indentation += amount;
|
||||
}
|
||||
fn top() -> print_stack_elt {
|
||||
@ -413,20 +413,20 @@ obj printer(out: io::writer,
|
||||
fn print(x: token, L: int) {
|
||||
log #fmt["print %s %d (remaining line space=%d)", tok_str(x), L,
|
||||
space];
|
||||
log buf_str(token, size, left, right, 6u);
|
||||
log_full(core::debug, 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];
|
||||
#debug("print BEGIN -> push broken block at col %d", col);
|
||||
print_stack += [{offset: col, pbreak: broken(b.breaks)}];
|
||||
} else {
|
||||
log "print BEGIN -> push fitting block";
|
||||
#debug("print BEGIN -> push fitting block");
|
||||
print_stack += [{offset: 0, pbreak: fits}];
|
||||
}
|
||||
}
|
||||
END. {
|
||||
log "print END -> pop END";
|
||||
#debug("print END -> pop END");
|
||||
assert (vec::len(print_stack) != 0u);
|
||||
vec::pop(print_stack);
|
||||
}
|
||||
@ -434,22 +434,22 @@ obj printer(out: io::writer,
|
||||
let top = self.top();
|
||||
alt top.pbreak {
|
||||
fits. {
|
||||
log "print BREAK in fitting block";
|
||||
#debug("print BREAK in fitting block");
|
||||
space -= b.blank_space;
|
||||
self.indent(b.blank_space);
|
||||
}
|
||||
broken(consistent.) {
|
||||
log "print BREAK in consistent block";
|
||||
#debug("print BREAK in consistent block");
|
||||
self.print_newline(top.offset + b.offset);
|
||||
space = margin - (top.offset + b.offset);
|
||||
}
|
||||
broken(inconsistent.) {
|
||||
if L > space {
|
||||
log "print BREAK w/ newline in inconsistent";
|
||||
#debug("print BREAK w/ newline in inconsistent");
|
||||
self.print_newline(top.offset + b.offset);
|
||||
space = margin - (top.offset + b.offset);
|
||||
} else {
|
||||
log "print BREAK w/o newline in inconsistent";
|
||||
#debug("print BREAK w/o newline in inconsistent");
|
||||
self.indent(b.blank_space);
|
||||
space -= b.blank_space;
|
||||
}
|
||||
@ -457,7 +457,7 @@ obj printer(out: io::writer,
|
||||
}
|
||||
}
|
||||
STRING(s, len) {
|
||||
log "print STRING";
|
||||
#debug("print STRING");
|
||||
assert (L == len);
|
||||
// assert L <= space;
|
||||
|
||||
|
@ -35,31 +35,49 @@ fn field_exprs(fields: [ast::field]) -> [@ast::expr] {
|
||||
ret es;
|
||||
}
|
||||
|
||||
fn log_expr(e: ast::expr) { log print::pprust::expr_to_str(@e); }
|
||||
fn log_expr(e: ast::expr) {
|
||||
log_full(core::debug, print::pprust::expr_to_str(@e));
|
||||
}
|
||||
|
||||
fn log_expr_err(e: ast::expr) { log_err print::pprust::expr_to_str(@e); }
|
||||
fn log_expr_err(e: ast::expr) {
|
||||
log_full(core::error, print::pprust::expr_to_str(@e));
|
||||
}
|
||||
|
||||
fn log_ty_err(t: @ty) { log_err print::pprust::ty_to_str(t); }
|
||||
fn log_ty_err(t: @ty) {
|
||||
log_full(core::error, print::pprust::ty_to_str(t));
|
||||
}
|
||||
|
||||
fn log_pat_err(p: @pat) { log_err print::pprust::pat_to_str(p); }
|
||||
fn log_pat_err(p: @pat) {
|
||||
log_full(core::error, print::pprust::pat_to_str(p));
|
||||
}
|
||||
|
||||
fn log_block(b: ast::blk) { log print::pprust::block_to_str(b); }
|
||||
fn log_block(b: ast::blk) {
|
||||
log_full(core::debug, print::pprust::block_to_str(b));
|
||||
}
|
||||
|
||||
fn log_block_err(b: ast::blk) { log_err print::pprust::block_to_str(b); }
|
||||
fn log_block_err(b: ast::blk) {
|
||||
log_full(core::error, print::pprust::block_to_str(b));
|
||||
}
|
||||
|
||||
fn log_item_err(i: @ast::item) { log_err print::pprust::item_to_str(i); }
|
||||
fn log_item_err(i: @ast::item) {
|
||||
log_full(core::error, print::pprust::item_to_str(i));
|
||||
}
|
||||
|
||||
fn log_fn(f: ast::_fn, name: ast::ident, params: [ast::ty_param]) {
|
||||
log print::pprust::fun_to_str(f, name, params);
|
||||
log_full(core::debug, print::pprust::fun_to_str(f, name, params));
|
||||
}
|
||||
|
||||
fn log_fn_err(f: ast::_fn, name: ast::ident, params: [ast::ty_param]) {
|
||||
log_err print::pprust::fun_to_str(f, name, params);
|
||||
log_full(core::error, print::pprust::fun_to_str(f, name, params));
|
||||
}
|
||||
|
||||
fn log_stmt(st: ast::stmt) { log print::pprust::stmt_to_str(st); }
|
||||
fn log_stmt(st: ast::stmt) {
|
||||
log_full(core::debug, print::pprust::stmt_to_str(st));
|
||||
}
|
||||
|
||||
fn log_stmt_err(st: ast::stmt) { log_err print::pprust::stmt_to_str(st); }
|
||||
fn log_stmt_err(st: ast::stmt) {
|
||||
log_full(core::error, print::pprust::stmt_to_str(st));
|
||||
}
|
||||
|
||||
fn has_nonlocal_exits(b: ast::blk) -> bool {
|
||||
let has_exits = @mutable false;
|
||||
|
@ -50,22 +50,22 @@ fn mk_filesearch(maybe_sysroot: option::t<fs::path>,
|
||||
}
|
||||
|
||||
let sysroot = get_sysroot(maybe_sysroot);
|
||||
log #fmt("using sysroot = %s", sysroot);
|
||||
#debug("using sysroot = %s", sysroot);
|
||||
ret filesearch_impl(sysroot, addl_lib_search_paths, target_triple);
|
||||
}
|
||||
|
||||
// FIXME #1001: This can't be an obj method
|
||||
fn search<copy T>(filesearch: filesearch, pick: pick<T>) -> option::t<T> {
|
||||
for lib_search_path in filesearch.lib_search_paths() {
|
||||
log #fmt["searching %s", lib_search_path];
|
||||
#debug("searching %s", lib_search_path);
|
||||
for path in fs::list_dir(lib_search_path) {
|
||||
log #fmt["testing %s", path];
|
||||
#debug("testing %s", path);
|
||||
let maybe_picked = pick(path);
|
||||
if option::is_some(maybe_picked) {
|
||||
log #fmt("picked %s", path);
|
||||
#debug("picked %s", path);
|
||||
ret maybe_picked;
|
||||
} else {
|
||||
log #fmt("rejected %s", path);
|
||||
#debug("rejected %s", path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -135,12 +135,12 @@ type tests_and_conv_fn = {
|
||||
};
|
||||
|
||||
fn make_tests(cx: cx) -> tests_and_conv_fn {
|
||||
log #fmt["making tests from %s", cx.config.src_base];
|
||||
#debug("making tests from %s", cx.config.src_base);
|
||||
let configport = port::<[u8]>();
|
||||
let tests = [];
|
||||
for file: str in fs::list_dir(cx.config.src_base) {
|
||||
let file = file;
|
||||
log #fmt["inspecting file %s", file];
|
||||
#debug("inspecting file %s", file);
|
||||
if is_test(cx.config, file) {
|
||||
tests += [make_test(cx, file, configport)];
|
||||
}
|
||||
|
@ -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 #fmt["running %s", testfile];
|
||||
#debug("running %s", testfile);
|
||||
let props = load_props(testfile);
|
||||
alt cx.config.mode {
|
||||
mode_compile_fail. { run_cfail_test(cx, props, testfile); }
|
||||
@ -194,10 +194,10 @@ fn check_error_patterns(props: test_props, testfile: str, procres: procres) {
|
||||
let next_err_pat = props.error_patterns[next_err_idx];
|
||||
for line: str in str::split(procres.stdout, '\n' as u8) {
|
||||
if str::find(line, next_err_pat) > 0 {
|
||||
log #fmt["found error pattern %s", next_err_pat];
|
||||
#debug("found error pattern %s", next_err_pat);
|
||||
next_err_idx += 1u;
|
||||
if next_err_idx == vec::len(props.error_patterns) {
|
||||
log "found all error patterns";
|
||||
#debug("found all error patterns");
|
||||
ret;
|
||||
}
|
||||
next_err_pat = props.error_patterns[next_err_idx];
|
||||
|
@ -33,6 +33,6 @@ fn path_div() -> str { ":" }
|
||||
fn path_div() -> str { ";" }
|
||||
|
||||
fn logv(config: config, s: str) {
|
||||
log s;
|
||||
log_full(core::debug, s);
|
||||
if config.verbose { io::stdout().write_line(s); }
|
||||
}
|
||||
|
@ -23,5 +23,5 @@ fn main() {
|
||||
assert (!vec_equal([5, 5], [4, 5], builtin_equal));
|
||||
assert (vec_equal([5, 5], [5, 5], builtin_equal));
|
||||
|
||||
log_err "Pass";
|
||||
#error("Pass");
|
||||
}
|
||||
|
@ -236,15 +236,15 @@ fn check_variants_T<copy T>(
|
||||
replacer: fn(ast::crate, uint, T, test_mode) -> ast::crate,
|
||||
cx: context
|
||||
) {
|
||||
log_err #fmt("%s contains %u %s objects", filename, vec::len(things), thing_label);
|
||||
#error("%s contains %u %s objects", filename, vec::len(things), thing_label);
|
||||
|
||||
let L = vec::len(things);
|
||||
|
||||
if L < 100u {
|
||||
under(float::min(L, 20u)) {|i|
|
||||
log_err "Replacing... #" + uint::str(i);
|
||||
log_full(core::error, "Replacing... #" + uint::str(i));
|
||||
under(float::min(L, 30u)) {|j|
|
||||
log_err "With... " + stringifier(@things[j]);
|
||||
log_full(core::error, "With... " + stringifier(@things[j]));
|
||||
let crate2 = @replacer(crate, i, things[j], cx.mode);
|
||||
// It would be best to test the *crate* for stability, but testing the
|
||||
// string for stability is easier and ok for now.
|
||||
@ -298,8 +298,8 @@ fn check_whole_compiler(code: str, suggested_filename_prefix: str, allow_running
|
||||
removeDirIfExists(suggested_filename_prefix + ".dSYM");
|
||||
}
|
||||
failed(s) {
|
||||
log_err "check_whole_compiler failure: " + s;
|
||||
log_err "Saved as: " + filename;
|
||||
log_full(core::error, "check_whole_compiler failure: " + s);
|
||||
log_full(core::error, "Saved as: " + filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -320,7 +320,7 @@ fn check_running(exe_filename: str) -> happiness {
|
||||
let p = std::run::program_output("/Users/jruderman/scripts/timed_run_rust_program.py", [exe_filename]);
|
||||
let comb = p.out + "\n" + p.err;
|
||||
if str::byte_len(comb) > 1u {
|
||||
log_err "comb comb comb: " + comb;
|
||||
log_full(core::error, "comb comb comb: " + comb);
|
||||
}
|
||||
|
||||
if contains(comb, "Assertion failed: (0), function alloc, file ../src/rt/rust_obstack.cpp") {
|
||||
@ -358,7 +358,7 @@ fn check_compiling(filename: str) -> happiness {
|
||||
|
||||
let p = std::run::program_output("bash", ["-c", "DYLD_LIBRARY_PATH=/Users/jruderman/code/rust/build/stage0/lib:/Users/jruderman/code/rust/build/rustllvm/ /Users/jruderman/code/rust/build/stage1/rustc " + filename]);
|
||||
|
||||
//log_err #fmt("Status: %d", p.status);
|
||||
//#error("Status: %d", p.status);
|
||||
if p.err != "" {
|
||||
if contains(p.err, "Ptr must be a pointer to Val type") {
|
||||
known_bug("https://github.com/graydon/rust/issues/897")
|
||||
@ -369,7 +369,7 @@ fn check_compiling(filename: str) -> happiness {
|
||||
} else if contains(p.err, "cast<Ty>() argument of incompatible type!") {
|
||||
known_bug("https://github.com/graydon/rust/issues/973")
|
||||
} else {
|
||||
log_err "Stderr: " + p.err;
|
||||
log_full(core::error, "Stderr: " + p.err);
|
||||
failed("Unfamiliar error message")
|
||||
}
|
||||
} else if p.status == 0 {
|
||||
@ -382,7 +382,7 @@ fn check_compiling(filename: str) -> happiness {
|
||||
} else if contains(p.out, "trans_rec expected a rec but found _|_") {
|
||||
known_bug("https://github.com/graydon/rust/issues/924")
|
||||
} else if contains(p.out, "Assertion") && contains(p.out, "failed") {
|
||||
log_err "Stdout: " + p.out;
|
||||
log_full(core::error, "Stdout: " + p.out);
|
||||
failed("Looks like an llvm assertion failure")
|
||||
|
||||
} else if contains(p.out, "internal compiler error fail called with unsupported type _|_") {
|
||||
@ -396,14 +396,14 @@ fn check_compiling(filename: str) -> happiness {
|
||||
} else if contains(p.out, "internal compiler error unimplemented") {
|
||||
known_bug("Something unimplemented")
|
||||
} else if contains(p.out, "internal compiler error") {
|
||||
log_err "Stdout: " + p.out;
|
||||
log_full(core::error, "Stdout: " + p.out);
|
||||
failed("internal compiler error")
|
||||
|
||||
} else if contains(p.out, "error:") {
|
||||
cleanly_rejected("rejected with span_error")
|
||||
} else {
|
||||
log_err p.status;
|
||||
log_err "!Stdout: " + p.out;
|
||||
log_full(core::error, p.status);
|
||||
log_full(core::error, "!Stdout: " + p.out);
|
||||
failed("What happened?")
|
||||
}
|
||||
}
|
||||
@ -500,9 +500,9 @@ fn check_roundtrip_convergence(code: str, maxIters: uint) {
|
||||
}
|
||||
|
||||
if old == new {
|
||||
log_err #fmt["Converged after %u iterations", i];
|
||||
#error("Converged after %u iterations", i);
|
||||
} else {
|
||||
log_err #fmt["Did not converge after %u iterations!", i];
|
||||
#error("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",
|
||||
@ -513,12 +513,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)];
|
||||
#error("pp convergence tests: %u files", vec::len(files));
|
||||
for file in files {
|
||||
if !file_might_not_converge(file) {
|
||||
let s = result::get(io::read_whole_file_str(file));
|
||||
if !content_might_not_converge(s) {
|
||||
log_err #fmt["pp converge: %s", file];
|
||||
#error("pp converge: %s", file);
|
||||
// Change from 7u to 2u once https://github.com/graydon/rust/issues/850 is fixed
|
||||
check_roundtrip_convergence(s, 7u);
|
||||
}
|
||||
@ -543,7 +543,7 @@ fn check_variants(files: [str], cx: context) {
|
||||
cont;
|
||||
}
|
||||
|
||||
log_err "check_variants: " + file;
|
||||
log_full(core::error, "check_variants: " + file);
|
||||
let sess = @{cm: codemap::new_codemap(), mutable next_id: 0};
|
||||
let crate =
|
||||
parser::parse_crate_from_source_str(
|
||||
@ -559,7 +559,7 @@ fn check_variants(files: [str], cx: context) {
|
||||
|
||||
fn main(args: [str]) {
|
||||
if vec::len(args) != 2u {
|
||||
log_err #fmt["usage: %s <testdir>", args[0]];
|
||||
#error("usage: %s <testdir>", args[0]);
|
||||
ret;
|
||||
}
|
||||
let files = [];
|
||||
@ -570,7 +570,7 @@ fn main(args: [str]) {
|
||||
check_variants(files, { mode: tm_converge });
|
||||
check_variants(files, { mode: tm_run });
|
||||
|
||||
log_err "Fuzzer done";
|
||||
#error("Fuzzer done");
|
||||
}
|
||||
|
||||
// Local Variables:
|
||||
|
@ -91,9 +91,9 @@ fn vec_to_str(v: [int]) -> str {
|
||||
}
|
||||
|
||||
fn show_edits(a: [int], xs: [int]) {
|
||||
log_err "=== Edits of " + vec_to_str(a) + " ===";
|
||||
log_full(core::error, "=== Edits of " + vec_to_str(a) + " ===");
|
||||
let b = vec_edits(a, xs);
|
||||
ix(0u, 1u, len(b)) {|i| log_err vec_to_str(b[i]); }
|
||||
ix(0u, 1u, len(b)) {|i| log_full(core::error, vec_to_str(b[i])); }
|
||||
}
|
||||
|
||||
fn demo_edits() {
|
||||
|
@ -69,13 +69,13 @@ fn main()
|
||||
{
|
||||
let r = rand::mk_rng();
|
||||
|
||||
log_err under(r, 5u);
|
||||
log_err choice(r, [10, 20, 30]);
|
||||
log_err if unlikely(r, 5u) { "unlikely" } else { "likely" };
|
||||
log_full(core::error, under(r, 5u));
|
||||
log_full(core::error, choice(r, [10, 20, 30]));
|
||||
log_full(core::error, if unlikely(r, 5u) { "unlikely" } else { "likely" });
|
||||
|
||||
let a = [mutable 1, 2, 3];
|
||||
shuffle(r, a);
|
||||
log_err a;
|
||||
log_full(core::error, a);
|
||||
|
||||
let i = 0u;
|
||||
let v = [
|
||||
@ -86,8 +86,8 @@ fn main()
|
||||
let w = weighted_vec(v);
|
||||
|
||||
while i < 1000u {
|
||||
log_err "Immed: " + weighted_choice(r, v);
|
||||
log_err "Fast: " + choice(r, w);
|
||||
log_full(core::error, "Immed: " + weighted_choice(r, v));
|
||||
log_full(core::error, "Fast: " + choice(r, w));
|
||||
i += 1u;
|
||||
}
|
||||
}
|
||||
|
@ -16,3 +16,13 @@ const error : u32 = 0_u32;
|
||||
const warn : u32 = 1_u32;
|
||||
const info : u32 = 2_u32;
|
||||
const debug : u32 = 3_u32;
|
||||
|
||||
// A curious inner-module that's not exported that contains the binding
|
||||
// 'core' so that macro-expanded references to core::error and such
|
||||
// can be resolved within libcore.
|
||||
mod core {
|
||||
const error : u32 = 0_u32;
|
||||
const warn : u32 = 1_u32;
|
||||
const info : u32 = 2_u32;
|
||||
const debug : u32 = 3_u32;
|
||||
}
|
@ -19,7 +19,7 @@ combinations at the moment.
|
||||
|
||||
Example:
|
||||
|
||||
log #fmt("hello, %s!", "world");
|
||||
#debug("hello, %s!", "world");
|
||||
|
||||
*/
|
||||
|
||||
|
@ -105,7 +105,7 @@ buf must not be empty
|
||||
*/
|
||||
fn parse_buf(buf: [u8], radix: uint) -> int {
|
||||
if vec::len::<u8>(buf) == 0u {
|
||||
log_err "parse_buf(): buf is empty";
|
||||
#error("parse_buf(): buf is empty");
|
||||
fail;
|
||||
}
|
||||
let i = vec::len::<u8>(buf) - 1u;
|
||||
|
@ -287,7 +287,7 @@ Example:
|
||||
> let i = 0;
|
||||
> while i < len(s) {
|
||||
> let {ch, next} = char_range_at(s, i);
|
||||
> log ch;
|
||||
> log_full(core::debug, ch);
|
||||
> i = next;
|
||||
> }
|
||||
|
||||
|
@ -22,7 +22,7 @@ Tasks may execute in parallel and are scheduled automatically by the runtime.
|
||||
Example:
|
||||
|
||||
> spawn("Hello, World", fn (&&msg: str) {
|
||||
> log msg;
|
||||
> log_full(core::debug, msg);
|
||||
> });
|
||||
|
||||
*/
|
||||
@ -145,7 +145,7 @@ fn sleep(time_in_us: uint) {
|
||||
let killed = false;
|
||||
// FIXME: uncomment this when extfmt is moved to core
|
||||
// in a snapshot.
|
||||
// log #fmt("yielding for %u us", time_in_us);
|
||||
// #debug("yielding for %u us", time_in_us);
|
||||
rusti::task_sleep(task, time_in_us, killed);
|
||||
if killed {
|
||||
fail "killed";
|
||||
|
@ -71,7 +71,7 @@ Parse a string as an unsigned integer.
|
||||
*/
|
||||
fn from_str(buf: str, radix: u64) -> u64 {
|
||||
if str::byte_len(buf) == 0u {
|
||||
log_err "parse_buf(): buf is empty";
|
||||
#error("parse_buf(): buf is empty");
|
||||
fail;
|
||||
}
|
||||
let i = str::byte_len(buf) - 1u;
|
||||
|
@ -167,7 +167,7 @@ buf must not be empty
|
||||
*/
|
||||
fn parse_buf(buf: [u8], radix: uint) -> uint {
|
||||
if vec::len::<u8>(buf) == 0u {
|
||||
log_err "parse_buf(): buf is empty";
|
||||
#error("parse_buf(): buf is empty");
|
||||
fail;
|
||||
}
|
||||
let i = vec::len::<u8>(buf) - 1u;
|
||||
|
@ -36,7 +36,7 @@ fn vint_at(data: [u8], start: uint) -> {val: uint, next: uint} {
|
||||
(data[start + 2u] as uint) << 8u |
|
||||
(data[start + 3u] as uint),
|
||||
next: start + 4u};
|
||||
} else { log_err "vint too big"; fail; }
|
||||
} else { #error("vint too big"); fail; }
|
||||
}
|
||||
|
||||
fn new_doc(data: @[u8]) -> doc {
|
||||
@ -67,7 +67,7 @@ fn get_doc(d: doc, tg: uint) -> doc {
|
||||
alt maybe_get_doc(d, tg) {
|
||||
some(d) { ret d; }
|
||||
none. {
|
||||
log_err "failed to find block with tag " + uint::to_str(tg, 10u);
|
||||
#error("failed to find block with tag %u", tg);
|
||||
fail;
|
||||
}
|
||||
}
|
||||
@ -133,7 +133,7 @@ fn write_sized_vint(w: io::buf_writer, n: uint, size: uint) {
|
||||
[0x10u8 | (n >> 24u as u8), n >> 16u & 0xffu as u8,
|
||||
n >> 8u & 0xffu as u8, n & 0xffu as u8];
|
||||
}
|
||||
_ { log_err "vint to write too big"; fail; }
|
||||
_ { #error("vint to write too big"); fail; }
|
||||
}
|
||||
w.write(buf);
|
||||
}
|
||||
@ -143,7 +143,7 @@ fn write_vint(w: io::buf_writer, n: uint) {
|
||||
if n < 0x4000u { write_sized_vint(w, n, 2u); ret; }
|
||||
if n < 0x200000u { write_sized_vint(w, n, 3u); ret; }
|
||||
if n < 0x10000000u { write_sized_vint(w, n, 4u); ret; }
|
||||
log_err "vint to write too big";
|
||||
#error("vint to write too big");
|
||||
fail;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ combinations at the moment.
|
||||
|
||||
Example:
|
||||
|
||||
log #fmt("hello, %s!", "world");
|
||||
#debug("hello, %s!", "world");
|
||||
|
||||
*/
|
||||
|
||||
|
@ -306,7 +306,7 @@ fn getopts(args: [str], opts: [opt]) -> result {
|
||||
fn opt_vals(m: match, nm: str) -> [optval] {
|
||||
ret alt find_opt(m.opts, mkname(nm)) {
|
||||
some(id) { m.vals[id] }
|
||||
none. { log_err "No option '" + nm + "' defined."; fail }
|
||||
none. { #error("No option '%s' defined", nm); fail }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -227,7 +227,7 @@ obj byte_buf_reader(bbuf: byte_buf) {
|
||||
bbuf.pos += 1u;
|
||||
ret b as int;
|
||||
}
|
||||
fn unread_byte(_byte: int) { log_err "TODO: unread_byte"; fail; }
|
||||
fn unread_byte(_byte: int) { #error("TODO: unread_byte"); fail; }
|
||||
fn eof() -> bool { ret bbuf.pos == vec::len::<u8>(bbuf.buf); }
|
||||
fn seek(offset: int, whence: seek_style) {
|
||||
let pos = bbuf.pos;
|
||||
@ -268,7 +268,7 @@ obj FILE_writer(f: os::libc::FILE, res: option::t<@FILE_res>) {
|
||||
let len = vec::len::<u8>(v);
|
||||
let vbuf = vec::unsafe::to_ptr::<u8>(v);
|
||||
let nout = os::libc::fwrite(vbuf, len, 1u, f);
|
||||
if nout < 1u { log_err "error dumping buffer"; }
|
||||
if nout < 1u { #error("error dumping buffer"); }
|
||||
}
|
||||
fn seek(offset: int, whence: seek_style) {
|
||||
assert (os::libc::fseek(f, offset, convert_whence(whence)) == 0i32);
|
||||
@ -291,19 +291,19 @@ obj fd_buf_writer(fd: fd_t, res: option::t<@fd_res>) {
|
||||
vbuf = ptr::offset(vec::unsafe::to_ptr::<u8>(v), count);
|
||||
let nout = os::libc::write(fd, vbuf, len);
|
||||
if nout < 0 {
|
||||
log_err "error dumping buffer";
|
||||
log_err sys::last_os_error();
|
||||
#error("error dumping buffer");
|
||||
log_full(core::error, sys::last_os_error());
|
||||
fail;
|
||||
}
|
||||
count += nout as uint;
|
||||
}
|
||||
}
|
||||
fn seek(_offset: int, _whence: seek_style) {
|
||||
log_err "need 64-bit native calls for seek, sorry";
|
||||
#error("need 64-bit native calls for seek, sorry");
|
||||
fail;
|
||||
}
|
||||
fn tell() -> uint {
|
||||
log_err "need 64-bit native calls for tell, sorry";
|
||||
#error("need 64-bit native calls for tell, sorry");
|
||||
fail;
|
||||
}
|
||||
|
||||
@ -334,7 +334,7 @@ fn file_buf_writer(path: str,
|
||||
os::libc_constants::S_IWUSR)
|
||||
});
|
||||
ret if fd < 0i32 {
|
||||
log_err sys::last_os_error();
|
||||
log_full(core::error, sys::last_os_error());
|
||||
result::err("error opening " + path)
|
||||
} else {
|
||||
result::ok(fd_buf_writer(fd, option::some(@fd_res(fd))))
|
||||
|
@ -56,7 +56,7 @@ If the key does not exist in the map
|
||||
*/
|
||||
fn get<copy T>(m: smallintmap<T>, key: uint) -> T {
|
||||
alt find(m, key) {
|
||||
none. { log_err "smallintmap::get(): key not present"; fail; }
|
||||
none. { #error("smallintmap::get(): key not present"); fail; }
|
||||
some(v) { ret v; }
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ fn run_tests<copy T>(opts: test_opts, tests: [test_desc<T>],
|
||||
// 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];
|
||||
#debug("using %u test tasks", concurrency);
|
||||
let total = vec::len(filtered_tests);
|
||||
let run_idx = 0u;
|
||||
let wait_idx = 0u;
|
||||
|
@ -111,7 +111,7 @@ fn unref(loop: *loop_t) {
|
||||
|
||||
fn sanity_check() {
|
||||
fn check_size(t: str, uv: ctypes::size_t, rust: ctypes::size_t) {
|
||||
log #fmt("size of %s: uv: %u, rust: %u", t, uv, rust);
|
||||
#debug("size of %s: uv: %u, rust: %u", t, uv, rust);
|
||||
assert uv == rust;
|
||||
}
|
||||
check_size("idle_t",
|
||||
|
@ -1,9 +1,16 @@
|
||||
S 2011-12-22 3b61064
|
||||
winnt-i386 800fdc0e15f6917ff4318812edac611ca0162b5e
|
||||
linux-i386 468d13787022414aeb7f8ca755a4559691728a49
|
||||
macos-i386 acaf9f2b0588993d50339905e3343226e464aace
|
||||
linux-x86_64 51af1a655a1552c4699fea6bf603326c1ba9f05c
|
||||
macos-x86_64 a898937ea8e36e271b5d2df4caa21ef5268de7d5
|
||||
|
||||
S 2011-12-19 edf6e1e
|
||||
winnt-i386 7a358117e123ad3d16fa66106819ec0daf5a6aba
|
||||
linux-i386 87b9a54e2e165b5c800236f49ee58522c8664226
|
||||
macos-i386 be1da455be1aad6305185d120dd3594413ae66de
|
||||
macos-x86_64 520f5af26e71a74d492d4d4d943974dd5404f798
|
||||
linux-x86_64 ef255409d0cc6079d0a13d5bb7d436832dd294bc
|
||||
macos-x86_64 520f5af26e71a74d492d4d4d943974dd5404f798
|
||||
|
||||
S 2011-12-14 5b35c9c
|
||||
winnt-i386 1ffa2c58ff2f35a058e3da755febb173917b95ff
|
||||
|
@ -47,10 +47,10 @@ fn ninetynine(it: block(int)) {
|
||||
|
||||
fn main() {
|
||||
ninetynine {|n|
|
||||
log sub(b1(), n);
|
||||
log sub(b2(), n - 1);
|
||||
log "";
|
||||
log_full(core::debug, sub(b1(), n));
|
||||
log_full(core::debug, sub(b2(), n - 1));
|
||||
#debug("");
|
||||
};
|
||||
log b7();
|
||||
log b8();
|
||||
log_full(core::debug, b7());
|
||||
log_full(core::debug, b8());
|
||||
}
|
||||
|
@ -19,21 +19,19 @@ fn show(b: bottle) {
|
||||
"99 bottles of beer on the wall.";
|
||||
}
|
||||
single. {
|
||||
log "1 bottle of beer on the wall, 1 bottle of beer,";
|
||||
#debug("1 bottle of beer on the wall, 1 bottle of beer,");
|
||||
log "Take one down and pass it around, " +
|
||||
"no more bottles of beer on the wall.";
|
||||
}
|
||||
dual. {
|
||||
log "2 bottles of beer on the wall, 2 bottles of beer,";
|
||||
#debug("2 bottles of beer on the wall, 2 bottles of beer,");
|
||||
log "Take one down and pass it around, " +
|
||||
"1 bottle of beer on the wall.";
|
||||
}
|
||||
multiple(n) {
|
||||
let nb: str = int::to_str(n, 10u);
|
||||
let mb: str = int::to_str(n - 1, 10u);
|
||||
log nb + " bottles of beer on the wall, " + nb + " bottles of beer,";
|
||||
log "Take one down and pass it around, " + mb +
|
||||
" bottles of beer on the wall.";
|
||||
#debug("%d bottles of beer on the wall, %d bottles of beer,", n, n);
|
||||
#debug("Take one down and pass it around, \
|
||||
%d bottles of beer on the wall.", n-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -55,5 +53,5 @@ fn more(b: bottle) -> bool { alt b { none. { ret false; } _ { ret true; } } }
|
||||
fn main() {
|
||||
let b: bottle = multiple(99);
|
||||
let running: bool = true;
|
||||
while running { show(b); log ""; running = more(b); b = next(b); }
|
||||
while running { show(b); #debug(""); running = more(b); b = next(b); }
|
||||
}
|
||||
|
@ -42,7 +42,11 @@ fn sub(t: str, n: int) -> str {
|
||||
/* Straightforward counter */
|
||||
fn main() {
|
||||
let n: int = 99;
|
||||
while n > 0 { log sub(b1(), n); log sub(b2(), n - 1); log ""; n -= 1; }
|
||||
log b7();
|
||||
log sub(b8(), 99);
|
||||
while n > 0 {
|
||||
log_full(core::debug, sub(b1(), n));
|
||||
log_full(core::debug, sub(b2(), n - 1));
|
||||
#debug(""); n -= 1;
|
||||
}
|
||||
log_full(core::debug, b7());
|
||||
log_full(core::debug, sub(b8(), 99));
|
||||
}
|
||||
|
@ -8,32 +8,32 @@ import str;
|
||||
|
||||
fn main() {
|
||||
fn multiple(n: int) {
|
||||
let nb: str = int::to_str(n, 10u);
|
||||
let mb: str = int::to_str(n - 1, 10u);
|
||||
log nb + " bottles of beer on the wall, " + nb + " bottles of beer,";
|
||||
log "Take one down and pass it around, " + mb +
|
||||
" bottles of beer on the wall.";
|
||||
log "";
|
||||
#debug("%d bottles of beer on the wall, %d bottles of beer,", n, n);
|
||||
#debug("Take one down and pass it around, %d \
|
||||
bottles of beer on the wall.", n-1);
|
||||
#debug("");
|
||||
if n > 3 { be multiple(n - 1); } else { be dual(); }
|
||||
}
|
||||
fn dual() {
|
||||
log "2 bottles of beer on the wall, 2 bottles of beer,";
|
||||
log "Take one down and pass it around, 1 bottle of beer on the wall.";
|
||||
log "";
|
||||
#debug("2 bottles of beer on the wall, 2 bottles of beer,");
|
||||
#debug("Take one down and pass it around, \
|
||||
1 bottle of beer on the wall.");
|
||||
#debug("");
|
||||
be single();
|
||||
}
|
||||
fn single() {
|
||||
log "1 bottle of beer on the wall, 1 bottle of beer,";
|
||||
#debug("1 bottle of beer on the wall, 1 bottle of beer,");
|
||||
log "Take one down and pass it around, " +
|
||||
"no more bottles of beer on the wall.";
|
||||
log "";
|
||||
#debug("");
|
||||
be none();
|
||||
}
|
||||
fn none() {
|
||||
log "No more bottles of beer on the wall, no more bottles of beer,";
|
||||
#debug("No more bottles of beer on the wall, \
|
||||
no more bottles of beer,");
|
||||
log "Go to the store and buy some more, " +
|
||||
"99 bottles of beer on the wall.";
|
||||
log "";
|
||||
#debug("");
|
||||
}
|
||||
multiple(99);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ fn fannkuch(n: int) -> int {
|
||||
|
||||
let go = true;
|
||||
while go {
|
||||
if r == n { log checksum; ret flips; }
|
||||
if r == n { log_full(core::debug, checksum); ret flips; }
|
||||
let p0 = perm1[0];
|
||||
i = 0;
|
||||
while i < r { let j = i + 1; perm1[i] = perm1[j]; i = j; }
|
||||
@ -58,5 +58,5 @@ fn fannkuch(n: int) -> int {
|
||||
|
||||
fn main(args: [str]) {
|
||||
let n = 7;
|
||||
log #fmt["Pfannkuchen(%d) = %d", n, fannkuch(n)];
|
||||
#debug("Pfannkuchen(%d) = %d", n, fannkuch(n));
|
||||
}
|
||||
|
@ -44,25 +44,31 @@ fn select_random(r: u32, genelist: [aminoacids]) -> char {
|
||||
}
|
||||
|
||||
fn make_random_fasta(id: str, desc: str, genelist: [aminoacids], n: int) {
|
||||
log ">" + id + " " + desc;
|
||||
log_full(core::debug, ">" + id + " " + desc);
|
||||
let rng = myrandom(std::rand::mk_rng().next());
|
||||
let op: str = "";
|
||||
uint::range(0u, n as uint) {|i|
|
||||
str::push_byte(op, select_random(rng.next(100u32), genelist) as u8);
|
||||
if str::byte_len(op) >= LINE_LENGTH() { log op; op = ""; }
|
||||
if str::byte_len(op) >= LINE_LENGTH() {
|
||||
log_full(core::debug, op);
|
||||
op = "";
|
||||
}
|
||||
}
|
||||
if str::byte_len(op) > 0u { log op; }
|
||||
if str::byte_len(op) > 0u { log_full(core::debug, op); }
|
||||
}
|
||||
|
||||
fn make_repeat_fasta(id: str, desc: str, s: str, n: int) {
|
||||
log ">" + id + " " + desc;
|
||||
log_full(core::debug, ">" + id + " " + desc);
|
||||
let op: str = "";
|
||||
let sl: uint = str::byte_len(s);
|
||||
uint::range(0u, n as uint) {|i|
|
||||
str::push_byte(op, s[i % sl]);
|
||||
if str::byte_len(op) >= LINE_LENGTH() { log op; op = ""; }
|
||||
if str::byte_len(op) >= LINE_LENGTH() {
|
||||
log_full(core::debug, op);
|
||||
op = "";
|
||||
}
|
||||
}
|
||||
if str::byte_len(op) > 0u { log op; }
|
||||
if str::byte_len(op) > 0u { log_full(core::debug, op); }
|
||||
}
|
||||
|
||||
fn acid(ch: char, prob: u32) -> aminoacids { ret {ch: ch, prob: prob}; }
|
||||
|
@ -14,6 +14,6 @@ fn fib(n: int) -> int {
|
||||
fn main() {
|
||||
assert (fib(8) == 21);
|
||||
assert (fib(15) == 610);
|
||||
log fib(8);
|
||||
log fib(15);
|
||||
log_full(core::debug, fib(8));
|
||||
log_full(core::debug, fib(15));
|
||||
}
|
||||
|
@ -20,11 +20,11 @@ fn main() {
|
||||
|
||||
|
||||
for n: int in inputs {
|
||||
log NBodySystem::energy(bodies);
|
||||
log_full(core::debug, NBodySystem::energy(bodies));
|
||||
|
||||
let i: int = 0;
|
||||
while i < n { NBodySystem::advance(bodies, 0.01); i += 1; }
|
||||
log NBodySystem::energy(bodies);
|
||||
log_full(core::debug, NBodySystem::energy(bodies));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,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];
|
||||
#error("%d: Completed %d iterations", id, i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ fn stress(num_tasks: int) {
|
||||
fn main(argv: [str]) {
|
||||
if vec::len(argv) == 1u {
|
||||
assert (fib(8) == 21);
|
||||
log fib(8);
|
||||
log_full(core::debug, fib(8));
|
||||
} else {
|
||||
// Interactive mode! Wooo!!!!
|
||||
let opts = parse_opts(argv);
|
||||
|
@ -88,7 +88,7 @@ mod map_reduce {
|
||||
send V>(-map: mapper<K1, K2, V>,
|
||||
-ctrl: chan<ctrl_proto<K2, V>>,
|
||||
-input: K1) {
|
||||
// log_err "map_task " + input;
|
||||
// log_full(core::error, "map_task " + input);
|
||||
let intermediates = treemap::init();
|
||||
|
||||
fn emit<send K2,
|
||||
@ -133,11 +133,11 @@ mod map_reduce {
|
||||
while !is_done || ref_count > 0 {
|
||||
alt recv(p) {
|
||||
emit_val(v) {
|
||||
// log_err #fmt("received %d", v);
|
||||
// #error("received %d", v);
|
||||
ret some(v);
|
||||
}
|
||||
done. {
|
||||
// log_err "all done";
|
||||
// #error("all done");
|
||||
is_done = true;
|
||||
}
|
||||
ref. { ref_count += 1; }
|
||||
@ -167,19 +167,20 @@ mod map_reduce {
|
||||
while num_mappers > 0 {
|
||||
alt recv(ctrl) {
|
||||
mapper_done. {
|
||||
// log_err "received mapper terminated.";
|
||||
// #error("received mapper terminated.");
|
||||
num_mappers -= 1;
|
||||
}
|
||||
find_reducer(k, cc) {
|
||||
let c;
|
||||
// log_err "finding reducer for " + k;
|
||||
// log_full(core::error, "finding reducer for " + k);
|
||||
alt treemap::find(reducers, k) {
|
||||
some(_c) {
|
||||
// log_err "reusing existing reducer for " + k;
|
||||
// log_full(core::error,
|
||||
// "reusing existing reducer for " + k);
|
||||
c = _c;
|
||||
}
|
||||
none. {
|
||||
// log_err "creating new reducer for " + k;
|
||||
// log_full(core::error, "creating new reducer for " + k);
|
||||
let p = port();
|
||||
let r = reduce, kk = k;
|
||||
tasks +=
|
||||
@ -228,7 +229,8 @@ fn main(argv: [str]) {
|
||||
let elapsed = stop - start;
|
||||
elapsed /= 1000000u64;
|
||||
|
||||
log_err "MapReduce completed in " + u64::str(elapsed) + "ms";
|
||||
log_full(core::error, "MapReduce completed in "
|
||||
+ u64::str(elapsed) + "ms");
|
||||
}
|
||||
|
||||
fn read_word(r: io::reader) -> option<str> {
|
||||
|
@ -78,7 +78,7 @@ mod map_reduce {
|
||||
|
||||
fn map_task(args: (chan<ctrl_proto>, str)) {
|
||||
let (ctrl, input) = args;
|
||||
// log_err "map_task " + input;
|
||||
// log_full(core::error, "map_task " + input);
|
||||
let intermediates = map::new_str_hash();
|
||||
|
||||
fn emit(im: map::hashmap<str, chan<reduce_proto>>,
|
||||
@ -120,11 +120,11 @@ mod map_reduce {
|
||||
while !state.is_done || state.ref_count > 0 {
|
||||
alt recv(p) {
|
||||
emit_val(v) {
|
||||
// log_err #fmt("received %d", v);
|
||||
// #error("received %d", v);
|
||||
ret some(v);
|
||||
}
|
||||
done. {
|
||||
// log_err "all done";
|
||||
// #error("all done");
|
||||
state.is_done = true;
|
||||
}
|
||||
ref. { state.ref_count += 1; }
|
||||
@ -153,19 +153,20 @@ mod map_reduce {
|
||||
while num_mappers > 0 {
|
||||
alt recv(ctrl) {
|
||||
mapper_done. {
|
||||
// log_err "received mapper terminated.";
|
||||
// #error("received mapper terminated.");
|
||||
num_mappers -= 1;
|
||||
}
|
||||
find_reducer(k, cc) {
|
||||
let c;
|
||||
// log_err "finding reducer for " + k;
|
||||
// log_full(core::error, "finding reducer for " + k);
|
||||
alt reducers.find(k) {
|
||||
some(_c) {
|
||||
// log_err "reusing existing reducer for " + k;
|
||||
// log_full(core::error,
|
||||
// "reusing existing reducer for " + k);
|
||||
c = _c;
|
||||
}
|
||||
none. {
|
||||
// log_err "creating new reducer for " + k;
|
||||
// log_full(core::error, "creating new reducer for " + k);
|
||||
let p = port();
|
||||
tasks +=
|
||||
[task::spawn_joinable((k, chan(p)), reduce_task)];
|
||||
@ -200,7 +201,8 @@ fn main(argv: [str]) {
|
||||
let elapsed = stop - start;
|
||||
elapsed /= 1000000u64;
|
||||
|
||||
log_err "MapReduce completed in " + u64::str(elapsed) + "ms";
|
||||
log_full(core::error, "MapReduce completed in "
|
||||
+ u64::str(elapsed) + "ms");
|
||||
}
|
||||
|
||||
fn read_word(r: io::reader) -> option<str> {
|
||||
|
@ -7,6 +7,6 @@ fn my_fail() -> ! { fail; }
|
||||
fn main() {
|
||||
alt true { false { my_fail(); } true { } }
|
||||
|
||||
log x;
|
||||
log_full(core::debug, x);
|
||||
let x: int;
|
||||
}
|
||||
|
@ -3,6 +3,6 @@
|
||||
fn main() {
|
||||
let i: int;
|
||||
|
||||
log false && { i = 5; true };
|
||||
log i;
|
||||
log_full(core::debug, false && { i = 5; true });
|
||||
log_full(core::debug, i);
|
||||
}
|
||||
|
@ -18,5 +18,5 @@ fn main() {
|
||||
my_a
|
||||
};
|
||||
|
||||
log_err my_b.foo();
|
||||
log_full(core::error, my_b.foo());
|
||||
}
|
||||
|
@ -7,11 +7,11 @@ fn main() {
|
||||
let a: clam = {x: @1, y: @2};
|
||||
let b: clam = {x: @10, y: @20};
|
||||
let z: int = a.x + b.y;
|
||||
log z;
|
||||
log_full(core::debug, z);
|
||||
assert (z == 21);
|
||||
let forty: fish = {a: @40};
|
||||
let two: fish = {a: @2};
|
||||
let answer: int = forty.a + two.a;
|
||||
log answer;
|
||||
log_full(core::debug, answer);
|
||||
assert (answer == 42);
|
||||
}
|
||||
|
@ -2,6 +2,6 @@
|
||||
// Tests that a function with a ! annotation always actually fails
|
||||
// error-pattern: some control paths may return
|
||||
|
||||
fn bad_bang(i: uint) -> ! { log 3; }
|
||||
fn bad_bang(i: uint) -> ! { log_full(core::debug, 3); }
|
||||
|
||||
fn main() { bad_bang(5u); }
|
||||
|
@ -1,4 +1,4 @@
|
||||
// error-pattern:expected str but found int
|
||||
|
||||
const i: str = 10;
|
||||
fn main() { log i; }
|
||||
fn main() { log_full(core::debug, i); }
|
||||
|
@ -1,6 +1,6 @@
|
||||
// error-pattern: attempted dynamic environment-capture
|
||||
fn foo() {
|
||||
let x: int;
|
||||
fn bar() { log x; }
|
||||
fn bar() { log_full(core::debug, x); }
|
||||
}
|
||||
fn main() { foo(); }
|
||||
|
@ -1,5 +1,5 @@
|
||||
// error-pattern: attempted dynamic environment-capture
|
||||
fn foo(x: int) {
|
||||
fn bar() { log x; }
|
||||
fn bar() { log_full(core::debug, x); }
|
||||
}
|
||||
fn main() { foo(2); }
|
||||
|
@ -1,7 +1,7 @@
|
||||
// error-pattern: attempted dynamic environment-capture
|
||||
obj foo(x: int) {
|
||||
fn mth() {
|
||||
fn bar() { log x; }
|
||||
fn bar() { log_full(core::debug, x); }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
mod m1 { }
|
||||
|
||||
fn main(args: [str]) { log m1::a; }
|
||||
fn main(args: [str]) { log_full(core::debug, m1::a); }
|
||||
|
@ -4,4 +4,4 @@ mod m1 {
|
||||
mod a { }
|
||||
}
|
||||
|
||||
fn main(args: [str]) { log m1::a; }
|
||||
fn main(args: [str]) { log_full(core::debug, m1::a); }
|
||||
|
@ -10,4 +10,7 @@ fn coerce(b: block()) -> fn() {
|
||||
}
|
||||
|
||||
|
||||
fn main() { let i = 8; let f = coerce(block () { log_err i; }); f(); }
|
||||
fn main() {
|
||||
let i = 8;
|
||||
let f = coerce(block () { log_full(core::error, i); });
|
||||
f(); }
|
||||
|
@ -1,4 +1,8 @@
|
||||
// error-pattern: block type can only appear
|
||||
|
||||
fn lol(f: block()) -> block() { ret f; }
|
||||
fn main() { let i = 8; let f = lol(block () { log_err i; }); f(); }
|
||||
fn main() {
|
||||
let i = 8;
|
||||
let f = lol(block () { log_full(core::error, i); });
|
||||
f();
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
// error-pattern: not all control paths return
|
||||
fn force(f: block() -> int) -> int { f() }
|
||||
fn main() { log_err force({|| }); }
|
||||
fn main() { log_full(core::error, force({|| })); }
|
||||
|
@ -1,4 +1,4 @@
|
||||
// error-pattern: Unsatisfied precondition constraint
|
||||
|
||||
fn force(f: block()) { f(); }
|
||||
fn main() { let x: int; force(block () { log_err x; }); }
|
||||
fn main() { let x: int; force(block () { log_full(core::error, x); }); }
|
||||
|
@ -6,6 +6,9 @@ tag color { rgb(int, int, int); rgba(int, int, int, int); }
|
||||
|
||||
fn main() {
|
||||
let red: color = rgb(255, 0, 0);
|
||||
alt red { rgb(r, g, b) { log "rgb"; } hsl(h, s, l) { log "hsl"; } }
|
||||
alt red {
|
||||
rgb(r, g, b) { #debug("rgb"); }
|
||||
hsl(h, s, l) { #debug("hsl"); }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,9 +6,9 @@ fn foo() -> int {
|
||||
|
||||
do { i = 0; break; x = 0; } while x != 0
|
||||
|
||||
log x;
|
||||
log_full(core::debug, x);
|
||||
|
||||
ret 17;
|
||||
}
|
||||
|
||||
fn main() { log foo(); }
|
||||
fn main() { log_full(core::debug, foo()); }
|
||||
|
@ -6,9 +6,9 @@ fn foo() -> int {
|
||||
|
||||
do { i = 0; break; x = 0; } while 1 != 2
|
||||
|
||||
log x;
|
||||
log_full(core::debug, x);
|
||||
|
||||
ret 17;
|
||||
}
|
||||
|
||||
fn main() { log foo(); }
|
||||
fn main() { log_full(core::debug, foo()); }
|
||||
|
@ -12,5 +12,5 @@ fn main() {
|
||||
let a: int = 1;
|
||||
let b: int = 2;
|
||||
let c: ordered_range = {low: a, high: b};
|
||||
log c.low;
|
||||
log_full(core::debug, c.low);
|
||||
}
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
resource foo(i: int) { }
|
||||
|
||||
fn main() { let x <- foo(10); let y = x; log_err x; }
|
||||
fn main() { let x <- foo(10); let y = x; log_full(core::error, x); }
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
// error-pattern: dead
|
||||
|
||||
fn f(caller: str) { log caller; }
|
||||
fn f(caller: str) { log_full(core::debug, caller); }
|
||||
|
||||
fn main() { be f("main"); log "Paul is dead"; }
|
||||
fn main() { be f("main"); #debug("Paul is dead"); }
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
// error-pattern: dead
|
||||
|
||||
fn f(caller: str) { log caller; }
|
||||
fn f(caller: str) { log_full(core::debug, caller); }
|
||||
|
||||
fn main() { ret f("main"); log "Paul is dead"; }
|
||||
fn main() { ret f("main"); #debug("Paul is dead"); }
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// error-pattern: attempted access of field hello
|
||||
|
||||
obj x() {
|
||||
fn hello() { log "hello"; }
|
||||
fn hello() { #debug("hello"); }
|
||||
}
|
||||
|
||||
fn main() { x.hello(); }
|
||||
|
@ -4,7 +4,7 @@ fn main() {
|
||||
let y: int = 42;
|
||||
let x: int;
|
||||
do {
|
||||
log y;
|
||||
log_full(core::debug, y);
|
||||
do { do { do { x <- y; } while true } while true } while true
|
||||
} while true
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// error-pattern: Unsatisfied precondition constraint (for example, even(y
|
||||
|
||||
fn print_even(y: int) : even(y) { log y; }
|
||||
fn print_even(y: int) : even(y) { log_full(core::debug, y); }
|
||||
|
||||
pure fn even(y: int) -> bool { true }
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
// error-pattern: unresolved name: this_does_nothing_what_the
|
||||
fn main() { log "doing"; this_does_nothing_what_the; log "boing"; }
|
||||
fn main() { #debug("doing"); this_does_nothing_what_the; #debug("boing"); }
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
// error-pattern: unresolved name
|
||||
mod foo {
|
||||
export x;
|
||||
fn x(y: int) { log y; }
|
||||
fn z(y: int) { log y; }
|
||||
fn x(y: int) { log_full(core::debug, y); }
|
||||
fn z(y: int) { log_full(core::debug, y); }
|
||||
}
|
||||
|
||||
fn main() { foo::z(10); }
|
||||
|
@ -9,7 +9,7 @@ mod foo {
|
||||
mod bar {
|
||||
export y;
|
||||
|
||||
fn x() { log "x"; }
|
||||
fn x() { #debug("x"); }
|
||||
|
||||
fn y() { }
|
||||
}
|
||||
|
@ -5,5 +5,5 @@ import str::*;
|
||||
fn main() {
|
||||
let a: uint = 4u;
|
||||
let b: uint = 1u;
|
||||
log_err safe_slice("kitties", a, b);
|
||||
log_full(core::error, safe_slice("kitties", a, b));
|
||||
}
|
||||
|
@ -3,5 +3,5 @@
|
||||
fn main() {
|
||||
// Typestate should work even in a lambda. we should reject this program.
|
||||
let f = fn () -> int { let i: int; ret i; };
|
||||
log_err f();
|
||||
log_full(core::error, f());
|
||||
}
|
||||
|
@ -1,3 +1,6 @@
|
||||
// error-pattern:Unsatisfied precondition
|
||||
|
||||
fn main() { let j = fn () -> int { let i: int; ret i; }(); log_err j; }
|
||||
fn main() {
|
||||
let j = fn () -> int { let i: int; ret i; }();
|
||||
log_full(core::error, j);
|
||||
}
|
||||
|
@ -16,4 +16,4 @@ fn bitv_to_str(enclosing: fn_info, v: bitv::t) -> str {
|
||||
ret s;
|
||||
}
|
||||
|
||||
fn main() { log "OK"; }
|
||||
fn main() { #debug("OK"); }
|
||||
|
@ -5,7 +5,7 @@ pure fn even(x: uint) -> bool {
|
||||
} else if x == 2u { ret true; } else { ret even(x - 2u); }
|
||||
}
|
||||
|
||||
fn print_even(x: uint) : even(x) { log x; }
|
||||
fn print_even(x: uint) : even(x) { log_full(core::debug, x); }
|
||||
|
||||
fn foo(x: uint) { if check even(x) { fail; } else { print_even(x); } }
|
||||
|
||||
|
@ -2,5 +2,5 @@
|
||||
|
||||
fn main() {
|
||||
let a = if true { true };
|
||||
log a;
|
||||
log_full(core::debug, a);
|
||||
}
|
@ -7,10 +7,10 @@ mod module_of_many_things {
|
||||
export f2;
|
||||
export f4;
|
||||
|
||||
fn f1() { log "f1"; }
|
||||
fn f2() { log "f2"; }
|
||||
fn f3() { log "f3"; }
|
||||
fn f4() { log "f4"; }
|
||||
fn f1() { #debug("f1"); }
|
||||
fn f2() { #debug("f2"); }
|
||||
fn f3() { #debug("f3"); }
|
||||
fn f4() { #debug("f4"); }
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@ mod circ1 {
|
||||
export f1;
|
||||
export f2;
|
||||
export common;
|
||||
fn f1() { log "f1"; }
|
||||
fn f1() { #debug("f1"); }
|
||||
fn common() -> uint { ret 0u; }
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ mod circ2 {
|
||||
export f1;
|
||||
export f2;
|
||||
export common;
|
||||
fn f2() { log "f2"; }
|
||||
fn f2() { #debug("f2"); }
|
||||
fn common() -> uint { ret 1u; }
|
||||
}
|
||||
|
||||
|
@ -4,13 +4,13 @@ import mod1::*;
|
||||
import mod2::*;
|
||||
|
||||
mod mod1 {
|
||||
fn f1() { log "f1"; }
|
||||
fn f1() { #debug("f1"); }
|
||||
fn common1() { log "common" }
|
||||
fn common2() { log "common" }
|
||||
}
|
||||
|
||||
mod mod2 {
|
||||
fn f2() { log "f1"; }
|
||||
fn f2() { #debug("f1"); }
|
||||
fn common1() { log "common" }
|
||||
fn common2() { log "common" }
|
||||
}
|
||||
|
@ -2,6 +2,6 @@
|
||||
import zed::bar;
|
||||
import zed::baz;
|
||||
mod zed {
|
||||
fn bar() { log "bar"; }
|
||||
fn bar() { #debug("bar"); }
|
||||
}
|
||||
fn main(args: [str]) { bar(); }
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user