about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-04-17 14:25:10 +0000
committerbors <bors@rust-lang.org>2024-04-17 14:25:10 +0000
commit00ed4edb44ccc76d8cc992ef9f9f4634ea6d0e82 (patch)
tree52396d96cc39e2268ae39fad1ab72e5d0b99336f /compiler/rustc_hir_analysis
parent6c6b3027ef62e911142cfc55589baef4e9f38ec8 (diff)
parentc0a9c8c9549662ec9199112cb59592ef2c617412 (diff)
downloadrust-00ed4edb44ccc76d8cc992ef9f9f4634ea6d0e82.tar.gz
rust-00ed4edb44ccc76d8cc992ef9f9f4634ea6d0e82.zip
Auto merge of #123674 - oli-obk:bogus_note, r=estebank
Silence some follow-up errors on trait impls in case the trait has conflicting or otherwise incoherent impls

fixes #123292

Also removes a bunch of extra diagnostics that were introduced in https://github.com/rust-lang/rust/pull/121154 and https://github.com/rust-lang/rust/pull/120558
Diffstat (limited to 'compiler/rustc_hir_analysis')
-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 8c85d13650b..3881e240ced 100644
--- a/compiler/rustc_hir_analysis/src/check/check.rs
+++ b/compiler/rustc_hir_analysis/src/check/check.rs
@@ -660,8 +660,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 => {