Stop bailing out from compilation just because there were incoherent traits

This commit is contained in:
Oli Scherer
2024-02-02 08:36:46 +00:00
parent 7f1d523cd0
commit 83738a9b1c
46 changed files with 473 additions and 92 deletions

View File

@@ -1990,6 +1990,10 @@ pub(super) fn check_type_bounds<'tcx>(
impl_ty: ty::AssocItem,
impl_trait_ref: ty::TraitRef<'tcx>,
) -> Result<(), ErrorGuaranteed> {
// Avoid bogus "type annotations needed `Foo: Bar`" errors on `impl Bar for Foo` in case
// other `Foo` impls are incoherent.
tcx.ensure().coherent_trait(impl_trait_ref.def_id)?;
let param_env = tcx.param_env(impl_ty.def_id);
debug!(?param_env);