Use has_errors_or_lint_errors
in rustdoc instead of abort_if_errors()
Rustdoc is special as usual and doesn't go through RunCompiler, so it needs its own explicit checks. The rest of the tools go through RunCompiler, so they should be fine.
This commit is contained in:
parent
c008bb0012
commit
ebf8966156
3 changed files with 9 additions and 5 deletions
|
@ -486,11 +486,13 @@ crate fn run_global_ctxt(
|
|||
};
|
||||
if run {
|
||||
debug!("running pass {}", p.pass.name);
|
||||
krate = ctxt.tcx.sess.time(p.pass.name, || (p.pass.run)(krate, &mut ctxt));
|
||||
krate = tcx.sess.time(p.pass.name, || (p.pass.run)(krate, &mut ctxt));
|
||||
}
|
||||
}
|
||||
|
||||
ctxt.sess().abort_if_errors();
|
||||
if tcx.sess.diagnostic().has_errors_or_lint_errors() {
|
||||
rustc_errors::FatalError.raise();
|
||||
}
|
||||
|
||||
let render_options = ctxt.render_options;
|
||||
let mut cache = ctxt.cache;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use rustc_ast as ast;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_errors::{ColorConfig, ErrorReported};
|
||||
use rustc_errors::{ColorConfig, ErrorReported, FatalError};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::LOCAL_CRATE;
|
||||
use rustc_hir::intravisit;
|
||||
|
@ -149,7 +149,9 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
|
|||
|
||||
collector
|
||||
});
|
||||
compiler.session().abort_if_errors();
|
||||
if compiler.session().diagnostic().has_errors_or_lint_errors() {
|
||||
FatalError.raise();
|
||||
}
|
||||
|
||||
let unused_extern_reports = collector.unused_extern_reports.clone();
|
||||
let compiling_test_count = collector.compiling_test_count.load(Ordering::SeqCst);
|
||||
|
|
|
@ -775,7 +775,7 @@ fn main_options(options: config::Options) -> MainResult {
|
|||
// current architecture.
|
||||
let resolver = core::create_resolver(queries, sess);
|
||||
|
||||
if sess.has_errors() {
|
||||
if sess.diagnostic().has_errors_or_lint_errors() {
|
||||
sess.fatal("Compilation failed, aborting rustdoc");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue