replace error logging with log_err in stdlib and rustc

This commit is contained in:
Marijn Haverbeke 2011-04-19 12:02:06 +02:00
parent 6d3a423094
commit 6511d471ba
16 changed files with 132 additions and 132 deletions

View File

@ -2664,10 +2664,12 @@ let trans_visitor
nabi_rust (upcall_fixup name) args);
and trans_log_int lev (a:Ast.atom) : unit =
trans_void_upcall "upcall_log_int" [| simm (Int64.of_int lev); (trans_atom a) |]
trans_void_upcall "upcall_log_int" [| simm (Int64.of_int lev);
trans_atom a |]
and trans_log_str lev (a:Ast.atom) : unit =
trans_void_upcall "upcall_log_str" [| simm (Int64.of_int lev); (trans_atom a) |]
trans_void_upcall "upcall_log_str" [| simm (Int64.of_int lev);
trans_atom a |]
and trans_spawn
((*initializing*)_:bool)

View File

@ -18,6 +18,7 @@ import std.option.some;
import std.option.none;
import std._str;
import std._vec;
import std.io;
fn default_environment(session.session sess,
str argv0,
@ -88,26 +89,24 @@ impure fn pretty_print_input(session.session sess,
}
fn warn_wrong_compiler() {
log "This is the rust 'self-hosted' compiler.";
log "The one written in rust.";
log "It is currently incomplete.";
log "You may want rustboot instead, the compiler next door.";
io.stdout().write_str("This is the rust 'self-hosted' compiler.
The one written in rust.
It is currently incomplete.
You may want rustboot instead, the compiler next door.\n");
}
fn usage(session.session sess, str argv0) {
log #fmt("usage: %s [options] <input>", argv0);
log "options:";
log "";
log " -o <filename> write output to <filename>";
log " -nowarn suppress wrong-compiler warning";
log " -glue generate glue.bc file";
log " -shared compile a shared-library crate";
log " -pp pretty-print the input instead of compiling";
log " -ls list the symbols defined by a crate file";
log " -L <path> add a directory to the library search path";
log " -h display this message";
log "";
log "";
io.stdout().write_str(#fmt("usage: %s [options] <input>\n", argv0) + "
options:
-o <filename> write output to <filename>
-nowarn suppress wrong-compiler warning
-glue generate glue.bc file
-shared compile a shared-library crate
-pp pretty-print the input instead of compiling
-ls list the symbols defined by a crate file
-L <path> add a directory to the library search path
-h display this message\n\n");
}
fn get_os() -> session.os {

View File

@ -42,16 +42,16 @@ state obj session(ast.crate_num cnum, cfg targ,
fn span_err(span sp, str msg) {
auto lo = codemap.lookup_pos(cm, sp.lo);
auto hi = codemap.lookup_pos(cm, sp.hi);
log #fmt("%s:%u:%u:%u:%u: error: %s",
lo.filename,
lo.line, lo.col,
hi.line, hi.col,
msg);
log_err #fmt("%s:%u:%u:%u:%u: error: %s",
lo.filename,
lo.line, lo.col,
hi.line, hi.col,
msg);
fail;
}
fn err(str msg) {
log #fmt("error: %s", msg);
log_err #fmt("error: %s", msg);
fail;
}
@ -65,31 +65,31 @@ state obj session(ast.crate_num cnum, cfg targ,
fn span_warn(span sp, str msg) {
auto lo = codemap.lookup_pos(cm, sp.lo);
auto hi = codemap.lookup_pos(cm, sp.hi);
log #fmt("%s:%u:%u:%u:%u: warning: %s",
lo.filename,
lo.line, lo.col,
hi.line, hi.col,
msg);
log_err #fmt("%s:%u:%u:%u:%u: warning: %s",
lo.filename,
lo.line, lo.col,
hi.line, hi.col,
msg);
}
fn bug(str msg) {
log #fmt("error: internal compiler error %s", msg);
log_err #fmt("error: internal compiler error %s", msg);
fail;
}
fn span_unimpl(span sp, str msg) {
auto lo = codemap.lookup_pos(cm, sp.lo);
auto hi = codemap.lookup_pos(cm, sp.hi);
log #fmt("%s:%u:%u:%u:%u: error: unimplemented %s",
lo.filename,
lo.line, lo.col,
hi.line, hi.col,
msg);
log_err #fmt("%s:%u:%u:%u:%u: error: unimplemented %s",
lo.filename,
lo.line, lo.col,
hi.line, hi.col,
msg);
fail;
}
fn unimpl(str msg) {
log #fmt("error: unimplemented %s", msg);
log_err #fmt("error: unimplemented %s", msg);
fail;
}

View File

@ -46,7 +46,7 @@ fn lookup_pos(codemap map, uint pos) -> loc {
}
}
}
log #fmt("Failed to find a location for character %u", pos);
log_err #fmt("Failed to find a location for character %u", pos);
fail;
}

View File

@ -67,7 +67,7 @@ fn parse_ty_str(str rep, str_def sd) -> @ty.t {
auto st = @rec(rep=rep, mutable pos=0u, len=len);
auto result = parse_ty(st, sd);
if (st.pos != len) {
log "parse_ty_str: incomplete parse, stopped at byte "
log_err "parse_ty_str: incomplete parse, stopped at byte "
+ _uint.to_str(st.pos, 10u) + " of "
+ _uint.to_str(len, 10u) + " in str '" + rep + "'";
}
@ -242,7 +242,7 @@ fn parse_def_id(vec[u8] buf) -> ast.def_id {
colon_idx += 1u;
}
if (colon_idx == len) {
log "didn't find ':' when parsing def id";
log_err "didn't find ':' when parsing def id";
fail;
}
@ -407,8 +407,8 @@ fn load_crate(session.session sess,
}
}
log #fmt("can't open crate '%s' (looked for '%s' in lib search paths)",
ident, filename);
log_err #fmt("can't open crate '%s' (looked for '%s' in lib search path)",
ident, filename);
fail;
}
@ -459,8 +459,8 @@ fn kind_has_type_params(u8 kind_ch) -> bool {
else if (kind_ch == ('n' as u8)) { ret false; }
else if (kind_ch == ('v' as u8)) { ret true; }
else {
log #fmt("kind_has_type_params(): unknown kind char: %d",
kind_ch as int);
log_err #fmt("kind_has_type_params(): unknown kind char: %d",
kind_ch as int);
fail;
}
}
@ -503,7 +503,7 @@ fn lookup_def(session.session sess, int cnum, vec[ast.ident] path)
tid = tup(cnum, tid._1);
def = ast.def_variant(tid, did);
} else {
log #fmt("lookup_def(): unknown kind char: %d", kind_ch as int);
log_err #fmt("lookup_def(): unknown kind char: %d", kind_ch as int);
fail;
}

View File

@ -49,7 +49,7 @@ fn expand_syntax_ext(vec[@ast.expr] args,
option.t[@ast.expr] body) -> @ast.expr {
if (_vec.len[@ast.expr](args) == 0u) {
log "malformed #fmt call";
log_err "malformed #fmt call";
fail;
}
@ -74,7 +74,7 @@ fn expr_to_str(@ast.expr expr) -> str {
}
}
}
log "malformed #fmt call";
log_err "malformed #fmt call";
fail;
}
@ -214,7 +214,7 @@ fn pieces_to_expr(vec[piece] pieces, vec[@ast.expr] args) -> @ast.expr {
ret make_call(sp, count_is_path, count_is_args);
}
case (_) {
log "not implemented";
log_err "not implemented";
fail;
}
}
@ -302,7 +302,7 @@ fn pieces_to_expr(vec[piece] pieces, vec[@ast.expr] args) -> @ast.expr {
case (option.none[int]) {
}
case (_) {
log unsupported;
log_err unsupported;
fail;
}
}
@ -313,13 +313,13 @@ fn pieces_to_expr(vec[piece] pieces, vec[@ast.expr] args) -> @ast.expr {
}
case (flag_sign_always) {
if (!is_signed_type(cnv)) {
log "+ flag only valid in signed #fmt conversions";
log_err "+ flag only valid in signed #fmt conversion";
fail;
}
}
case (flag_space_for_sign) {
if (!is_signed_type(cnv)) {
log "space flag only valid in "
log_err "space flag only valid in "
+ "signed #fmt conversions";
fail;
}
@ -327,7 +327,7 @@ fn pieces_to_expr(vec[piece] pieces, vec[@ast.expr] args) -> @ast.expr {
case (flag_left_zero_pad) {
}
case (_) {
log unsupported;
log_err unsupported;
fail;
}
}
@ -339,7 +339,7 @@ fn pieces_to_expr(vec[piece] pieces, vec[@ast.expr] args) -> @ast.expr {
case (count_is(_)) {
}
case (_) {
log unsupported;
log_err unsupported;
fail;
}
}
@ -350,7 +350,7 @@ fn pieces_to_expr(vec[piece] pieces, vec[@ast.expr] args) -> @ast.expr {
case (count_is(_)) {
}
case (_) {
log unsupported;
log_err unsupported;
fail;
}
}
@ -382,7 +382,7 @@ fn pieces_to_expr(vec[piece] pieces, vec[@ast.expr] args) -> @ast.expr {
ret make_conv_call(arg.span, "uint", cnv, arg);
}
case (_) {
log unsupported;
log_err unsupported;
fail;
}
}
@ -492,7 +492,7 @@ fn pieces_to_expr(vec[piece] pieces, vec[@ast.expr] args) -> @ast.expr {
}
case (piece_conv(?conv)) {
if (n >= _vec.len[@ast.expr](args)) {
log "too many conversions in #fmt string";
log_err "too many conversions in #fmt string";
fail;
}

View File

@ -321,7 +321,7 @@ impure fn consume_block_comment(reader rdr) {
}
}
if (rdr.is_eof()) {
log "unterminated block comment";
log_err "unterminated block comment";
fail;
}
}
@ -359,7 +359,7 @@ impure fn scan_exponent(reader rdr) -> option.t[str] {
ret(some(res + exponent));
}
else {
log ("scan_exponent: bad fp literal");
log_err ("scan_exponent: bad fp literal");
fail;
}
}
@ -538,8 +538,7 @@ impure fn scan_numeric_escape(reader rdr) -> char {
case ('u') { n_hex_digits = 4; }
case ('U') { n_hex_digits = 8; }
case (?c) {
log "unknown numeric character escape";
log c;
log_err #fmt("unknown numeric character escape: %d", c as int);
fail;
}
}
@ -551,8 +550,7 @@ impure fn scan_numeric_escape(reader rdr) -> char {
while (n_hex_digits != 0) {
if (!is_hex_digit(n)) {
log "illegal numeric character escape";
log n;
log_err #fmt("illegal numeric character escape: %d", n as int);
fail;
}
accum_int *= 16;
@ -593,7 +591,7 @@ impure fn next_token(reader rdr) -> token.token {
auto rsvd = rdr.get_reserved();
if (rsvd.contains_key(accum_str)) {
log "reserved keyword";
log_err #fmt("reserved keyword: %s", accum_str);
fail;
}
@ -716,8 +714,8 @@ impure fn next_token(reader rdr) -> token.token {
case ('U') { c2 = scan_numeric_escape(rdr); }
case (?c2) {
log "unknown character escape";
log c2;
log_err #fmt("unknown character escape: %d",
c2 as int);
fail;
}
}
@ -725,7 +723,7 @@ impure fn next_token(reader rdr) -> token.token {
}
if (rdr.next() != '\'') {
log "unterminated character constant";
log_err "unterminated character constant";
fail;
}
rdr.bump(); // advance curr to closing '
@ -776,8 +774,8 @@ impure fn next_token(reader rdr) -> token.token {
}
case (?c2) {
log "unknown string escape";
log c2;
log_err #fmt("unknown string escape: %d",
c2 as int);
fail;
}
}
@ -843,8 +841,7 @@ impure fn next_token(reader rdr) -> token.token {
}
case (?c) {
log "unkown start of token";
log c;
log_err #fmt("unkown start of token: %d", c as int);
fail;
}
}

View File

@ -1400,7 +1400,7 @@ fn type_to_str_inner(type_names names,
case (13) { ret "Vector"; }
case (14) { ret "Metadata"; }
case (_) {
log "unknown TypeKind" + util.common.istr(kind as int);
log_err #fmt("unknown TypeKind %d", kind as int);
fail;
}
}

View File

@ -366,7 +366,7 @@ fn lookup_name_wrapped(&env e, ast.ident i, namespace ns)
ret some[def_wrap](def_wrap_other(t));
}
case (_) {
log "tag item not actually a tag";
log_err "tag item not actually a tag";
fail;
}
}
@ -426,7 +426,7 @@ fn lookup_name_wrapped(&env e, ast.ident i, namespace ns)
ret def_wrap_other(t);
}
case (_) {
log "tag item not actually a tag";
log_err "tag item not actually a tag";
fail;
}
}

View File

@ -556,7 +556,7 @@ fn T_opaque_obj_ptr(type_names tn) -> TypeRef {
// TODO: Enforce via a predicate.
fn type_of(@crate_ctxt cx, @ty.t t) -> TypeRef {
if (ty.type_has_dynamic_size(t)) {
log "type_of() called on a type with dynamic size: " +
log_err "type_of() called on a type with dynamic size: " +
ty.ty_to_str(t);
fail;
}
@ -764,14 +764,14 @@ fn type_of_inner(@crate_ctxt cx, @ty.t t) -> TypeRef {
llty = abs_pair;
}
case (ty.ty_var(_)) {
log "ty_var in trans.type_of";
log_err "ty_var in trans.type_of";
fail;
}
case (ty.ty_param(_)) {
llty = T_i8();
}
case (ty.ty_bound_param(_)) {
log "ty_bound_param in trans.type_of";
log_err "ty_bound_param in trans.type_of";
fail;
}
case (ty.ty_type) { llty = T_ptr(T_tydesc(cx.tn)); }
@ -1152,7 +1152,7 @@ fn simplify_type(@ty.t typ) -> @ty.t {
// Computes the size of the data part of a non-dynamically-sized tag.
fn static_size_of_tag(@crate_ctxt cx, @ty.t t) -> uint {
if (ty.type_has_dynamic_size(t)) {
log "dynamically sized type passed to static_size_of_tag()";
log_err "dynamically sized type passed to static_size_of_tag()";
fail;
}
@ -1168,7 +1168,7 @@ fn static_size_of_tag(@crate_ctxt cx, @ty.t t) -> uint {
subtys = subtys_;
}
case (_) {
log "non-tag passed to static_size_of_tag()";
log_err "non-tag passed to static_size_of_tag()";
fail;
}
}
@ -2037,7 +2037,7 @@ fn tag_variant_with_id(@crate_ctxt cx,
i += 1u;
}
log "tag_variant_with_id(): no variant exists with that ID";
log_err "tag_variant_with_id(): no variant exists with that ID";
fail;
}
@ -2584,13 +2584,13 @@ fn node_ann_type(@crate_ctxt cx, &ast.ann a) -> @ty.t {
fn node_ann_ty_params(&ast.ann a) -> vec[@ty.t] {
alt (a) {
case (ast.ann_none) {
log "missing type annotation";
log_err "missing type annotation";
fail;
}
case (ast.ann_type(_, ?tps_opt, _)) {
alt (tps_opt) {
case (none[vec[@ty.t]]) {
log "type annotation has no ty params";
log_err "type annotation has no ty params";
fail;
}
case (some[vec[@ty.t]](?tps)) { ret tps; }
@ -2656,7 +2656,7 @@ fn trans_unary(@block_ctxt cx, ast.unop op,
ret res(sub.bcx, box);
}
case (ast.deref) {
log "deref expressions should have been translated using " +
log_err "deref expressions should have been translated using " +
"trans_lval(), not trans_unary()";
fail;
}
@ -5030,16 +5030,17 @@ fn trans_log(int lvl, @block_ctxt cx, @ast.expr e) -> result {
}
}
if (is32bit) {
trans_upcall(sub.bcx,
"upcall_log_float",
vec(C_int(lvl), sub.val)).bcx.build.Br(after_cx.llbb);
auto uval = trans_upcall(sub.bcx,
"upcall_log_float",
vec(C_int(lvl), sub.val));
uval.bcx.build.Br(after_cx.llbb);
} else {
auto tmp = alloca(sub.bcx, tr);
sub.bcx.build.Store(sub.val, tmp);
auto v = vp2i(sub.bcx, tmp);
trans_upcall(sub.bcx,
"upcall_log_double",
vec(C_int(lvl), v)).bcx.build.Br(after_cx.llbb);
auto uval = trans_upcall(sub.bcx,
"upcall_log_double",
vec(C_int(lvl), vp2i(sub.bcx, tmp)));
uval.bcx.build.Br(after_cx.llbb);
}
} else {
alt (e_ty.struct) {

View File

@ -663,7 +663,7 @@ fn eq_ty(&@t a, &@t b) -> bool {
fn ann_to_type(&ast.ann ann) -> @t {
alt (ann) {
case (ast.ann_none) {
log "ann_to_type() called on node with no type";
log_err "ann_to_type() called on node with no type";
fail;
}
case (ast.ann_type(?ty, _, _)) {
@ -675,7 +675,7 @@ fn ann_to_type(&ast.ann ann) -> @t {
fn ann_to_type_params(&ast.ann ann) -> vec[@t] {
alt (ann) {
case (ast.ann_none) {
log "ann_to_type_params() called on node with no type params";
log_err "ann_to_type_params() called on node with no type params";
fail;
}
case (ast.ann_type(_, ?tps, _)) {
@ -697,7 +697,7 @@ fn ann_to_monotype(ast.ann a) -> @ty.t {
// confident that it works.
alt (a) {
case (ast.ann_none) {
log "ann_to_monotype() called on expression with no type!";
log_err "ann_to_monotype() called on expression with no type!";
fail;
}
case (ast.ann_type(?typ, ?tps_opt, _)) {
@ -995,7 +995,7 @@ fn replace_expr_type(@ast.expr expr, tup(vec[@t], @t) new_tyt) -> @ast.expr {
ast.expr_path(p, dopt, ann));
}
case (_) {
log "unhandled expr type in replace_expr_type(): " +
log_err "unhandled expr type in replace_expr_type(): " +
pretty.pprust.expr_to_str(expr);
fail;
}
@ -1356,7 +1356,7 @@ fn unify(@ty.t expected, @ty.t actual, &unify_handler handler)
case (ty.ty_bound_param(?actual_id)) {
alt (expected.struct) {
case (ty.ty_local(_)) {
log "TODO: bound param unifying with local";
log_err "TODO: bound param unifying with local";
fail;
}
@ -1782,7 +1782,8 @@ fn unify(@ty.t expected, @ty.t actual, &unify_handler handler)
let vec[@t] result = vec();
for (vec[@t] types in set_types) {
if (_vec.len[@t](types) > 1u) {
log "unification of > 1 types in a type set is unimplemented";
log_err "unification of > 1 types in a type set is " +
"unimplemented";
fail;
}
result += vec(types.(0));
@ -1878,7 +1879,7 @@ fn bind_params_in_type(@t typ) -> @t {
fn binder(@t typ) -> @t {
alt (typ.struct) {
case (ty_bound_param(?index)) {
log "bind_params_in_type() called on type that already " +
log_err "bind_params_in_type() called on type that already " +
"has bound params in it";
fail;
}

View File

@ -1099,7 +1099,7 @@ mod Pushdown {
alt (expected.struct) {
case (ty.ty_tag(_, ?tps)) { tag_tps = tps; }
case (_) {
log "tag pattern type not actually a tag?!";
log_err "tag pattern type not actually a tag?!";
fail;
}
}
@ -1153,7 +1153,7 @@ mod Pushdown {
}
}
case (_) {
log "vec expr doesn't have a vec type!";
log_err "vec expr doesn't have a vec type!";
fail;
}
}
@ -1174,7 +1174,7 @@ mod Pushdown {
}
}
case (_) {
log "tup expr doesn't have a tup type!";
log_err "tup expr doesn't have a tup type!";
fail;
}
}
@ -1231,7 +1231,7 @@ mod Pushdown {
}
}
case (_) {
log "rec expr doesn't have a rec type!";
log_err "rec expr doesn't have a rec type!";
fail;
}
}
@ -1355,8 +1355,8 @@ mod Pushdown {
auto ty_params_opt;
alt (ann) {
case (ast.ann_none) {
log "pushdown_expr(): no type annotation for path " +
"expr; did you pass it to check_expr() first?";
log_err "pushdown_expr(): no type annotation for " +
"path expr; did you pass it to check_expr()?";
fail;
}
case (ast.ann_type(_, ?tps_opt, _)) {
@ -1682,7 +1682,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
t_0 = plain_ty(ty.ty_native_fn(abi, arg_tys_0, rt_0));
}
case (_) {
log "check_call_or_bind(): fn expr doesn't have fn type";
log_err "check_call_or_bind(): fn expr doesn't have fn type";
fail;
}
}
@ -1905,10 +1905,10 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
boring_ann()));
}
case (ast.expr_log(_,?e,_)) {
case (ast.expr_log(?l,?e,_)) {
auto expr_t = check_expr(fcx, e);
ret @fold.respan[ast.expr_]
(expr.span, ast.expr_log(_, expr_t, boring_ann()));
(expr.span, ast.expr_log(l, expr_t, boring_ann()));
}
case (ast.expr_check_expr(?e, _)) {
@ -2153,7 +2153,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
}
}
case (_) {
log "LHS of bind expr didn't have a function type?!";
log_err "LHS of bind expr didn't have a function type?!";
fail;
}
}
@ -2176,7 +2176,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
case (ty.ty_fn(_,_,?rt)) { rt_1 = rt; }
case (ty.ty_native_fn(_, _, ?rt)) { rt_1 = rt; }
case (_) {
log "LHS of call expr didn't have a function type?!";
log_err "LHS of call expr didn't have a function type?!";
fail;
}
}

View File

@ -463,13 +463,13 @@ fn stmt_pp(&stmt s) -> pre_and_post {
fn expr_states(&expr e) -> pre_and_post_state {
alt (expr_ann(e)) {
case (ann_none) {
log "expr_pp: the impossible happened (no annotation)";
log_err "expr_pp: the impossible happened (no annotation)";
fail;
}
case (ann_type(_, _, ?maybe_pp)) {
alt (maybe_pp) {
case (none[@ts_ann]) {
log "expr_pp: the impossible happened (no pre/post)";
log_err "expr_pp: the impossible happened (no pre/post)";
fail;
}
case (some[@ts_ann](?p)) {
@ -484,13 +484,13 @@ fn expr_states(&expr e) -> pre_and_post_state {
fn expr_pp(&expr e) -> pre_and_post {
alt (expr_ann(e)) {
case (ann_none) {
log "expr_pp: the impossible happened (no annotation)";
log_err "expr_pp: the impossible happened (no annotation)";
fail;
}
case (ann_type(_, _, ?maybe_pp)) {
alt (maybe_pp) {
case (none[@ts_ann]) {
log "expr_pp: the impossible happened (no pre/post)";
log_err "expr_pp: the impossible happened (no pre/post)";
fail;
}
case (some[@ts_ann](?p)) {
@ -506,13 +506,13 @@ fn expr_pp(&expr e) -> pre_and_post {
fn block_pp(&block b) -> pre_and_post {
alt (b.node.a) {
case (ann_none) {
log "block_pp: the impossible happened (no ann)";
log_err "block_pp: the impossible happened (no ann)";
fail;
}
case (ann_type(_,_,?t)) {
alt (t) {
case (none[@ts_ann]) {
log "block_pp: the impossible happened (no ty)";
log_err "block_pp: the impossible happened (no ty)";
fail;
}
case (some[@ts_ann](?ts)) {
@ -526,13 +526,13 @@ fn block_pp(&block b) -> pre_and_post {
fn block_states(&block b) -> pre_and_post_state {
alt (b.node.a) {
case (ann_none) {
log "block_pp: the impossible happened (no ann)";
log_err "block_pp: the impossible happened (no ann)";
fail;
}
case (ann_type(_,_,?t)) {
alt (t) {
case (none[@ts_ann]) {
log "block_states: the impossible happened (no ty)";
log_err "block_states: the impossible happened (no ty)";
fail;
}
case (some[@ts_ann](?ts)) {

View File

@ -96,7 +96,7 @@ mod CT {
if (_str.eq(curr, "%")) {
i += 1u;
if (i >= lim) {
log "unterminated conversion at end of string";
log_err "unterminated conversion at end of string";
fail;
}
auto curr2 = _str.substr(s, i, 1u);
@ -264,7 +264,7 @@ mod CT {
fn parse_type(str s, uint i, uint lim) -> tup(ty, uint) {
if (i >= lim) {
log "missing type in conversion";
log_err "missing type in conversion";
fail;
}
@ -290,7 +290,7 @@ mod CT {
} else if (_str.eq(tstr, "t")) {
t = ty_bits;
} else {
log "unknown type in conversion";
log_err "unknown type in conversion";
fail;
}

View File

@ -33,7 +33,7 @@ fn vint_at(vec[u8] data, uint start) -> tup(uint, uint) {
((data.(start + 2u) as uint) << 8u) |
(data.(start + 3u) as uint), start + 4u);
} else {
log "vint too big"; fail;
log_err "vint too big"; fail;
}
}
@ -65,7 +65,7 @@ fn get_doc(doc d, uint tg) -> doc {
alt (maybe_get_doc(d, tg)) {
case (some[doc](?d)) {ret d;}
case (none[doc]) {
log "failed to find block with tag " + _uint.to_str(tg, 10u);
log_err "failed to find block with tag " + _uint.to_str(tg, 10u);
fail;
}
}
@ -140,7 +140,7 @@ fn write_sized_vint(&io.buf_writer w, uint n, uint size) {
(n & 0xffu) as u8);
}
case (_) {
log "vint to write too big";
log_err "vint to write too big";
fail;
}
}
@ -153,7 +153,7 @@ fn write_vint(&io.buf_writer w, uint n) {
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 "vint to write too big";
log_err "vint to write too big";
fail;
}

View File

@ -193,7 +193,7 @@ fn stdin() -> reader {
fn file_reader(str path) -> reader {
auto f = os.libc.fopen(_str.buf(path), _str.buf("r"));
if (f as uint == 0u) {
log "error opening " + path;
log_err "error opening " + path;
fail;
}
ret new_reader(FILE_buf_reader(f, true));
@ -229,7 +229,7 @@ state obj byte_buf_reader(byte_buf bbuf) {
}
impure fn unread_byte(int byte) {
log "TODO: unread_byte";
log_err "TODO: unread_byte";
fail;
}
@ -274,7 +274,7 @@ state obj FILE_writer(os.libc.FILE f, bool must_close) {
auto vbuf = _vec.buf[u8](v);
auto nout = os.libc.fwrite(vbuf, len, 1u, f);
if (nout < 1u) {
log "error dumping buffer";
log_err "error dumping buffer";
}
}
@ -300,8 +300,8 @@ state obj fd_buf_writer(int fd, bool must_close) {
vbuf = _vec.buf_off[u8](v, count);
auto nout = os.libc.write(fd, vbuf, len);
if (nout < 0) {
log "error dumping buffer";
log sys.rustrt.last_os_error();
log_err "error dumping buffer";
log_err sys.rustrt.last_os_error();
fail;
}
count += nout as uint;
@ -309,12 +309,12 @@ state obj fd_buf_writer(int fd, bool must_close) {
}
fn seek(int offset, seek_style whence) {
log "need 64-bit native calls for seek, sorry";
log_err "need 64-bit native calls for seek, sorry";
fail;
}
fn tell() -> uint {
log "need 64-bit native calls for tell, sorry";
log_err "need 64-bit native calls for tell, sorry";
fail;
}
@ -343,8 +343,8 @@ fn file_buf_writer(str path, vec[fileflag] flags) -> buf_writer {
os.libc_constants.S_IWUSR());
if (fd < 0) {
log "error opening file for writing";
log sys.rustrt.last_os_error();
log_err "error opening file for writing";
log_err sys.rustrt.last_os_error();
fail;
}
ret fd_buf_writer(fd, true);
@ -429,7 +429,7 @@ fn file_writer(str path, vec[fileflag] flags) -> writer {
fn buffered_file_buf_writer(str path) -> buf_writer {
auto f = os.libc.fopen(_str.buf(path), _str.buf("w"));
if (f as uint == 0u) {
log "error opening " + path;
log_err "error opening " + path;
fail;
}
ret FILE_writer(f, true);