about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-04-09 10:23:58 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-04-09 10:23:58 +0000
commitc0a9c8c9549662ec9199112cb59592ef2c617412 (patch)
treeb8141f86b15cefe603cf9d18ba28cf6a9204ec5a /compiler/rustc_hir_analysis/src
parentc8f6e03c1570200dbb99587fb257d371aa7447b3 (diff)
downloadrust-c0a9c8c9549662ec9199112cb59592ef2c617412.tar.gz
rust-c0a9c8c9549662ec9199112cb59592ef2c617412.zip
Silence some follow-up errors on trait impls in case the trait has conflicting or otherwise incoherent impls
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
-rw-r--r--compiler/rustc_hir_analysis/src/check/check.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs
index 8d4ae10d4bf..b223c590bff 100644
--- a/compiler/rustc_hir_analysis/src/check/check.rs
+++ b/compiler/rustc_hir_analysis/src/check/check.rs
@@ -534,8 +534,14 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
         }
         DefKind::Impl { of_trait } => {
             if of_trait && let Some(impl_trait_header) = tcx.impl_trait_header(def_id) {
-                check_impl_items_against_trait(tcx, def_id, impl_trait_header);
-                check_on_unimplemented(tcx, def_id);
+                if tcx
+                    .ensure()
+                    .coherent_trait(impl_trait_header.trait_ref.instantiate_identity().def_id)
+                    .is_ok()
+                {
+                    check_impl_items_against_trait(tcx, def_id, impl_trait_header);
+                    check_on_unimplemented(tcx, def_id);
+                }
             }
         }
         DefKind::Trait => {