Replace RPITIT current impl with new strategy that lowers as a GAT

This commit is contained in:
Santiago Pastorino 2023-06-24 00:00:08 -03:00
parent d1389b9b48
commit 20429af7a3
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
146 changed files with 1106 additions and 586 deletions

View file

@ -136,19 +136,7 @@ where
fn visit_projection_ty(&mut self, projection: ty::AliasTy<'tcx>) -> ControlFlow<V::BreakTy> {
let tcx = self.def_id_visitor.tcx();
let (trait_ref, assoc_substs) = if tcx.def_kind(projection.def_id)
!= DefKind::ImplTraitPlaceholder
{
projection.trait_ref_and_own_substs(tcx)
} else {
// HACK(RPITIT): Remove this when RPITITs are lowered to regular assoc tys
let def_id = tcx.impl_trait_in_trait_parent_fn(projection.def_id);
let trait_generics = tcx.generics_of(def_id);
(
ty::TraitRef::new(tcx, def_id, projection.substs.truncate_to(tcx, trait_generics)),
&projection.substs[trait_generics.count()..],
)
};
let (trait_ref, assoc_substs) = projection.trait_ref_and_own_substs(tcx);
self.visit_trait(trait_ref)?;
if V::SHALLOW {
ControlFlow::Continue(())
@ -651,7 +639,6 @@ impl<'tcx> EmbargoVisitor<'tcx> {
| DefKind::ForeignTy
| DefKind::Fn
| DefKind::OpaqueTy
| DefKind::ImplTraitPlaceholder
| DefKind::AssocFn
| DefKind::Trait
| DefKind::TyParam