Skip to content

Commit 6806486

Browse files
Prevent to try to retrieve auto and blanket implementations if there were errors before this pass
1 parent e72ea1d commit 6806486

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/librustdoc/passes/collect_trait_impls.rs

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ pub(crate) const COLLECT_TRAIT_IMPLS: Pass = Pass {
1919
};
2020

2121
pub(crate) fn collect_trait_impls(mut krate: Crate, cx: &mut DocContext<'_>) -> Crate {
22+
// We need to check if there are errors before running this pass because it would crash when
23+
// we try to get auto and blanket implementations.
24+
if cx.tcx.sess.diagnostic().has_errors_or_lint_errors().is_some() {
25+
return krate;
26+
}
27+
2228
let synth_impls = cx.sess().time("collect_synthetic_impls", || {
2329
let mut synth = SyntheticImplCollector { cx, impls: Vec::new() };
2430
synth.visit_crate(&krate);

0 commit comments

Comments
 (0)