Remove many more cases of mk_substs_trait
that can now use the iterator scheme`
This commit is contained in:
parent
0fe86aa977
commit
1bf80249ae
7 changed files with 25 additions and 19 deletions
|
@ -2598,7 +2598,11 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn mk_projection(self, item_def_id: DefId, substs: SubstsRef<'tcx>) -> Ty<'tcx> {
|
||||
pub fn mk_projection(
|
||||
self,
|
||||
item_def_id: DefId,
|
||||
substs: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>,
|
||||
) -> Ty<'tcx> {
|
||||
self.mk_ty(Alias(ty::Projection, self.mk_alias_ty(item_def_id, substs)))
|
||||
}
|
||||
|
||||
|
|
|
@ -1050,6 +1050,18 @@ impl<'tcx> PolyProjectionPredicate<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> ProjectionPredicate<'tcx> {
|
||||
pub fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self {
|
||||
Self {
|
||||
projection_ty: tcx.mk_alias_ty(
|
||||
self.projection_ty.def_id,
|
||||
[self_ty.into()].into_iter().chain(self.projection_ty.substs.iter().skip(1)),
|
||||
),
|
||||
..self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ToPolyTraitRef<'tcx> {
|
||||
fn to_poly_trait_ref(&self) -> PolyTraitRef<'tcx>;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue