]> git.lizzy.rs Git - rust.git/blobdiff - src/librustdoc/passes/collect_trait_impls.rs
Prevent to try to retrieve auto and blanket implementations if there were errors...
[rust.git] / src / librustdoc / passes / collect_trait_impls.rs
index d57f981d51a84fac39729d530f055d8324a8d68c..79db3c6c3e78699845da1046efadd30e849c33ed 100644 (file)
 };
 
 pub(crate) fn collect_trait_impls(mut krate: Crate, cx: &mut DocContext<'_>) -> Crate {
+    // 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 cx.tcx.sess.diagnostic().has_errors_or_lint_errors().is_some() {
+        return krate;
+    }
+
     let synth_impls = cx.sess().time("collect_synthetic_impls", || {
         let mut synth = SyntheticImplCollector { cx, impls: Vec::new() };
         synth.visit_crate(&krate);