]> git.lizzy.rs Git - rust.git/blobdiff - src/librustdoc/scrape_examples.rs
Rollup merge of #100409 - jsha:highlight-lighter, r=GuillaumeGomez
[rust.git] / src / librustdoc / scrape_examples.rs
index fd0b19034a259022f51f2f9db9f5bd10e4992c65..0d96840250332b5cb77c05c56334e2be8bdaa56a 100644 (file)
@@ -304,6 +304,12 @@ pub(crate) fn run(
         let mut finder = FindCalls { calls: &mut calls, tcx, map: tcx.hir(), cx, target_crates };
         tcx.hir().visit_all_item_likes_in_crate(&mut finder);
 
+        // The visitor might have found a type error, which we need to
+        // promote to a fatal error
+        if tcx.sess.diagnostic().has_errors_or_lint_errors().is_some() {
+            return Err(String::from("Compilation failed, aborting rustdoc"));
+        }
+
         // Sort call locations within a given file in document order
         for fn_calls in calls.values_mut() {
             for file_calls in fn_calls.values_mut() {