diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-12-08 13:41:59 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-12-08 13:41:59 +0100 |
| commit | 680648625e293b3fdf8846cb2c2ef69b48e2ad70 (patch) | |
| tree | 5711f8df846b56c96f94d323bf757280177a12ad | |
| parent | e72ea1dc376e9c302c68faefafd967a8a7ef255a (diff) | |
| download | rust-680648625e293b3fdf8846cb2c2ef69b48e2ad70.tar.gz rust-680648625e293b3fdf8846cb2c2ef69b48e2ad70.zip | |
Prevent to try to retrieve auto and blanket implementations if there were errors before this pass
| -rw-r--r-- | src/librustdoc/passes/collect_trait_impls.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/librustdoc/passes/collect_trait_impls.rs b/src/librustdoc/passes/collect_trait_impls.rs index d57f981d51a..79db3c6c3e7 100644 --- a/src/librustdoc/passes/collect_trait_impls.rs +++ b/src/librustdoc/passes/collect_trait_impls.rs @@ -19,6 +19,12 @@ pub(crate) const COLLECT_TRAIT_IMPLS: Pass = Pass { }; 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); |
