diff options
| author | Marijn Haverbeke <[email protected]> | 2011-04-19 12:02:06 +0200 |
|---|---|---|
| committer | Marijn Haverbeke <[email protected]> | 2011-04-19 16:57:13 +0200 |
| commit | 6511d471bafd446026462ce0dba8ef5e2ebf462f (patch) | |
| tree | 7d1be7a2ed367965ef50b1e6f12c87e74391f750 /src/comp/driver | |
| parent | add log_err to rustc (diff) | |
| download | rust-6511d471bafd446026462ce0dba8ef5e2ebf462f.tar.xz rust-6511d471bafd446026462ce0dba8ef5e2ebf462f.zip | |
replace error logging with log_err in stdlib and rustc
Diffstat (limited to 'src/comp/driver')
| -rw-r--r-- | src/comp/driver/rustc.rs | 33 | ||||
| -rw-r--r-- | src/comp/driver/session.rs | 36 |
2 files changed, 34 insertions, 35 deletions
diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs index db069279..085a1f58 100644 --- a/src/comp/driver/rustc.rs +++ b/src/comp/driver/rustc.rs @@ -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 { diff --git a/src/comp/driver/session.rs b/src/comp/driver/session.rs index 9cbbc94c..8e0f22b2 100644 --- a/src/comp/driver/session.rs +++ b/src/comp/driver/session.rs @@ -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; } |