diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2021-09-16 05:35:23 +0000 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2021-11-08 01:22:28 +0000 |
| commit | ebf8966156ab5d2831dd4cd1b34bc5a906d0f895 (patch) | |
| tree | 4a944fa29b91f03d596806e031d375593c887051 /src/librustdoc | |
| parent | c008bb0012e11804c64ed6605dbfb06705c805b3 (diff) | |
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.
Diffstat (limited to 'src/librustdoc')
| -rw-r--r-- | src/librustdoc/core.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/doctest.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/lib.rs | 2 |
3 files changed, 9 insertions, 5 deletions
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index b7251e8f571..ee71b4462ab 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -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; diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 9b32ad979e3..c10eebf49fc 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -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); diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 7eeb9d1fcaa..99809c75948 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -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"); } |
