1
Fork 0

Silence some follow-up errors on trait impls in case the trait has conflicting or otherwise incoherent impls

This commit is contained in:
Oli Scherer 2024-04-09 10:23:58 +00:00
parent c8f6e03c15
commit c0a9c8c954
11 changed files with 25 additions and 142 deletions

View file

@ -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 => {