Do not remove previously added predicates in param_env, extend them instead

This commit is contained in:
Santiago Pastorino 2023-06-22 17:44:44 -03:00
parent 373293c3ca
commit 33d21e62d0
No known key found for this signature in database
GPG Key ID: 8131A24E0C79EFAF

View File

@ -131,7 +131,9 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
if let Some(ImplTraitInTraitData::Trait { fn_def_id, .. })
| Some(ImplTraitInTraitData::Impl { fn_def_id, .. }) = tcx.opt_rpitit_info(def_id)
{
predicates = tcx.predicates_of(fn_def_id).instantiate_identity(tcx).predicates;
// FIXME(-Zlower-impl-trait-in-trait-to-assoc-ty): Should not need to add the predicates
// from the parent fn to our assumptions
predicates.extend(tcx.predicates_of(fn_def_id).instantiate_identity(tcx).predicates);
}
// Finally, we have to normalize the bounds in the environment, in