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); nabi_rust (upcall_fixup name) args);
and trans_log_int lev (a:Ast.atom) : unit = 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 = 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 and trans_spawn
((*initializing*)_:bool) ((*initializing*)_:bool)

View file

@ -18,6 +18,7 @@ import std.option.some;
import std.option.none; import std.option.none;
import std._str; import std._str;
import std._vec; import std._vec;
import std.io;
fn default_environment(session.session sess, fn default_environment(session.session sess,
str argv0, str argv0,
@ -88,26 +89,24 @@ impure fn pretty_print_input(session.session sess,
} }
fn warn_wrong_compiler() { fn warn_wrong_compiler() {
log "This is the rust 'self-hosted' compiler."; io.stdout().write_str("This is the rust 'self-hosted' compiler.
log "The one written in rust."; The one written in rust.
log "It is currently incomplete."; It is currently incomplete.
log "You may want rustboot instead, the compiler next door."; You may want rustboot instead, the compiler next door.\n");
} }
fn usage(session.session sess, str argv0) { fn usage(session.session sess, str argv0) {
log #fmt("usage: %s [options] <input>", argv0); io.stdout().write_str(#fmt("usage: %s [options] <input>\n", argv0) + "
log "options:"; options:
log "";
log " -o <filename> write output to <filename>"; -o <filename> write output to <filename>
log " -nowarn suppress wrong-compiler warning"; -nowarn suppress wrong-compiler warning
log " -glue generate glue.bc file"; -glue generate glue.bc file
log " -shared compile a shared-library crate"; -shared compile a shared-library crate
log " -pp pretty-print the input instead of compiling"; -pp pretty-print the input instead of compiling
log " -ls list the symbols defined by a crate file"; -ls list the symbols defined by a crate file
log " -L <path> add a directory to the library search path"; -L <path> add a directory to the library search path
log " -h display this message"; -h display this message\n\n");
log "";
log "";
} }
fn get_os() -> session.os { 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) { fn span_err(span sp, str msg) {
auto lo = codemap.lookup_pos(cm, sp.lo); auto lo = codemap.lookup_pos(cm, sp.lo);
auto hi = codemap.lookup_pos(cm, sp.hi); auto hi = codemap.lookup_pos(cm, sp.hi);
log #fmt("%s:%u:%u:%u:%u: error: %s", log_err #fmt("%s:%u:%u:%u:%u: error: %s",
lo.filename, lo.filename,
lo.line, lo.col, lo.line, lo.col,
hi.line, hi.col, hi.line, hi.col,
msg); msg);
fail; fail;
} }
fn err(str msg) { fn err(str msg) {
log #fmt("error: %s", msg); log_err #fmt("error: %s", msg);
fail; fail;
} }
@ -65,31 +65,31 @@ state obj session(ast.crate_num cnum, cfg targ,
fn span_warn(span sp, str msg) { fn span_warn(span sp, str msg) {
auto lo = codemap.lookup_pos(cm, sp.lo); auto lo = codemap.lookup_pos(cm, sp.lo);
auto hi = codemap.lookup_pos(cm, sp.hi); auto hi = codemap.lookup_pos(cm, sp.hi);
log #fmt("%s:%u:%u:%u:%u: warning: %s", log_err #fmt("%s:%u:%u:%u:%u: warning: %s",
lo.filename, lo.filename,
lo.line, lo.col, lo.line, lo.col,
hi.line, hi.col, hi.line, hi.col,
msg); msg);
} }
fn bug(str msg) { fn bug(str msg) {
log #fmt("error: internal compiler error %s", msg); log_err #fmt("error: internal compiler error %s", msg);
fail; fail;
} }
fn span_unimpl(span sp, str msg) { fn span_unimpl(span sp, str msg) {
auto lo = codemap.lookup_pos(cm, sp.lo); auto lo = codemap.lookup_pos(cm, sp.lo);
auto hi = codemap.lookup_pos(cm, sp.hi); auto hi = codemap.lookup_pos(cm, sp.hi);
log #fmt("%s:%u:%u:%u:%u: error: unimplemented %s", log_err #fmt("%s:%u:%u:%u:%u: error: unimplemented %s",
lo.filename, lo.filename,
lo.line, lo.col, lo.line, lo.col,
hi.line, hi.col, hi.line, hi.col,
msg); msg);
fail; fail;
} }
fn unimpl(str msg) { fn unimpl(str msg) {
log #fmt("error: unimplemented %s", msg); log_err #fmt("error: unimplemented %s", msg);
fail; 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; 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 st = @rec(rep=rep, mutable pos=0u, len=len);
auto result = parse_ty(st, sd); auto result = parse_ty(st, sd);
if (st.pos != len) { 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(st.pos, 10u) + " of "
+ _uint.to_str(len, 10u) + " in str '" + rep + "'"; + _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; colon_idx += 1u;
} }
if (colon_idx == len) { if (colon_idx == len) {
log "didn't find ':' when parsing def id"; log_err "didn't find ':' when parsing def id";
fail; 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)", log_err #fmt("can't open crate '%s' (looked for '%s' in lib search path)",
ident, filename); ident, filename);
fail; 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 == ('n' as u8)) { ret false; }
else if (kind_ch == ('v' as u8)) { ret true; } else if (kind_ch == ('v' as u8)) { ret true; }
else { else {
log #fmt("kind_has_type_params(): unknown kind char: %d", log_err #fmt("kind_has_type_params(): unknown kind char: %d",
kind_ch as int); kind_ch as int);
fail; fail;
} }
} }
@ -503,7 +503,7 @@ fn lookup_def(session.session sess, int cnum, vec[ast.ident] path)
tid = tup(cnum, tid._1); tid = tup(cnum, tid._1);
def = ast.def_variant(tid, did); def = ast.def_variant(tid, did);
} else { } 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; fail;
} }

View file

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

View file

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

View file

@ -1400,7 +1400,7 @@ fn type_to_str_inner(type_names names,
case (13) { ret "Vector"; } case (13) { ret "Vector"; }
case (14) { ret "Metadata"; } case (14) { ret "Metadata"; }
case (_) { case (_) {
log "unknown TypeKind" + util.common.istr(kind as int); log_err #fmt("unknown TypeKind %d", kind as int);
fail; 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)); ret some[def_wrap](def_wrap_other(t));
} }
case (_) { case (_) {
log "tag item not actually a tag"; log_err "tag item not actually a tag";
fail; fail;
} }
} }
@ -426,7 +426,7 @@ fn lookup_name_wrapped(&env e, ast.ident i, namespace ns)
ret def_wrap_other(t); ret def_wrap_other(t);
} }
case (_) { case (_) {
log "tag item not actually a tag"; log_err "tag item not actually a tag";
fail; fail;
} }
} }

View file

@ -556,7 +556,7 @@ fn T_opaque_obj_ptr(type_names tn) -> TypeRef {
// TODO: Enforce via a predicate. // TODO: Enforce via a predicate.
fn type_of(@crate_ctxt cx, @ty.t t) -> TypeRef { fn type_of(@crate_ctxt cx, @ty.t t) -> TypeRef {
if (ty.type_has_dynamic_size(t)) { 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); ty.ty_to_str(t);
fail; fail;
} }
@ -764,14 +764,14 @@ fn type_of_inner(@crate_ctxt cx, @ty.t t) -> TypeRef {
llty = abs_pair; llty = abs_pair;
} }
case (ty.ty_var(_)) { case (ty.ty_var(_)) {
log "ty_var in trans.type_of"; log_err "ty_var in trans.type_of";
fail; fail;
} }
case (ty.ty_param(_)) { case (ty.ty_param(_)) {
llty = T_i8(); llty = T_i8();
} }
case (ty.ty_bound_param(_)) { case (ty.ty_bound_param(_)) {
log "ty_bound_param in trans.type_of"; log_err "ty_bound_param in trans.type_of";
fail; fail;
} }
case (ty.ty_type) { llty = T_ptr(T_tydesc(cx.tn)); } 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. // 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 { fn static_size_of_tag(@crate_ctxt cx, @ty.t t) -> uint {
if (ty.type_has_dynamic_size(t)) { 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; fail;
} }
@ -1168,7 +1168,7 @@ fn static_size_of_tag(@crate_ctxt cx, @ty.t t) -> uint {
subtys = subtys_; subtys = subtys_;
} }
case (_) { case (_) {
log "non-tag passed to static_size_of_tag()"; log_err "non-tag passed to static_size_of_tag()";
fail; fail;
} }
} }
@ -2037,7 +2037,7 @@ fn tag_variant_with_id(@crate_ctxt cx,
i += 1u; 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; 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] { fn node_ann_ty_params(&ast.ann a) -> vec[@ty.t] {
alt (a) { alt (a) {
case (ast.ann_none) { case (ast.ann_none) {
log "missing type annotation"; log_err "missing type annotation";
fail; fail;
} }
case (ast.ann_type(_, ?tps_opt, _)) { case (ast.ann_type(_, ?tps_opt, _)) {
alt (tps_opt) { alt (tps_opt) {
case (none[vec[@ty.t]]) { case (none[vec[@ty.t]]) {
log "type annotation has no ty params"; log_err "type annotation has no ty params";
fail; fail;
} }
case (some[vec[@ty.t]](?tps)) { ret tps; } 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); ret res(sub.bcx, box);
} }
case (ast.deref) { 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()"; "trans_lval(), not trans_unary()";
fail; fail;
} }
@ -5030,16 +5030,17 @@ fn trans_log(int lvl, @block_ctxt cx, @ast.expr e) -> result {
} }
} }
if (is32bit) { if (is32bit) {
trans_upcall(sub.bcx, auto uval = trans_upcall(sub.bcx,
"upcall_log_float", "upcall_log_float",
vec(C_int(lvl), sub.val)).bcx.build.Br(after_cx.llbb); vec(C_int(lvl), sub.val));
uval.bcx.build.Br(after_cx.llbb);
} else { } else {
auto tmp = alloca(sub.bcx, tr); auto tmp = alloca(sub.bcx, tr);
sub.bcx.build.Store(sub.val, tmp); sub.bcx.build.Store(sub.val, tmp);
auto v = vp2i(sub.bcx, tmp); auto uval = trans_upcall(sub.bcx,
trans_upcall(sub.bcx, "upcall_log_double",
"upcall_log_double", vec(C_int(lvl), vp2i(sub.bcx, tmp)));
vec(C_int(lvl), v)).bcx.build.Br(after_cx.llbb); uval.bcx.build.Br(after_cx.llbb);
} }
} else { } else {
alt (e_ty.struct) { 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 { fn ann_to_type(&ast.ann ann) -> @t {
alt (ann) { alt (ann) {
case (ast.ann_none) { 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; fail;
} }
case (ast.ann_type(?ty, _, _)) { 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] { fn ann_to_type_params(&ast.ann ann) -> vec[@t] {
alt (ann) { alt (ann) {
case (ast.ann_none) { 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; fail;
} }
case (ast.ann_type(_, ?tps, _)) { case (ast.ann_type(_, ?tps, _)) {
@ -697,7 +697,7 @@ fn ann_to_monotype(ast.ann a) -> @ty.t {
// confident that it works. // confident that it works.
alt (a) { alt (a) {
case (ast.ann_none) { 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; fail;
} }
case (ast.ann_type(?typ, ?tps_opt, _)) { 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)); ast.expr_path(p, dopt, ann));
} }
case (_) { case (_) {
log "unhandled expr type in replace_expr_type(): " + log_err "unhandled expr type in replace_expr_type(): " +
pretty.pprust.expr_to_str(expr); pretty.pprust.expr_to_str(expr);
fail; fail;
} }
@ -1356,7 +1356,7 @@ fn unify(@ty.t expected, @ty.t actual, &unify_handler handler)
case (ty.ty_bound_param(?actual_id)) { case (ty.ty_bound_param(?actual_id)) {
alt (expected.struct) { alt (expected.struct) {
case (ty.ty_local(_)) { case (ty.ty_local(_)) {
log "TODO: bound param unifying with local"; log_err "TODO: bound param unifying with local";
fail; fail;
} }
@ -1782,7 +1782,8 @@ fn unify(@ty.t expected, @ty.t actual, &unify_handler handler)
let vec[@t] result = vec(); let vec[@t] result = vec();
for (vec[@t] types in set_types) { for (vec[@t] types in set_types) {
if (_vec.len[@t](types) > 1u) { 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; fail;
} }
result += vec(types.(0)); result += vec(types.(0));
@ -1878,7 +1879,7 @@ fn bind_params_in_type(@t typ) -> @t {
fn binder(@t typ) -> @t { fn binder(@t typ) -> @t {
alt (typ.struct) { alt (typ.struct) {
case (ty_bound_param(?index)) { 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"; "has bound params in it";
fail; fail;
} }

View file

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

View file

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

View file

@ -96,7 +96,7 @@ mod CT {
if (_str.eq(curr, "%")) { if (_str.eq(curr, "%")) {
i += 1u; i += 1u;
if (i >= lim) { if (i >= lim) {
log "unterminated conversion at end of string"; log_err "unterminated conversion at end of string";
fail; fail;
} }
auto curr2 = _str.substr(s, i, 1u); 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) { fn parse_type(str s, uint i, uint lim) -> tup(ty, uint) {
if (i >= lim) { if (i >= lim) {
log "missing type in conversion"; log_err "missing type in conversion";
fail; fail;
} }
@ -290,7 +290,7 @@ mod CT {
} else if (_str.eq(tstr, "t")) { } else if (_str.eq(tstr, "t")) {
t = ty_bits; t = ty_bits;
} else { } else {
log "unknown type in conversion"; log_err "unknown type in conversion";
fail; 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 + 2u) as uint) << 8u) |
(data.(start + 3u) as uint), start + 4u); (data.(start + 3u) as uint), start + 4u);
} else { } 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)) { alt (maybe_get_doc(d, tg)) {
case (some[doc](?d)) {ret d;} case (some[doc](?d)) {ret d;}
case (none[doc]) { 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; fail;
} }
} }
@ -140,7 +140,7 @@ fn write_sized_vint(&io.buf_writer w, uint n, uint size) {
(n & 0xffu) as u8); (n & 0xffu) as u8);
} }
case (_) { case (_) {
log "vint to write too big"; log_err "vint to write too big";
fail; 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 < 0x4000u) { write_sized_vint(w, n, 2u); ret; }
if (n < 0x200000u) { write_sized_vint(w, n, 3u); ret; } if (n < 0x200000u) { write_sized_vint(w, n, 3u); ret; }
if (n < 0x10000000u) { write_sized_vint(w, n, 4u); 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; fail;
} }

View file

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