rustc: Re-introduce session.span_err, session.err
These errors are non-fatal. The session.abort_if_errors function needs to be called at strategic points to convert the previous errors to utter failure. Issue #440
This commit is contained in:
parent
43427dae0c
commit
942fcbe7a1
2 changed files with 16 additions and 2 deletions
|
@ -272,7 +272,7 @@ fn build_session(@session::options sopts) -> session::session {
|
|||
auto target_crate_num = 0;
|
||||
auto sess =
|
||||
session::session(target_crate_num, target_cfg, sopts, crate_cache,
|
||||
front::codemap::new_codemap());
|
||||
front::codemap::new_codemap(), 0u);
|
||||
ret sess;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,8 @@ obj session(ast::crate_num cnum,
|
|||
@config targ_cfg,
|
||||
@options opts,
|
||||
map::hashmap[int, crate_metadata] crates,
|
||||
codemap::codemap cm) {
|
||||
codemap::codemap cm,
|
||||
mutable uint err_count) {
|
||||
fn get_targ_cfg() -> @config { ret targ_cfg; }
|
||||
fn get_opts() -> @options { ret opts; }
|
||||
fn get_targ_crate_num() -> ast::crate_num { ret cnum; }
|
||||
|
@ -80,6 +81,19 @@ obj session(ast::crate_num cnum,
|
|||
emit_diagnostic(none[span], msg, "error", 9u8, cm);
|
||||
fail;
|
||||
}
|
||||
fn span_err(span sp, str msg) {
|
||||
emit_diagnostic(some(sp), msg, "error", 9u8, cm);
|
||||
err_count += 1u;
|
||||
}
|
||||
fn err(span sp, str msg) {
|
||||
emit_diagnostic(some(sp), msg, "error", 9u8, cm);
|
||||
err_count += 1u;
|
||||
}
|
||||
fn abort_if_errors() {
|
||||
if (err_count > 0u) {
|
||||
self.fatal("aborting due to previous errors");
|
||||
}
|
||||
}
|
||||
fn span_warn(span sp, str msg) {
|
||||
// FIXME: Use constants, but rustboot doesn't know how to export them.
|
||||
|
||||
|
|
Loading…
Reference in a new issue