diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-04-09 10:23:58 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-04-09 10:23:58 +0000 |
| commit | c0a9c8c9549662ec9199112cb59592ef2c617412 (patch) | |
| tree | b8141f86b15cefe603cf9d18ba28cf6a9204ec5a /compiler/rustc_hir_analysis/src | |
| parent | c8f6e03c1570200dbb99587fb257d371aa7447b3 (diff) | |
| download | rust-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.rs | 10 |
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 => { |
