about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-01-22 07:56:43 +0100
committerGitHub <noreply@github.com>2024-01-22 07:56:43 +0100
commitbef2e85359ac1c826f2259ae8b93b15b7a0d032e (patch)
treed2e2ce6a28db2fad9979cbe3f5e63ea8a7c4e7bc /src
parent6687e8e460683fa2242d8eca3da49097e39f859e (diff)
parent1f9fa2305a099cbbf9858e3eb777495a7246e84a (diff)
downloadrust-bef2e85359ac1c826f2259ae8b93b15b7a0d032e.tar.gz
rust-bef2e85359ac1c826f2259ae8b93b15b7a0d032e.zip
Rollup merge of #119986 - nnethercote:fix-error-counting, r=compiler-errors,oli-obk
Fix error counting

There is some messiness in how errors get counted. Here are some cleanups.

r? `@compiler-errors`
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/core.rs1
-rw-r--r--src/librustdoc/doctest.rs1
-rw-r--r--src/librustdoc/lib.rs2
-rw-r--r--src/librustdoc/passes/collect_trait_impls.rs2
-rw-r--r--src/librustdoc/scrape_examples.rs2
5 files changed, 5 insertions, 3 deletions
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index fa72758c216..8bb1ed6d476 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -449,6 +449,7 @@ pub(crate) fn run_global_ctxt(
 
     tcx.sess.time("check_lint_expectations", || tcx.check_expectations(Some(sym::rustdoc)));
 
+    // We must include lint errors here.
     if tcx.dcx().has_errors_or_lint_errors().is_some() {
         rustc_errors::FatalError.raise();
     }
diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs
index 82746a7ab03..f2e083de0ec 100644
--- a/src/librustdoc/doctest.rs
+++ b/src/librustdoc/doctest.rs
@@ -150,6 +150,7 @@ pub(crate) fn run(options: RustdocOptions) -> Result<(), ErrorGuaranteed> {
 
                     collector
                 });
+                // We must include lint errors here.
                 if compiler.sess.dcx().has_errors_or_lint_errors().is_some() {
                     FatalError.raise();
                 }
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index d962beda4be..658ed862ae7 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -796,7 +796,7 @@ fn main_args(
 
         compiler.enter(|queries| {
             let mut gcx = abort_on_err(queries.global_ctxt(), sess);
-            if sess.dcx().has_errors_or_lint_errors().is_some() {
+            if sess.dcx().has_errors().is_some() {
                 sess.dcx().fatal("Compilation failed, aborting rustdoc");
             }
 
diff --git a/src/librustdoc/passes/collect_trait_impls.rs b/src/librustdoc/passes/collect_trait_impls.rs
index fc7ef4bcdfa..e2a7ef8556e 100644
--- a/src/librustdoc/passes/collect_trait_impls.rs
+++ b/src/librustdoc/passes/collect_trait_impls.rs
@@ -22,7 +22,7 @@ pub(crate) fn collect_trait_impls(mut krate: Crate, cx: &mut DocContext<'_>) ->
     let tcx = cx.tcx;
     // We need to check if there are errors before running this pass because it would crash when
     // we try to get auto and blanket implementations.
-    if tcx.dcx().has_errors_or_lint_errors().is_some() {
+    if tcx.dcx().has_errors().is_some() {
         return krate;
     }
 
diff --git a/src/librustdoc/scrape_examples.rs b/src/librustdoc/scrape_examples.rs
index 74bec5a2e11..b7d9c16f348 100644
--- a/src/librustdoc/scrape_examples.rs
+++ b/src/librustdoc/scrape_examples.rs
@@ -311,7 +311,7 @@ pub(crate) fn run(
 
         // The visitor might have found a type error, which we need to
         // promote to a fatal error
-        if tcx.dcx().has_errors_or_lint_errors().is_some() {
+        if tcx.dcx().has_errors().is_some() {
             return Err(String::from("Compilation failed, aborting rustdoc"));
         }