1
Fork 0

Auto merge of #109089 - compiler-errors:opt_rpitit_info-follow-up, r=spastorino

Encode `opt_rpitit_info` for associated types

Follow-up, only last commit matters

r? `@spastorino`

This needs a perf run after the parent pr lands
This commit is contained in:
bors 2023-03-15 08:13:23 +00:00
commit 992d154f3a
5 changed files with 16 additions and 8 deletions

View file

@ -119,12 +119,9 @@ fn adt_sized_constraint(tcx: TyCtxt<'_>, def_id: DefId) -> &[Ty<'_>] {
fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
// When computing the param_env of an RPITIT, copy param_env of the containing function. The
// synthesized associated type doesn't have extra predicates to assume.
let def_id =
if let Some(ImplTraitInTraitData::Trait { fn_def_id, .. }) = tcx.opt_rpitit_info(def_id) {
fn_def_id
} else {
def_id
};
if let Some(ImplTraitInTraitData::Trait { fn_def_id, .. }) = tcx.opt_rpitit_info(def_id) {
return tcx.param_env(fn_def_id);
}
// Compute the bounds on Self and the type parameters.
let ty::InstantiatedPredicates { mut predicates, .. } =